Rust-on-AVR development came to a juddering halt on 7th January 2021, when a bug was introduced in LLVM that all but makes AVR development impossible.
A patch for this was submitting for LLVM by dylanmckay, but for whatever reason it’s been sitting in limbo ever since. And ever since then, Rust developers for AVR have been stuck using an increasingly out of date LLVM, with an increasingly out of date Rust toolchain as well.
The easiest solution to let you move on and at least use the latest Rust nightly toolchain is to build the toolchain yourself, manually applying the necessary patch to get us past this roadblock.
To make this a little simpler, I’ve developed a small script that will automate the process for you. This allows you to get on with your life developing Rust-on-AVR code using a current toolchain.
What this does not do⌗
This will not magically give you a useful Rust-on-AVR toolchain. Rust/LLVM for AVR is a hot mess of code generation bugs. With the latest nightly toolchain, at least you’ll be dealing with exciting new LLVM bugs and not boring old ones, though.
Where to find it⌗
So, with those caveats, you can find the script on Github, right here:
build.sh script will download the current nightly sources, patch them,
and then compile. It will then install this as a new toolchain using the
rustup toolchain link command. You can then use this toolchain in your
rust-toolchain.toml file to build for AVR with a current, if buggy, toolchain.
By default, the new toolchain will be named
snowgoons. You can give an
alternative name as a parameter to the script.
By default, if the script finds the sources are already there, it will do a
git pull to update them before building. If you wish to suppress this,
you can pass a
--noupdate flag to the script.