rustc + avr = lovelove back again!

154 points Patryk27

I'm glad to inform y'all that after a year, the infamous LLVM ERROR: Not supported instr bug¹ has been finally fixed and today's nightly can compile for AVR back again! 😎

rustup install nightly
cargo +nightly build --release

Today's release not only solves this particular issue, but - thanks to LLVM's upgrade done in the meantime - brings a lot of improvements to AVR code generation, so if you had a code that was getting miscompiled a year ago, it's certainly worth a try now!

Note that there's one major papercut left to solve (https://github.com/rust-lang/rust/issues/82242), but fortunately there's a simple workaround for the time being (https://github.com/rust-lang/rust/issues/82242#issuecomment-997400373).

Also note that some libraries in the ecosystem might still use a feature called llvm_asm that was removed from rustc in 2021, so those crates might need a while to migrate to the newer asm syntax (this feature is used to provide an inline AVR assembly, e.g. to implement a cycle-accurate delay); so far I've got patches merged to https://github.com/Rahix/avr-hal & https://github.com/Rahix/avr-device :-)

Have fun!