Why Rust is worse than C for programming low-level hw
infosec.exchange
infosec.exchange
We haven't produced an alternative, so are still using those lower-level svd2rust APIs. But the pain points are very real.
Overall, still quite happy with embedded Rust overall, dealing with annoying APIs is just part of doing professional work.
(Hubris' design also mitigates this issue indirectly, since you're communicating with a driver, where this kind of code lives, so most of the code has a much nicer API, which is also why it's not the end of the world.)
Either case it's way easier to just twiddle the bits yourself, and can be clearer is that code is tailor made to your use case.
FWIW, I still jump to Rust to begin with, just ignore most libraries.
I've yet to discover a language that doesn't allow a sufficiently clever engineer paint themselves into a corner with API complexity. Even deliberately simple languages like Python suffer from this.
Nothing about this post is notable or interesting. It's low-effort rage bait.
I don't have any data to back this and library interface designs are so personal taste-prone, but I would say that the average Rust crate has a better API than the average C library.
It's all great and clean if you're just writing led blinky examples. As soon as you need to dig down to some obscure datasheet minutia (as you invariably have to for any decent size embedded project), it becomes very annoying to map this back to the safe API. The code also becomes less readable since you can no longer look up things you don't understand in the datasheet.
The other this is that because of the excessive use of typestate, any driver struct needs to have a separate generic parameter for each io pin.
Recent languages tend to come from the other direction.
[1] https://www.humprog.org/~stephen//research/papers/kell17some...