Last active
October 31, 2020 16:30
-
-
Save jonahbron/640a825dd9a526d3a1c24f2c20ca44ac to your computer and use it in GitHub Desktop.
Install AVR Rust and Compile Blink
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone [email protected]:avr-rust/rust.git avr-rust | |
cd avr-rust | |
git checkout avr-support # 8405b30 at time of writing | |
cp config.toml.example config.toml | |
# Manually uncomment experimental-targets setting in config.toml | |
./x.py build | |
rustup toolchain link avr $(realpath $(find build -name 'stage2')) | |
cd ../../ | |
wget https://downloads.arduino.cc/arduino-1.8.12-linux64.tar.xz | |
tar -xf arduino-1.8.12-linux64.tar.xz | |
git clone [email protected]:avr-rust/blink.git | |
cd blink | |
# set the linker to the toolchain from Arduino, and explicitly disable -pie | |
# use cargo built from avr-rust. Path will be different depending on system. | |
XARGO_RUST_SRC="$(realpath ../avr-rust/src)" \ | |
RUSTFLAGS="-C linker=$(realpath $(../arduino-1.8.12/hardware/tools/avr/bin/avr-gcc)) -C link-args=-no-pie" \ | |
rustup run avr ../avr-rust/build/x86_64-unknown-linux-gnu/stage0/bin/cargo xbuild --target avr-unknown-unknown --verbose |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I added a script for this in
avr-hal
:mkhex.sh