4 comments

[ 2.9 ms ] story [ 18.5 ms ] thread
While the article is a little over the top with Rust vs C, the how to portion of this artivle is nice, as well as the explanation of some of the pitfalls.
Thanks! :-) I'm the author and I have seen my IoT students suffer while learning Arduino programming. So my article was really about the bad C coding in Arduino: pointers, bit-banging, ...

But really... we have suffered with C for so many years, why haven't we moved on to Rust?

I wonder if Mynewt would consider adding Rust code to the OS core code. It would probably complicate the build process and other things and I'm not sure it would be worth it for this type of programming.

Thanks for the interesting article, I enjoyed reading it.

Thanks :-) I'm not speaking on behalf of the terrific Mynewt team, but I feel that Mynewt is already a great embedded RTOS with many well-crafted low-level APIs, done in C.

Like the Mynewt Sensor Framework. It really saves you a lot of trouble when building IoT devices. Just pick a sensor driver from their library, and Mynewt handles all the sensor polling for you...

https://mynewt.apache.org/latest/os/modules/sensor_framework...

Adding Rust to the core Mynewt OS may cause "Abstraction Bloat", I think. We will start adding layers of wrappers on top of bare metal to make the OS look tidily object-oriented, to fit all past, present and future microcontrollers, peripherals, data interfaces, ... Then add another layer to make it easy for app developers to call.

No offence to the Embedded Rust community, but I fear that Mynewt with Rust will become a complicated OS with this GPIO code...

https://rust-embedded.github.io/book/static-guarantees/desig...

The best way forward I think: Get embedded app developers to move away from C and port their embedded apps to Rust. Build the apps with safe Rust wrappers on top of the OS.

Once we figure out what kind of APIs the embedded Rust apps really need (e.g. Sensor Framework), then we dig deeper and restructure the OS with Rust. This could work with any embedded OS: Mynewt, Zephyr, FreeRTOS, ...