by R0b0t1 · 6y ago · 0 comments
There is an interesting gap: the C code for the HAL/stdlib of a device is typically machine generated from the VHDL and register descriptions. If you could get at that machine description, or e.g. use clang to parse the headers, you could make some good inroads into this.
As it is I typically avoid microcontrollers because of all the pointless plumbing I am required to do.
svd2rust [1] is an project that generates a (very low level) Rust API for a specific micro from this file.
Generally the file generated from this is known as the header files (as it is just C headers to access the registers directly) and the HAL is an abstraction layer on top, and is actually written manually by the microcontroller designer as it contains higher level functions (e.g. a function to calculate the clock settings to get a specific UART baudrate).
The STDLib is often supplied by the compiler vendor instead, or is an open source project like picolibc [2]
The Rust project is a step in the right direction.