The overall argument that Rust's use in embedded has a long way to go is fairly accurate. A foundational crate like embedded-hal reached 1.0 only 2 months ago, 8 years after Rust 1.0. On the other hand, this crate reaching 1.0 means the rest of the ecosystem can now mature alongside it. The paper could use a few minor corrections and improvements. For example, they go through thousands of crates in crates.io to give…
You mean embedded-hal, not embedded-hat :-)
Rust for Embedded Systems: Current state, challenges and open problems
21–30 of 159 posts
Re: Rust for Embedded Systems: Current state, challenges and open problems
#22my takeaways: 1. https://arewertosyet.com/ to track rust RTOSes and their status 2. there are tools to convert c to rust (I dont know if I'd trust this..) 3. "Out of 43 different MCU families, peripheral crates are currently available for only 16 (37%). Most of these crates are generated using svd2rust utility" 4. developers considered but rejected rust because: "Lack of Support for MCUs (36%) ; Difficulty Integratin…
> 3. "Out of 43 different MCU families, peripheral crates are currently available for only 16 (37%). There are a lot of obscure MCU families out there. Most engineers or shops specialize in a couple, become familiar with those, and stick to it. Using and learning a brand new MCU family is a lot of work. As long as I can find Rust support for common MCUs that I use, I don’t care how broadly the rest of the market is c…
Re: Rust for Embedded Systems: Current state, challenges and open problems
#23So let's say I happen to work with a MCU that is well supported in Rust, what if I want to connect it to a popular OLED display? Is there a library for that? If so, does it work? If it works, does it have the needed features? Now maybe I am incredibly lucky and all of that works, what about a popular gyro IC?
Granted, there is probably some way to interface the Rust code with C code, but is that gonna work without turning it into a day of research?
I will certainly check back on the state of Rust on embedded every now and then, but as of now C++ is my goto.
Re: Rust for Embedded Systems: Current state, challenges and open problems
#24Til then, no way to switch.
Re: Rust for Embedded Systems: Current state, challenges and open problems
#25Out of Bounds Reads => 18.6%;
Out of Bounds Writes => 62.7%;
Null-Ptr Deref => 8.5%;
Use-After-Free => 5.1%;
Type Confusion, Uninitialized Pointer Access, Memory Leak => EACH 1.5%;
I have to wonder about the applicability of these percentages to non-RTOS programming. I find it very interesting that 81% of CVE's are allocated to Out-of-Bound Read/Writes, with writes being the larges percent of those obviously.
Has there been any CVE cause analysis performed and publicly available? If so and the percentages bear out similarly to RTOS's across a spectrum of application/system types then there may be some clear cost/benefit analysis needed at the programming language design stage. Rust is a complex language with a complex type and lifetime system to achieve memory safety, and it is not an uncommon refrain that a simpler 'safe' language would be appreciated by many developers. If 80% of CVE's come from Read/Write errors on array access, then a language that enforces strict memory access semantics, but forgoes the rest of Rust's complexity regarding lifetimes and type system complexity would achieve a very large portion of exploit prevention at a minimal cost.
Additionally, if you prevent Null types in the type system the language would then prevent 90% of CVE causes, again with a minimal amount of complexity.
I'm not certain that the above is correct, if the percentages play out in the large, or that devs would actively switch to a considerably safer, while being simpler language. But it certainly is thought provoking.
Re: Rust for Embedded Systems: Current state, challenges and open problems
#26Re: Rust for Embedded Systems: Current state, challenges and open problems
#27As a rust programmer that programs C++ on embedded, the main thing preventing adoption is the ecosystem. So let's say I happen to work with a MCU that is well supported in Rust, what if I want to connect it to a popular OLED display? Is there a library for that? If so, does it work? If it works, does it have the needed features? Now maybe I am incredibly lucky and all of that works, what about a popular gyro IC? Gran…
Re: Rust for Embedded Systems: Current state, challenges and open problems
#28These are all real issues with Rust, though it's worth noting that many of the integration challenges mentioned also apply to external code written in C and C++. Some of the survey responses highlight one of the biggest hurdles to rust adoption I've experienced though: Rust has an education problem. People dramatically overestimate the correctness of their [C/C++] code and underestimate the potential severity of fail…
Really depends on the field. I heard more than once in my life now that it's better to reboot every night than spend even an afternoon of engineering trying to fix memory leaks.
Re: Rust for Embedded Systems: Current state, challenges and open problems
#29Re: Rust for Embedded Systems: Current state, challenges and open problems
#30How long before I can visually debug rust on MCUs with source level stepping in my IDE? Til then, no way to switch.