Embedded Best Practices
Rules for deterministic, safe, low-footprint embedded Rust firmware.
Busca en todas las páginas de la documentación
Rules for deterministic, safe, low-footprint embedded Rust firmware.
heapless over heap. Bounded buffers with explicit overflow handling.'static.unwrap in production paths. Use defmt::unwrap! only in development.Cargo.lock. Firmware builds are time-sensitive artifacts.features for PCBs.Rarely, with pool allocator and soak tests measuring fragmentation over weeks.
RTIC for strict preemptive priorities; Embassy for async networking-heavy firmware.
Reserve 20% for bugfix updates and optional features.
Test algorithms on std target. Hardware tests for timing and drivers.
Rust ownership helps; still enforce no unsafe without review and documented invariants.
Measure current in sleep modes. Disable unused peripherals after init.
RTIC, Embassy, or lock-free atomics. Avoid ad-hoc static mut without sync.
Log firmware version and git hash via defmt on boot for support calls.
Store board config in flash with CRC. Migrate versions explicitly.
Prefer Rust drivers on embedded-hal. FFI to C only for certified or vendor blobs.
Stack versions: This page was written for Rust 1.97.0 (edition 2024), Tokio 1.x, Axum 0.8, serde 1.0, sqlx 0.8, clap 4, and Polars 0.46+.
Revisado por Chris St. John·Última actualización: 16 jul 2026