Infrastructure for programming an Arduino Due in the Rust programming language. This includes a sample sketch that can be modified to do most any other sketch.
Install the prerequisites:
- Download an Arduino Due installation
brew install rust
brew install llvm --all-targets
Then modify Rakefile
:
ARDUINO
points to the directory in the Arduino Due installation that has tools to flash the device. Should containarm-none-eabi-ar
andarm-none-eabi-objcopy
among other executables.RUSTC
points to therustc
executable (the Rust compiler).LLC
points to the LLVM compiler executable calledllc
.PORT
is the name of the USB connection. Do anls /dev/tty*
to get a list of options. Most likely something liketty.usbmodem141
.RUST_SRC
is the name of the *.rs file that contains themain
function for your sketch.
Then run rake burn
to upload to the Arduino.
Here is a circuit diagram of the Arduino sketch:
core.rs - sample program (blinks 4 LEDs in series like Christmas lights with a potentiometer to control the speed).
Feel free to change the program & circuit as you wish.
arduino.rs - extern stubs for the core Arduino libraries
hardware/ - from a random Arduino IDE for OS X
- armboot: https://github.com/neykov/armboot
- zero.rs: https://github.com/pcwalton/zero.rs