Rust for embedded use

There’s a new research paper out, on using the Rust programming language in embedded systems; the below blog post has more information as well.

Ownership is Theft: Experiences Building an Embedded OS in Rust
Amit Levy, Michael P Andersen, Bradford Campbell, David Culler, Prabal Dutta, Branden Ghena, Philip Levis, Pat Pannuto

Rust, a new systems programming language, provides compile-time memory safety checks to help eliminate runtime bugs that manifest from improper memory management. This feature is advantageous for operating system development, and especially for embedded OS development, where recovery and debugging are particularly challenging. However, embedded platforms are highly event-based, and Rust’s memory safety mechanisms largely presume threads. In our experience developing an operating system for embedded systems in Rust, we have found that Rust’s ownership model prevents otherwise safe resource sharing common in the embedded domain, conflicts with the reality of hardware resources, and hinders using closures for programming asynchronously. We describe these experiences and how they relate to memory safety as well as illustrate our workarounds that preserve the safety guarantees to the largest extent possible. In addition, we draw from our experience to propose a new language extension to Rust that would enable it to provide better memory safety tools for event-driven platforms.

Rust is apparently popular. I did one short post the other month[1], describing some existing Rust bindings for UEFI. Weeks later, that blog post is *still* one of the most-viewed posts every day.

More information:

https://mostlytyped.com/posts/experiences-building-an-os-in-ru

Click to access tock-plos2015.pdf

http://www.rust-lang.org
[1] https://firmwaresecurity.com/2015/09/04/rust-and-uefi/

Rust and UEFI

Rust is a relatively new programming language.

Back in 2013, Eric Holk started adding UEFI support in Rust:
http://blog.theincredibleholk.org/blog/2013/11/18/booting-to-rust/
https://github.com/eholk/Boot2Rust

There’s also a 2014 UEFI Rust library by “project kernel”, which includes a UEFI boot loader, among other things:
https://github.com/project-kernel/uefi-lib
https://github.com/project-kernel/kernel

Starting last month, there’s another Rust UEFI library, by William Kunkel:
https://github.com/wkunkel/libuefi

I don’t know how to program in Rust yet, so I can’t say how usable Rust is with UEFI yet. The last library looks promising, perhaps more general-purpose than the previous projects, as far as I can tell. I guess I am going to have to learn Rust…

More Information:
https://www.rust-lang.org/