avr-rust/blink

Simplify cargo build invocation

chinoto opened this issue · 3 comments

Right now we essentially have env AVR_CPU_FREQUENCY_HZ=16000000 cargo +nightly build -Z build-std=core --target avr-atmega328p.json --release, which is fairly long.

Maybe it is better that users have to type in the target and build-std flags so they become aware of their necessity, but otherwise they could be omitted with the use of .cargo/config.toml. Perhaps a note about them in the README would be enough?

[build]
target = "avr-atmega328p.json"

[unstable]
build-std = ["core"]

# Cargo versions before 2021-02-23 won't recognize this: https://github.com/rust-lang/cargo/pull/9175
[env]
AVR_CPU_FREQUENCY_HZ = 16000000

At which point the command is simply cargo +nightly build --release (once the LLVM error is resolved and the user has a new enough cargo). We don't even need +nightly if ./rust-toolchain is added.

Looks good to me (and I agree on someone will someday provide a merge request).

I suppose I should have started it out as a pull request instead of an issue.

Now we have #41 and would to know on which platform it works. ( I'm on Debian with rustup updated. )