Toolchain setup

In order to create a device firmware, you will need to set up an embedded toolchain for Rust.

Install rustup

In order to install Rust and Rust components, you will need rustup:

On Unix-like environment, the following command should work just fine:

curl --proto '=https' --tlsv1.2 -sSf | sh

There are other ways to install rustup. Check its homepage to learn more.

Also see:

Install an embedded toolchain

By default, rustup will install a toolchain (compiler, …) for your current host architecture and operating system.

However, when compiling a device firmware, we need to have a compiler for a different architecture (CPU). You can install additional toolchains on your machine. Execute the following command to install a toolchain for a Cortex-M style board:

rustup target add thumbv6m-none-eabi

In many cases, you will also need a "nightly" (unreleased) version of the Rust compiler. You can easily install this in addition to the stable version be executing:

rustup +nightly target add thumbv6m-none-eabi
The nightly version of the compiler must be explicitly enabled. When installing it, it will not become the default. So, there is no harm in installing a nightly version.

Additional tools

In addition to the actual toolchain, you will need tools to flash the firmware to your device, and to monitor what is going on.

There are a few tools for Rust which can help here. However, we will focus on the probe-run.

You can install probe-run be executing the following command:

cargo install probe-run