A blinking LED program written in Rust for the AVR
A small Hello World Rust application for the AVR.
The program itself toggles a LED on PORTB periodically.
Designed for the ATmega328p.
rustc 1.47.0-nightly (0820e54a8 2020-07-23)can be used.
$ rustup component add rust-src
Now to build, run:
rustup override set nightlyEnsure time delays are consistent with a 16MHz microcontroller.
export AVR_CPU_FREQUENCY_HZ=16000000
Compile the crate to an ELF executable.
cargo build -Z build-std=core --target avr-atmega328p.json --release
There should now be an ELF file at
target/avr-atmega328p/release/blink.elf. It can be flashed directly to an AVR microcontroller or ran inside a simulator.