3.2. A note about the required Rust -Z build-std=<CRATE,>
flag
AVR-Rust is not distributed with a pre-built libcore crate. Instead, it is compiled on-demand when a crate uses it via the Rust -Z build-std
flag.
There are many hundreds of variants of AVR microcontroller, and it is not feasible to distribute runtime libraries for all of them within a regular Rust distribution.
Due to this, any time a crate is built for AVR, -Z build-std=core
should be passed to cargo
.
Example
cargo build -Z build-std=core --target avr-atmega328p.json --release
What happens if you don't pass it
Then you will get a "cannot find crate for 'core'" error when you compile the crate. The only crates that can
avoid this are those that are #[no_core]
crates, such as libcore
itself.