os_metal_primitives
os_metal_primitives is a dependency-free, no_std-first crate that provides small, strongly
typed building blocks for bare-metal / OS kernel development in Rust (edition 2024).
This crate focuses on low-level primitives you can reuse across kernels and architectures:
- Typed MMIO registers with volatile reads/writes (
mmio::MmioCell) - Bitfield helpers and a compact declarative macro (
os_metal_primitives::bitfield!) - Register access modes (RO/WO/RW) and a register block helper macro (
os_metal_primitives::define_register_block!) - Port I/O wrapper types (
port_io::{Port8, Port16, Port32}) via an architecture-provided trait - IRQ types and a fixed-size, allocation-free dispatch table (
irq::IrqTable) - Driver state helpers for explicit driver lifecycles (
driver_state::DriverState)
Relationship with your other crates
This crate is intentionally independent and does not depend on:
os_kernel_foundry(kernel architecture & boot orchestration)os_dev_toolkit(logging, diagnostics, fixed buffers, etc.)
Instead, it complements them by handling different concerns: typed hardware register access, bit manipulation primitives, and small kernel-friendly patterns.
Quick example: MMIO + bitfields
use MmioCell;
bitfield!
Documentation
- API docs: build locally with
cargo doc --open - Project docs: see the
docs/directory, starting fromdocs/MANUAL.md
License
MIT. See LICENSE.
Attribution
This crate was created by an AI assistant based on an idea and requirements by alisio85.