Need help with blink?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

avr-rust
159 Stars 18 Forks MIT License 50 Commits 7 Opened issues

Description

A blinking LED program written in Rust for the AVR

Services available

!
?

Need anything else?

Contributors list

blink

A small Hello World Rust application for the AVR.

The program itself toggles a LED on PORTB periodically.

Designed for the ATmega328p.

The AVR-Rust Book

Prerequisites

  • A recent version of the nightly Rust compiler. Anything including or greater than
    rustc 1.47.0-nightly (0820e54a8 2020-07-23)
    can be used.
  • The rust-src rustup component -
    $ rustup component add rust-src
  • AVR-GCC on the system for linking
  • AVR-Libc on the system for support libraries

Usage

Now to build, run:

rustup override set nightly

Ensure 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.

Resources

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.