dueboot
dueboot copied to clipboard
Rust on the Arduino Due
dueboot
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.
Compiling
Install the prerequisites:
- Download an Arduino Due installation
brew install rustbrew install llvm --all-targets
Then modify Rakefile:
ARDUINOpoints to the directory in the Arduino Due installation that has tools to flash the device. Should containarm-none-eabi-arandarm-none-eabi-objcopyamong other executables.RUSTCpoints to therustcexecutable (the Rust compiler).LLCpoints to the LLVM compiler executable calledllc.PORTis the name of the USB connection. Do anls /dev/tty*to get a list of options. Most likely something liketty.usbmodem141.RUST_SRCis the name of the *.rs file that contains themainfunction for your sketch.
Then run rake burn to upload to the Arduino.
Here is a circuit diagram of the Arduino sketch:

Structure
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
Credits
- armboot: https://github.com/neykov/armboot
- zero.rs: https://github.com/pcwalton/zero.rs