A blinking LED program written in Rust for the AVR
Branch: master
Clone or download
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Update blink example for newest avr-rust Nov 2, 2018
.gitignore Initial commit Aug 21, 2017
Cargo.toml Rename to 'blink' Aug 21, 2017
LICENSE Add license Aug 21, 2017
README.md Improves the instructions about setting the XARGO_RUST_SRC environeme… Jan 18, 2019
avr-atmega328p.json Update blink example for newest avr-rust Nov 2, 2018



An small Hello World Rust application for the AVR.

The program itself toggles a LED on PORTB periodically.

Designed for the ATmega328p.

How to set up a cross compiler


There are a few environment variables that need to be set first:

# Needed until https://github.com/japaric/xargo/pull/205 goes through,
# to tell it where to find avr-atmega328p.json:
export RUST_TARGET_PATH=`pwd`

# Likely needed if you've just compiled avr-rust from source:
export XARGO_RUST_SRC=/path_to_avr_rust/src
# (e.g. :if you built from sources and typed `git clone https://github.com/avr-rust/rust.git` in `~/avr-rust`, this would be `~/avr-rust/rust/src)

Now to build, run:

rustup run avr-toolchain xargo build --target avr-atmega328p --release

There should now be an ELF file at target/atmega328p/release/blink.elf.