We asked 5 people why they like Embedded Rust

Dion
Embedded software engineer
It is no secret that we at Tweede golf love Embedded Rust, you can read about it in our other blog posts. But we thought it'd be fun to hear from the community too!

Rust compiles to bare metal just like C and C++ do, but offers a modern language with a focus on performance, safety and usability.

We've gathered some quotes mixed with a little bit of background for you to enjoy.

Modularization & crates.io

The crate ecosystem makes it incredibly easy to modularize your codebase and quickly bring in complex functionality (e.g. full-featured ethernet stacks, USB-device stacks, device drivers, etc.) with a few lines of code.

Ryan Summers, Vertigo Designs

Pulling down dependencies is indeed very easy in Rust and a huge productivity boost. People online do express their worry that this can lead to situations à la NPM, but we haven't found this to be true so far. Embedded libraries are often low in dependencies anyways and with a little bit of self-control, you can avoid bad situations.

Ryan works at Vertigo Designs and does a lot of open-source work. One of the projects he contributes to is QUARTIQ Stabilizer, a flexible tool designed for quantum physics experiments and one of the most hardcore open-source Rust firmware projects.

Same tooling as for desktop apps

It's hard to choose any one thing that makes embedded Rust great because there are many. But if I had to make a choice, I would say it's that it brings all the great Rust tooling like Cargo and rust-analyzer to embedded platforms.

Maarten de Vries, De Vries Software

It is amazing how easy it is to set up your environment so that it supports embedded development. Just add the compiler target with one rustup command:

rustup target add thumbv7em-none-eabihf

And now you can compile code for the Cortex M4 & M7.

Want to flash it to your microcontroller? Just install a program that integrates with the Cargo tool:

cargo install cargo-flash

# Compile the project and flash it to the chip
cargo flash --chip nRF52840_xxAA

Maarten is a freelance software architect and developer with expert level knowledge of the Rust and C++ programming languages, Linux, computer networks and hardware integration and a strong affinity for the field of robotics. He works on Embedded Rust when contributing to RoboHouse, and previously at Fusion Engineering.

Easily switch between chip vendors

One great feature of Rust embedded is that the tooling works with multiple vendors, so moving from one chip vendor to another does not require learning a new tool and you can still use the same tools for creating your application. In the C world, this has traditionally been a feature of the RTOS, but with Rust it's just part of the language and tooling.

Ulf Lilleengen

Most chip vendors don't support Rust yet, however, there are a lot of very good open-source libraries for many targets. Those libraries are often the only specific target code that your project contains.

To switch to a different chip vendor, you only need to update the code that is specific to the chip. All your tools stay the same. You can still use Cargo, your favorite IDE/editor, rustup, rust analyzer, etc.

Ulf is a software engineer at Red Hat, making contributions to the Drogue IoT and Embassy projects.

Productivity and reliability

By leveraging Rust's type system and safety systems we can get new developers up and running in two weeks writing embedded code without the fear of getting crashes. Just follow the compiler errors and when it compiles, you know it works.

Emil Fresk, Widefind AB

We often hear that it can take a long time to get started with Rust and that's certainly true. However, if you already have an established codebase, making changes to it is likely easier than with a similar C codebase because when something breaks it can be caught by the compiler.

Emil is the CTO and one of the founders of Widefind, a Swedish company creating 3d positioning devices for the mining industry

Batteries included

Rust is unique in allowing you to write fast, low-level programs, with modern tooling and ergonomics. There are only a handful of languages suitable for writing code where performance is a priority, or resources are constrained. Of these, Rust's language design, syntax, and official tooling make it the easiest to work with. (TLDR: The only options are C, C++, Rust, and maybe ADA or Zig. Rust has the best tooling and syntax of these!)

David O'Connor (firefrommoonlight)

David has a lot to say about embedded Rust! He must be the first person to have a TLDR inside a quote. But, this is his podium so here it is:

Some examples:

  • Official, standardized, automatically-published documentation for the Rust language, and third-party libraries: Official docs page
  • A standardized tool used to compile and flash programs: Cargo
  • Official and included formatter and linter
  • A standardized project structure and layout, including a project configuration file (cargo.toml) that contains publication metadata, and semvar dependencies
  • High-level abstractions and data structures associated with modern languages
  • Easy compiling, flashing, and debugging

Compared to equivalent code in C, ergonomic advantages include: not duplicating code between source and header files; not needing to prefix variables with the module name; explicit types for arrays (instead of relying on pointers); cleaner syntax in a number of areas

The major takeaway is that Rust has all the things you'd expect from a modern language and brings that to embedded as well.

David is very active in the opensource embedded community of Rust and occasionally writes blogs as well: link

Conclusion

One of the major things people like is tooling! Whenever we ask people, that's the first thing that comes up.

Hopefully, by now you have a sense of what people like about Rust. We will definitely be continuing to use it and create awesome applications.

Thank you to all the people who were willing to give a nice quote! It was really cool to meet you and learn more about how you are all using Embedded Rust in practice.

(our services)

Want to explore Embedded Rust?

We offer:

  • introductory talks
  • off-the-shelf or tailor-made workshops
  • flexible team augmentation options

Our Rust services

Stay up-to-date

Stay up-to-date with our work and blog posts?

Related articles

While using a full-blown filesystem for storing your data in non-volatile memory is common practice, those filesystems are often too big, not to mention annoying to use, for the things I want to do. My solution?

I've been hard at work creating the sequential-storage crate. In this blog post I'd like to go over what it is, why I created it and what it does.

At Tweede golf we're big fans of creating applications on embedded devices with Rust and we've written a lot about it.

But if you're a hardware vendor (be it chips or full devices/systems), should you give your users Rust support in addition to your C support?

In this blog I argue that the answer to the question is yes.

In Dutch we have a saying 'meten is weten', which translates to 'to measure is to know'. That sentiment is frequently overlooked in setting up computers and networks.