no_std, aucun panic sur les chemins de production, matériel derrière des traits.
Constitution — Embedded Rust
Version 1.0.0 · Ratified 2026-11-10
These principles hold for every spec, plan and task of the firmware. A spec may add rules; it never weakens these.
-
no_std. The firmware is
#![no_std]and usescoreand, only where the plan allows, a fixed-size allocator orheaplesscollections. A dependency that pulls instdfails the build. -
No panics on production paths. Production code uses
Resultand neverunwrap,expect, unchecked indexing or arithmetic that can overflow; Clippy deniesunwrap_usedandexpect_used. The panic handler resets the device and records the reason. -
Hardware behind traits. Drivers are written against
embedded-haltraits (I2C, SPI, digital pins, delays), not a specific HAL. The same driver runs on the target and on the host withembedded-hal-mockin tests. -
Unsafe is rare and justified. Each
unsafeblock has the smallest scope possible and aSAFETYnote in the review describing the invariant. Newunsafecode needs a second reviewer. -
Concurrency is checked by the compiler. Shared state between interrupts and tasks goes through RTIC resources, Embassy primitives or
critical-sectionmutexes. Nostatic mutis accessed outside them. -
Size and timing budgets. The flash and RAM use of each release build is reported by
cargo sizein CI and stays within the budget in the plan. The release profile fixesopt-level, LTO andcodegen-units = 1. -
Tested on the host and on the board. Logic and drivers are tested on the host in CI; integration tests run on a reference board with
probe-rsanddefmt-testbefore each release.