arduino-due-rust icon indicating copy to clipboard operation
arduino-due-rust copied to clipboard

Arduino Due Rust Example Application

Arduino Due Rust Example

This repository contains a small example application for the Arduino Due written in Rust.

The example makes the on-board LED blink 1 time per second.

The interaction with the board is based on the sam3x8e crate, which unfortunately seems unmaintained and for which an updated version that works with stable Rust is used.

Setup

  1. Install the latest stable Rust toolchain via rustup.
  2. Install the ARMv7-M toolchain via rustup target add thumbv7m-none-eabi.
  3. Install cargo-binutils via cargo install cargo-binutils and rustup component add llvm-tools-preview.
  4. Install BOSSA. Note that all versions newer than 1.7 don't work with the Arduino Due!

That's all!

Building

  1. cargo objcopy --bin app --target thumbv7m-none-eabi --release -- --output-target=binary image.bin to build the application in release mode and generate a binary that can be flashed on the board.
  2. For configuring the serial interface correctly for BOSSA
    1. On Linux stty -F /dev/ttyACM0 raw ispeed 1200 ospeed 1200 cs8 -cstopb ignpar eol 255 eof 255. This assumes /dev/ttyACM0 is the device.
    2. On Windows mode com8:1200,n,8,1. This assumes com8 is the device. Running mode without arguments lists all devices.
  3. bossac -e -w -v -b -R image.bin for flashing the application and rebooting.

At this point the on-board LED should start blinking.

Further Resources