Home > On-Demand Archives > Talks >

Rust for Embedded Developers: The Peripheral Access Crate

Jacob Beningo - Watch Now - EOC 2024 - Duration: 46:16

Rust for Embedded Developers: The Peripheral Access Crate
Jacob Beningo

The C programming language has dominated embedded software development for the last 50 years. Despite other languages coming and going, C has withstood the winds of change. The latest language to challenge C’s dominance is Rust. Rust is a system programming language offering modern features, including memory safety.

In this session, we will explore the Rust programming language from an embedded developer’s perspective. We will look at the peripheral access crate (PAC), and examine how to develop low-level drivers. As an example, we’ll look at creating a blinky hello world application and then move on to a serial peripheral driver. Attendees will walk away, understanding the advantages and disadvantages of using Rust in an embedded system.

Topics covered in this talk will include:

  • The Peripheral Access Crate (PAC)
  • How to create a PAC
  • Advantages and Disadvantages of Rust in embedded systems
  • Rust fundamentals
  • How Rust fits into the industry in the big picture
italicssurround text with
boldsurround text with
**two asterisks**
or just a bare URL
surround text with
strikethroughsurround text with
~~two tilde characters~~
prefix with

Score: 0 | 1 month ago | 1 reply

While I enjoy coding in Rust, from this video my impression is Rust support for microcontrollers is really only prime for STM32. My quick search for Rust on PIC16 and Arduino leads me to believe it wouldn't be worth the effort.

Score: 0 | 1 month ago | no reply

Thanks for the comment. I've honestly not tried on anything other than Arm Cortex-M microcontrollers. The example I've used is for STM32, but other Cortex-M parts are supported as well.

Score: 0 | 2 months ago | 1 reply

I think your explanation of a crate isn't quite right. A crate can contain multiple .rs files and is more similar to a library. Crates can contain multiple modules, which is closer to what you're explaining, where each .rs file is, by default, a single module (you can also define multiple modules in a single file if you'd like).

Score: 0 | 2 months ago | 1 reply

Thanks for the comment. I think the language is a bit ambiguous.
A quick search I found this:

In Rust, a crate is a compilation unit, which can be thought of as a package or a library. It is the fundamental building block of a Rust project, similar to a package in other programming languages.

So an individual .rs file can be considered a crate. However, if you a project that will be used as a library or package, that could also be considered a crate.

So in my example, we had many .rs files in that we compiled into a single library crate for the L475. Then we used that single crate in a project that had a single .rs file.

I agree I could have been more clear on the definition!

Score: 0 | 2 months ago | no reply

Fair enough. Great talk though!