Like many firmware developers, I’ve been curious about the potential Rust can
have in the embedded space. After reading James Munns’ great
article, I decided to
find a project I could use Rust for to learn.
Excellent work!!!
Just a clarification, I dont know the inner-workings of APP_ERROR_CHECK_BOOL, but in the mean_rs == mean_c comparison, floats should never compare by value directly due the lack of precision of that type of data.
The difference between the values should be compared to be less than an acceptable error tolerance.
I think that would work, though what we really want is the ability to set crate type based on target. This is an open issue against cargo: https://github.com/rust-lang/cargo/issues/4881
I couldn’t believe that Rust could be as low memory consuming as C. But do you see other tools for Rust available like gdb ? And the language support on major vendors(ARM, RISC-V,etc) and SDK is still C mostly. Do you still recommend to learn Rust?
Rust has pretty good tooling, with new tools being developed actively (checkout probe-rs or knurling-rs for example).
To my mind, it will take time before we can see SDKs being written in Rust. The binding between C and Rust is quite easy though. Still, the focus of this article is on developing libraries using Rust because I think this is a great initial step to try out Rust and enjoy the language modernity and safety.
To answer your question: Rust is not easy to learn compared to other languages like Go, but I think this language should be taught at school because it makes you realize how to correctly write code. So even if you don’t have any project to apply Rust now, you’ll get benefits from learning the language.
I have to admit I am still learning it and it’s quite exciting