This is an early draft of an embedded application support library for Rust, heavily derived from my C++ ETL. Because of limitations in the Rust tools for bare-metal and embedded work, this code only works on Nightly Rust as of this writing (November 2016).
This method will set up a self-contained environment, including Rust and an ARM toolchain, without modifying your system. This should work on any operating system, including flashing an STM32F4DISCOVERY board from within the Vagrant environment.
Install Vagrant. I've tested on 1.8.4.
Clone this repository.
$ git clone https://github.com/cbiffle/emb.rs.git
$ cd emb.rs
Provision your build environment:
$ vagrant up
This may take a few minutes, since it needs to download toolchains and whatnot.
To enter the environment:
$ vagrant ssh
Now proceed to the section on building and flashing.
This approach has only been tested on Linux.
You need to install the following:
- Rust, including Cargo.
- xargo.
- A toolchain for
arm-none-eabi
(such as the one packaged for Ubuntu).
Clone this repository:
$ git clone https://github.com/cbiffle/emb.rs.git
$ cd emb.rs
Building this project requires the nightly
toolchain, so (in the clone) run
$ rustup override add nightly
Note that Xargo requires the rust-src
component. If you have not needed it so
far, you may need to add it to your environment using rustup
:
$ rustup component add rust-src
Note: if you're using Vagrant, remember to build and flash from within your Vagrant environment.
To build:
$ xargo build --release
The ARM binary will be deposited in target/thumbv7em-none-eabihf/release/emb1
.
To flash, attach an STM32F4DISCOVERY board via USB, and run:
$ ./flash.sh
This script will use OpenOCD to flash the binary.