Rust on Embedded: How we monitor our battery storage systems
blog.lohr.dev
blog.lohr.dev
On the tooling side, probe-rs is very nice and lets you get up and running with RTT + debug quickly.
The RTOS ecosystem is vibrant. Of note:
- The focus of most iot development seems to be embassy-rs
- I am building a project with hard real-time guarantees with RTIC and it's been pretty straightforward so far
- Oxide's Hubris looks interesting
If I were going to write a relatively simple, very high reliability system on an STM32 platform, I would do it in Rust without hesitation. (I am currently doing exactly this)
It'll be interesting to see if "rewrite it in Rust" really can re-do all these efforts satisfactorily. Or to see how Rust & C interop goes (as Linux is doing). Or whether Rust remains useful & awesome on embedded if and only if you don't need complex protocols and device drivers.
Yeah, we started using Zephyr about a year ago at work and while it hasn't been seamless it has been pretty darned awesome. One of the more interesting outcomes is that, more often than not, we've shifted from "lots of stupid easy bugs" to a smaller handful of "tricky to debug" bugs, around half of them being actual hardware issues and not strictly code issues. One of the most amazing things has been being able to take the same firmware code and run it on our v1 production board using a Cortex M0 and on our v2 prototype board using a Teensy v4.1 Cortex M7 board and all we really needed to do was modify the devicetree to remap which peripherals and pins were connected to the rest of the hardware. Amazing!
One of my coworkers has started using Rust on a personal embedded project (on an STM32 processor of some kind). Once we're done this current prototype cycle I want to sit down with him and see what he's got figured out. Seems like a cool place for Rust and all of the memory safety goodness.