Rust on Circuit Playground Express
|Rust support for embedded systems is evolving very fast. There are many resources available if you want to start using rust for your next embedded system project.
The embedded rust book explains how rust can be used with various peripherals available on embedded platforms.
The awesome embedded rust repo contains various resources and crates available for using rust on embedded systems. This repo also has exhaustive list of boards on which rust is supported.
Last weekend I thought I will just give it a shot and try run it on Adafruit express board. It just took couple of minutes to run the rust blink example on circuit playground express board.
Embedded rust setup
First we need install rust itself, go to rustup and run the rustup-init executable, it will setup your rust environment. Then run the following commands to setup cross compile toolchain and to clone the example git repo
rustup target add thumbv6m-none-eabi cargo install cargo-hf2 git clone https://github.com/atsamd-rs/atsamd.git cd atsamd/boards/circuit_playground_express
Flashing rust blink example
To flash the example to express board, we need to put the board in bootloader mode (press the reset button twice). Run the following command from playground express example code directory to flash the code.
cargo hf2 --release --example blinky_basic
The examples in the repo are kind of basic.
Any chance you can post an example interacting with a button (reading a pin)?
Thanks