News for hackers. Stuff that matters.
Re:Writing embedded firmware using Rust by ahepp on Sunday December 19, 2021 @06:41PM (#29619821)
I am not terribly well versed in Rust MCU development, but I poked around with the teensy-rs and esp32-rs projects a couple years ago.

ARM seems to provide some XML register description files called SVDs[0]. They seem to do a decent job describing the registers and peripherals in a way that allows code generation tools to create a register access library, upon which higher level HALs can be built.

For an example, you might look at the esp-rs project on GitHub. The lowest level, if I recall correctly, is the Peripheral Access Crate [1]. The README for this project describes a bit about the SVD file, and svd2rs code generation tool. Sometimes the SVD file needs to be patched to produce high quality Rust bindings.

This PAC is then required as a dependency of the higher level HAL for the esp32 [2]. The higher level HAL also implements some traits from a shared Rust HAL effort [3].

I'm not really an expert in Rust so if I've described any of this wrong, someone please correct me.

[0] https://www.keil.com/pack/doc/CMSIS/SVD/html/index.html

[1] https://github.com/esp-rs/esp32

[2] https://github.com/esp-rs/esp32-hal

[3] https://docs.rs/embedded-hal/0.2.2/embedded_hal/

There are no comments on this comment yet.