$ account rust-embedded
This is a Rust library providing fixed-capacity, heap-free data structures for embedded and no_std environments. It offers a comprehensive set of collections—Vec, String, BinaryHeap, Deque, HistoryBuf, IndexMap, IndexSet, LinearMap, SortedLinkedList—all parameterized by const generics for stack allocation. Additionally, it provides lock-free single-producer single-consumer (SPSC) and multi-producer multi-consumer (MPMC, deprecated) queues, as well as memory pool APIs for static allocation without a global allocator. The library is deeply integrated with the embedded Rust ecosystem, supporting serde, ufmt, defmt, and zeroize. Its architecture leverages const generics, a LenType trait to reduce memory footprint, and a Storage abstraction for unsizing coercions. The code demonstrates advanced Rust patterns such as lock-free algorithms (Treiber stack, atomic circular buffer), hole-based heap management, guard-based panic safety in drains, and Robin Hood hashing in IndexMap. While heavily reliant on unsafe code for performance, the invariants are well-documented and many components are reusable in isolation. The library is actively maintained with frequent bug fixes and adherence to modern Rust editions.
This repository is the foundational Rust library for bare-metal development on ARM Cortex-M microcontrollers. It provides the essential runtime startup code (cortex-m-rt), low-level peripheral access (cortex-m), and debugging support (cortex-m-semihosting). The codebase implements critical safety mechanisms for embedded systems, such as preventing multiple instances of peripherals via the singleton pattern, ensuring correct stack alignment, and managing exception handling through sophisticated procedural macros. It serves as the bedrock for the Rust embedded ecosystem, enabling safe interaction with hardware registers and interrupt controllers without a standard library or operating system. The architecture is modular, separating the runtime (cortex-m-rt) from the peripheral access layer (cortex-m) and type traits (cortex-m-types). The startup code includes a robust linker script (link.x) that handles memory layout, vector table generation, and RAM initialization in assembly to guarantee correctness before Rust code executes. The repository also includes a comprehensive testsuite that runs on QEMU and physical hardware to validate interrupt handling, critical sections, and stack management across different Cortex-M variants (M0, M3, M4, M7, M33). This is a high-quality, production-grade library maintained by the Rust Embedded community. It demonstrates deep understanding of the ARM architecture, Rust's safety guarantees, and the constraints of embedded development. The code is heavily tested with compile-fail tests to ensure macro-generated code adheres to strict signatures and safety requirements.