Skip to content

cbiffle/emb.rs

Repository files navigation

emb.rs, Rust embedded support library

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).

Setting up a build environment

Using Vagrant

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.

Using native Rust and ARM toolchain

This approach has only been tested on Linux.

You need to install the following:

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

Building and Flashing

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.

About

Embedded systems library for Rust

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published