Skip to content

Hello World Rust firmware for digispark attiny85 microcontroller

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

kpcyrd/attiny85-hello-world

Repository files navigation

attiny85-hello-world

To setup your build environment, make sure the following packages are installed (names may vary across Linux distributions):

pacman -S avr-gcc avr-libc elf2nucleus git

If you already have rustup setup, also run the following:

rustup component add rust-src

If you want to avoid rustup you can also instead use:

pacman -S rust rust-src

You can then download, build and flash over usb with micronucleus and elf2nucleus:

git clone https://github.com/kpcyrd/attiny85-hello-world
cd attiny85-hello-world
RUSTC_BOOTSTRAP=1 cargo run --release

RUSTC_BOOTSTRAP=1 is necessary because this target has not been fully stabilized yet and is still subject to change, you may need to make changes to stay compatible with future Rust compilers.

Building firmware into elf file

RUSTC_BOOTSTRAP=1 cargo build --release

the built firmware is located at target/avr-attiny85/release/attiny85-hello-world.elf. You can then flash it using elf2nucleus:

elf2nucleus target/avr-attiny85/release/attiny85-hello-world.elf

To extract the raw binary (for example for flashing with micronucleus directly), use:

elf2nucleus target/avr-attiny85/release/attiny85-hello-world.elf ./firmware.bin

Building firmware into ihex file

RUSTC_BOOTSTRAP=1 cargo build --release
avr-objcopy --output-target=ihex target/avr-attiny85/release/attiny85-hello-world.elf target/avr-attiny85/release/attiny85-hello-world.hex

the built firmware is located at target/avr-attiny85/release/attiny85-hello-world.hex. You can then flash it using micronucleus:

micronucleus --timeout 60 --run --no-ansi target/avr-attiny85/release/attiny85-hello-world.hex

About

Hello World Rust firmware for digispark attiny85 microcontroller

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published