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.
Sguaba is a Rust library that provides hard-to-misuse rigid body transforms (spatial math) for engineers. It enforces coordinate system safety at the type level using PhantomData and unsafe declarations, preventing accidental mixing of coordinate frames (e.g., NED vs FRD vs ENU). The library supports common Earth-bound systems (WGS84, ECEF) and local systems (NED, FRD, ENU), and provides both a mathematical API (Rotation, RigidBodyTransform) and an engineering-focused API (Orientation, Pose). It includes fast and extended algorithms for ECEF-WGS84 conversion based on recent research. The code is well-structured, thoroughly tested, and supports no_std environments via a libm feature. Active development with semantic versioning, comprehensive CI, and dependency management.
smoltcp is a standalone, event-driven TCP/IP network stack designed for bare-metal and real-time embedded systems. It operates without a heap, using compile-time fixed-size buffers and `no_std` Rust. The stack implements a full suite of protocols: Ethernet, ARP, IPv4/IPv6, TCP, UDP, ICMP, DHCPv4, DNS, IGMP/MLD, 6LoWPAN, RPL, and IPsec (AH/ESP). It is structured into modular layers: `wire/` for packet parsing and emission, `iface/` for interface logic (routing, neighbor discovery, fragmentation, multicast), `socket/` for transport and application sockets, `phy/` for hardware abstraction (loopback, raw sockets, TUN/TAP, pcap, fault injection), and `storage/` for reusable data structures (ring buffers, assemblers). The architecture follows a `Packet`/`Repr` pattern for each protocol, enabling zero-copy parsing and emission. The stack is highly configurable via feature flags, allowing minimal builds for constrained devices. It includes extensive unit tests, integration tests (including a network simulator), fuzz targets, and benchmarks. The codebase demonstrates strong engineering practices with RFC compliance, pluggable congestion control (Reno, Cubic), and async support via waker registration. It is primarily a library for use in embedded projects, IoT devices, and any environment requiring a lightweight, reliable network stack without an operating system.
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 provides two core Rust libraries: `compiler-builtins` and `libm`. `compiler-builtins` is a pure-Rust port of LLVM's `compiler-rt` intrinsics, including integer arithmetic (division, multiplication, leading/trailing zeros), floating-point operations (add, sub, mul, div, pow, conversion, truncation, extension), memory operations (memcpy, memset, memcmp), and platform-specific atomics. It is used by the Rust compiler to link against required runtime symbols for bare-metal and embedded targets. `libm` is a pure-Rust implementation of the C standard math library, ported from musl, covering trigonometric, exponential, logarithmic, power, Bessel, error, gamma, and rounding functions for f32 and f64, with experimental f16/f128 support. Both crates are `#![no_std]` and rely only on `core`. The codebase exhibits strong engineering: extensive use of generic traits (Float, Int) to abstract over widths, macro-driven code generation (intrinsics!, division algorithm macros, benchmark macros), architecture-specific optimizations (x86 SSE/AVX, ARM NEON, AArch64 outline atomics, Wasm, LoongArch, Hexagon assembly), and rigorous correctness verification against MPFR (via rug) and musl. CI tests run across 20+ targets, including instruction-count and wall-time benchmarks. This code is foundational for the Rust ecosystem, particularly in embedded, WebAssembly, and systems programming.
nalgebra is a high-performance linear algebra library for Rust, providing generic static and dynamic matrices/vectors, geometric transformations (rotations, isometries, quaternions, dual quaternions), and a comprehensive set of matrix decompositions (LU, QR, Cholesky, SVD, eigenvalue, Schur, Hessenberg, and more) implemented in pure Rust or backed by LAPACK via the nalgebra-lapack subcrate. The core library emphasizes type-safe dimensions at compile time, generic storage abstractions that support stack-allocated, heap-allocated, and view-based memory, and SIMD acceleration through the simba crate. Additional subcrates extend functionality: nalgebra-sparse handles CSR/CSC/COO sparse matrix formats with operations and IO (Matrix Market), nalgebra-glm provides a GLM-compatible graphics API, and nalgebra-macros offers procedural macros for ergonomic matrix construction. The library is production-grade, with extensive unit and property-based tests (proptest), benchmarks, and CI covering no-std and WASM targets. Its architecture is modular: the base module defines the core matrix type, storage traits, and dimension system; geometry module provides high-level wrappers; linalg module implements decompositions; and each subcrate is independently versioned and tested. The design exhibits strong engineering practices—clean trait boundaries, careful use of unsafe code (documented invariants), and macro-driven operator overloading to reduce boilerplate. While some modules (sparse, GLM) are less mature than the core, the library remains actively maintained and widely adopted in robotics, graphics, and scientific computing. Notable reusable components include the SparsityPattern structure for CSR/CSC index management, the Matrix Market parser (PEG-based), and the procedural macros for compile-time validated matrix literals. These components encapsulate non-trivial domain logic and could be adapted for other Rust linear algebra libraries with minimal modification.
Tailcall is a Rust library that provides stack-safe tail calls on stable Rust. It uses a lightweight trampoline runtime (Thunk) along with a proc-macro attribute `#[tailcall]` that transforms recursive functions. The macro can lower simple self-recursive functions into a direct loop (zero overhead), while more complex cases (mutual recursion, borrowed state) fall back to a type-erased fixed-size closure runtime. The core runtime is `no_std` compatible and uses inline storage for closures without heap allocation. The workspace includes the main `tailcall` crate (runtime), `tailcall-proc-macro` (proc-macro implementation), and integration test crates for both `std` and `no_std` environments, plus benchmarks demonstrating performance competitive with handwritten loops.
wincode is a Rust binary serialization library designed for high-performance, in-place deserialization and direct memory writes. It provides a drop-in, configurable alternative to bincode with the same default wire format, but adds compile-time configuration (endianness, integer encoding, length encoding, tag encoding) through const generics, eliminating runtime overhead. The library exposes `SchemaWrite` and `SchemaRead` traits with derive macros (`SchemaWrite`, `SchemaRead`, `UninitBuilder`) that generate optimized serialization/deserialization code, including `MaybeUninit`-based builders for initializing structs without intermediate copies. The architecture is layered: a `Reader`/`Writer` I/O abstraction with trusted-window optimizations (eliding bounds checks for known-size blocks), a schema layer mapping types to `TypeMeta` (static size and zero-copy eligibility), and a config layer that composes compile-time parameters. Unsafe code is pervasive but carefully isolated in unchecked slice readers/writers, zero-copy lifetimes (`ZeroCopy` trait), and unconditional `UninitBuilder` logic. Fuzzing, proptest-based property testing, Miri validation, and security audits by Neodyme, OtterSec, and Asymmetric Research ensure correctness under adversarial inputs. The library is actively maintained by Anza (Solana) and is used in performance-critical Solana infrastructure. It supports `no_std` + `alloc`, and integrates with external types like `bumpalo`, `bv`, `bytes`, `ecow`, `indexmap`, `smallvec`, and `uuid`. The codebase exhibits strong engineering craftsmanship but requires a high MSRV (1.89) and has a heavy reliance on unsafe that demands rigorous auditing. Overall, it is a well-architected, production-grade serialization library.
columnar is a Rust library for columnar representation of Rust data types. It provides a `Columnar` trait and a derive macro that transform ordinary structs and enums into columnar storage: each field is stored in its own typed vector, and enums store tags and payloads separately. The crate supports recursive/tree-structured enums, all-unit enums, `no_std` environments, and optional serde serialization. It is a library, not an application, with no web or CLI surface; the primary entry points are the derive macro and the `Columnar`/`ColumnarVec` traits.
gimli is a Rust library for reading and writing the DWARF debugging format, used by debuggers, profilers, and binary analysis tools. It provides zero-copy, lazy parsing of all standard DWARF sections (e.g., .debug_info, .debug_line, .debug_frame, .debug_names) across versions 2–5, including split DWARF (DWO/DWP) and supplementary object files. The library is split into `read` and `write` modules, with a conversion pipeline to transform parsed debug data back into DWARF. It is designed to be `no_std` compatible (with alloc) and uses trait-based abstractions for readers/writers, allowing custom backing stores. Example CLI tools (dwarfdump, simple, convert) demonstrate real-world usage. The codebase is highly modular, with extensive unit tests, fuzzing, and benchmarks, and emphasizes correctness, performance, and cross-platform support (32/64-bit, little/big endian).
Microsoft's official Rust framework for developing Windows drivers. The codebase is a multi-crate workspace with clean layering: `wdk-sys` provides raw bindgen-generated FFI bindings to the Windows Driver Kit (WDM/KMDF/UMDF APIs) with feature-gated API subsets (gpio, hid, spb, storage, usb, wdf); `wdk` layers safe idiomatic wrappers on top (no-std formatting buffers, WDF spinlock/timer wrappers, print macros); `wdk-build` powers driver `build.rs` scripts by auto-detecting WDK installations via registry/env vars and emitting compiler flags, linker args, and cfg settings; and `cargo-wdk` is a Cargo extension CLI for scaffolding (`new`), building (`build`), and cleaning (`clean`) driver projects including signing and packaging. Supporting crates `wdk-alloc` and `wdk-panic` provide kernel-mode global allocation (ExAllocatePool2/ExFreePool) and panic handling (KeBugCheckEx/OutputDebugStringA+abort), while `wdk-macros` implements a proc macro for typesafe dispatch of WDF function-table calls. The architecture is a layered library plus CLI toolchain, not a monolith or service; it serves driver developers as both a framework and a build tool. Key entry points are the `cargo wdk` CLI, the `wdk_build::configure_wdk_binary_build()`/`configure_wdk_library_build()` functions invoked from build scripts, and the `wdk` public API. The primary build data flow is: Cargo `[package.metadata.wdk]` manifest metadata → `wdk-build` config → bindgen → generated FFI bindings → driver binary, with WDK/SDK version and install-path detection from registry keys and environment variables. External dependencies include the Windows Driver Kit, LLVM/Clang, bindgen, and Windows packaging/signing tools (signtool, inf2cat, stampinf, certmgr). Engineering quality is genuinely strong: clean crate separation, a testable provider abstraction in the CLI (exec/fs/metadata/wdk_build), secret-redacting command logging, trybuild compile-fail tests, macrotest snapshots pinned per stable/beta/nightly toolchain, emulated-workspace integration tests, and CI spanning multiple WDK/LLVM/Rust versions with CodeQL, cargo-audit, dependabot, and release-plz release automation. Known caveats: the bindgen pipeline is fragile against WDK header changes, a proc-macro cache does not invalidate when source types change, thousands of NTSTATUS constants are manually maintained, LLVM is pinned to 17.0.6 due to an upstream ARM64 bug, and the README explicitly states the project is not yet recommended for production driver use. The repository is Windows-only by domain necessity.
SNAFU is a Rust library for ergonomic error handling. It provides a `#[derive(Snafu)]` proc-macro that generates custom error types with automatic 'context selectors' (e.g., `ReadConfigSnafu`) and implements standard traits (`Display`, `Error`, `From`). The library also offers extension traits (`ResultExt`, `OptionExt`, `TryFutureExt`, `TryStreamExt`) to attach contextual information to underlying errors, macros (`ensure!`, `whatever!`) for concise error creation, and a `Report` type for user-facing error output. It supports `no_std` environments (with `alloc`) and includes backtrace capture, location tracking, and an unstable provider API for attaching arbitrary data to errors. The crate is mature and widely adopted, but contains some deprecated features (e.g., `backtraces-impl-backtrace-crate`) and a complex feature-flag matrix. The companion `snafu-derive` crate handles all proc-macro generation, and the architecture cleanly separates parsing, validation, and code generation.
This repository is a Rust library providing structured concurrency primitives for async programming. It offers operations such as `join`, `race`, `try_join`, `race_ok` for futures, and `merge`, `chain`, `zip` for streams, supporting tuples up to 12 elements, arrays, and `Vec` (with alloc feature). It also includes `FutureGroup` and `StreamGroup` for dynamic collections, and a `ConcurrentStream` trait for processing streams concurrently with backpressure and bounded concurrency. The library is runtime-agnostic (works with tokio, async-std, smol, etc.) and supports `no_std` environments. The code extensively uses pin projection, `ManuallyDrop`, and custom waker arrays with bit-set readiness tracking to achieve efficient polling and cancellation. It provides benchmark comparisons against `futures-rs` demonstrating competitive performance. There are no data pipelines, notebooks, or research elements; this is a pure library for async concurrency.
Aerugo is a safety-critical real-time operating system (RTOS) for embedded systems, specifically targeting the ARM Cortex-M7 (ATSAMV71) microcontroller. Developed under an ESA contract for space applications, it provides a non-preemptive, cooperative scheduler based on fine-grained tasklets, along with event-driven and cyclic execution, message queues, boolean conditions, and execution monitoring. The system is designed for static allocation, no dynamic memory, and no_std environments. The repository includes a full hardware abstraction layer (HAL) for the SAMV71, covering SPI, UART, PIO, timers, watchdog, XDMAC, PMC, FPU, and more, built on top of an auto-generated peripheral access crate (PAC) from the vendor SVD. A custom Python test framework (calldwell) enables hardware-in-the-loop testing via RTT, GDB, and SSH, with formal requirements traceability embedded in test code. The architecture is modular: the core RTOS kernel resides in `src/`, platform-specific code in `arch/` (Cortex-M and x86), and reusable utilities in `utils/` (bitfield-enum macro, bounded integers, LSM6DSO IMU driver). The HAL uses typestate patterns to enforce correct driver configuration at compile time. The codebase demonstrates strong Rust embedded engineering practices, including manual vtables for type erasure, critical-section-based mutexes, and static resource management via OnceCell. However, it relies on nightly Rust features (const_mut_refs, proc_macro_tracked_env) and the PAC is auto-generated, introducing maintenance risks. The project is actively developed with a comprehensive test suite and real-world demos (e.g., SPI accelerometer with CCSDS telemetry).
This is the Rust userland library for Tock OS, providing safe abstractions over Tock syscalls (command, subscribe, allow) and a comprehensive set of driver APIs for peripherals such as GPIO, I2C, SPI, console, sensors, display, and networking. It includes a runtime with startup code for ARM, RISC-V, and x86 processes, a build system for generating Tock Binary Format (TBF) and TAB archives, and a full unit-testing framework with a fake kernel and fake drivers that enable testing Tock applications on a host machine. The architecture is trait-based, with drivers generic over a `Syscalls` implementation, allowing compile-time dependency injection for testing. This repo is not a standalone application but a library and framework for building Tock processes. It demonstrates high craftsmanship in its safe resource management patterns (e.g., `share::scope` for scoped buffer allocation) and includes a standalone micro-formatting crate (`ufmt`) that is 6-40x smaller than `core::fmt`.