derive-mmio
FreeCreating MMIO-friendly APIs for embedded peripherals.
FreeFree tier
About derive-mmio
derive-mmio is a Rust procedural macro (derive macro) that automatically generates Memory-Mapped I/O (MMIO) safe structures from plain struct definitions. It is designed for embedded systems development, enabling type-safe and ergonomic access to peripheral registers. The library is part of the Knurling project by Ferrous Systems, focusing on improving tooling for embedded Rust. It supports a minimum Rust version of 1.85 and is dual-licensed under Apache 2.0 and MIT. derive-mmio is open source and available on GitHub under the knurling-rs organization, with 23 stars and 10 releases as of the latest version 0.8.0.
Key Features
Derive macro to generate MMIO-safe register block structures from plain Rust structs
Part of the Knurling project by Ferrous Systems, focused on embedded Rust tooling
Type-safe access to memory-mapped peripheral registers
Supports Rust 1.85 (MSRV) and tested against latest stable
Dual-licensed under Apache 2.0 and MIT
Open source on GitHub with 10 releases and active development
Pros & Cons
Pros
- Reduces boilerplate by automatically generating register access code
- Enhances type safety for direct memory-mapped register manipulation
- Part of the well-regarded Knurling project with an embedded ecosystem focus
- Dual license (Apache 2.0 / MIT) allows flexible use in both open and closed source projects
- Actively maintained with multiple releases and community support
Cons
- Limited to Rust embedded development, not general-purpose
- Requires Rust 1.85 or later (MSRV), which may not be available in all toolchains
- Experimental in nature, may have breaking changes between versions
- Relies on a derive macro, which can increase compile times in some cases
Best For
Embedded systems development on microcontrollersWriting device drivers that require memory-mapped I/O accessBuilding safe and ergonomic abstractions over hardware peripherals in RustExperiments in generating MMIO-friendly APIs for embedded Rust projects
FAQ
What is the minimum supported Rust version (MSRV) for derive-mmio?
The minimum supported Rust version is 1.85 (or Ferrocene 25.05).
What licenses is derive-mmio available under?
It is dual-licensed under Apache License 2.0 and MIT License.
Is derive-mmio part of any larger project?
Yes, it is part of the Knurling project by Ferrous Systems, which aims to improve tooling for embedded systems development.
Where can I find documentation for derive-mmio?
Documentation is available at https://docs.rs/derive-mmio.