Skip to content

Simplify instructions using current Cargo features and reduce size of compiled result #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ edition = '2018'
ruduino = { git = "https://github.com/avr-rust/ruduino", branch = "master" }

[profile.release]
opt-level = 'z'
lto = true
strip = true
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Designed for the ATmega328p.

* A recent version of the nightly Rust compiler. Anything including or
greater than `rustc 1.63.0-nightly (fee3a459d 2022-06-05)` can be used.
* A recent version of Cargo. At least 1.52.0 or greater.
* The rust-src rustup component - `$ rustup component add rust-src`
* AVR-GCC on the system for linking
* AVR-Libc on the system for support libraries
Expand All @@ -22,18 +23,11 @@ Designed for the ATmega328p.
Now to build, run:

```bash
rustup override set nightly

# Ensure time delays are consistent with a 16MHz microcontroller.
export AVR_CPU_FREQUENCY_HZ=16000000

# Compile the crate to an ELF executable.
cargo build -Z build-std=core --target avr-atmega328p.json --release

# Note: there is work in progress to make that easier
# peeking in .cargo/config.tom will show that
# cargo build --release
# is the short version
cargo build --release
```
There should now be an ELF file at `target/avr-atmega328p/release/blink.elf`. It
can be flashed directly to an AVR microcontroller or ran inside a simulator.
Expand Down
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "nightly"