arduino-due-rust
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
- Install the latest stable Rust toolchain via rustup.
- Install the ARMv7-M toolchain via
rustup target add thumbv7m-none-eabi
. - Install
cargo-binutils
viacargo install cargo-binutils
andrustup component add llvm-tools-preview
. - Install BOSSA. Note that all versions newer than 1.7 don't work with the Arduino Due!
That's all!
Building
-
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. - For configuring the serial interface correctly for BOSSA
- 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. - On Windows
mode com8:1200,n,8,1
. This assumes com8 is the device. Runningmode
without arguments lists all devices.
- On Linux
-
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
- Rust Embedded Book
-
cortex-m-rt
- Documentation for
sam3x8e
can be generated by cloning the git repository and runningcargo doc --open
.