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 gitIf you already have rustup setup, also run the following:
rustup component add rust-srcIf you want to avoid rustup you can also instead use:
pacman -S rust rust-srcYou 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 --releaseRUSTC_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.
RUSTC_BOOTSTRAP=1 cargo build --releasethe 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.elfTo extract the raw binary (for example for flashing with micronucleus directly), use:
elf2nucleus target/avr-attiny85/release/attiny85-hello-world.elf ./firmware.binRUSTC_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.hexthe 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