Embedded Rust or C Firmware? Lessons from an Industrial Microcontroller Use Case

· systems · Source ↗

TLDR

  • ArXiv paper runs parallel C vs. Rust teams on real IoT industrial firmware; Rust matches C on memory and speed, with Ariel OS beating bare-metal C stack size.

Key Takeaways

  • Paper (arXiv:2604.25679, authors from STMicro, Inria, Freie Universitat Berlin, Polytechnic Turin) used two concurrent teams building identical MCU firmware over several months.
  • Hardware measurements found no meaningful difference in memory footprint or execution speed between C and Rust implementations.
  • Ariel OS (Rust runtime) produced a smaller footprint than the comparable bare-metal C stack, challenging the assumption that C wins on resource-constrained MCUs.
  • Paper concludes Rust is a viable production choice today for microcontroller firmware, not just a future prospect.
  • Study scope is a single IoT sensor platform case; generalization to all MCU families or real-time/safety-critical domains requires caution.

Hacker News Comment Review

  • Practitioners broadly agree Rust is ready for embedded work, citing ergonomics (enums, cargo, no headers) as the practical draw over memory safety arguments alone.
  • Toolchain coverage remains a real gap: many older or niche MCU platforms lack a Rust-compatible compiler, limiting adoption outside mainstream Cortex-M targets.
  • The study’s C JSON parser used malloc (via Parson, the code generator’s default) while the Rust version did not; commenters flagged this as a methodology asymmetry that skews the heap comparison, though an author confirmed it was a deliberate non-optimization given available memory.

Notable Comments

  • @eggy: Chose Ada/SPARK2014 over Rust for Cortex-M mission-critical work; cites lack of stable language spec and immature formal verification tooling in Rust.
  • @bArray: Flags that a single experiment is thin evidence for a broad conclusion that Rust is “a sound choice today.”
  • @noosphr: Raises long-term stability concern – Rust’s fast evolution is a risk for firmware needing decade-scale maintenance.

Original | Discuss on HN