diff options
| author | Dario Nieuwenhuis <[email protected]> | 2021-11-07 23:52:11 +0100 |
|---|---|---|
| committer | Dario Nieuwenhuis <[email protected]> | 2021-11-07 23:52:11 +0100 |
| commit | 2221e1fa935fef1fbc8a39a478824f0b163e6399 (patch) | |
| tree | e411210300b63cf3bec2e32e2fb0f2d270129d84 /examples/rp | |
| parent | 90095adedf370ddcda6d364dbb5e7f3a0a9b5895 (diff) | |
Replace rustflags with build.rs extra-link-args.
Rustflags apply to ALL the crates in the graph, while we only need
them for the toplevel crate which is the only one getting linked.
Rustflags are not equal for all crates, this caused cargo to re-build the
same dependency crate multiple times uselessly. After this change, deps
are reused more, making builds faster.
Note that this only applies when sharing the target/ dir for multiple crates
in the repo which is not the default.
Diffstat (limited to 'examples/rp')
| -rw-r--r-- | examples/rp/.cargo/config.toml | 11 | ||||
| -rw-r--r-- | examples/rp/build.rs | 5 |
2 files changed, 5 insertions, 11 deletions
diff --git a/examples/rp/.cargo/config.toml b/examples/rp/.cargo/config.toml index 9b852b8e9..1ce57510b 100644 --- a/examples/rp/.cargo/config.toml +++ b/examples/rp/.cargo/config.toml | |||
| @@ -1,16 +1,5 @@ | |||
| 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] | 1 | [target.'cfg(all(target_arch = "arm", target_os = "none"))'] |
| 2 | runner = "probe-run-rp --chip RP2040" | 2 | runner = "probe-run-rp --chip RP2040" |
| 3 | 3 | ||
| 4 | rustflags = [ | ||
| 5 | # LLD (shipped with the Rust toolchain) is used as the default linker | ||
| 6 | "-C", "link-arg=--nmagic", | ||
| 7 | "-C", "link-arg=-Tlink.x", | ||
| 8 | "-C", "link-arg=-Tlink-rp.x", | ||
| 9 | "-C", "link-arg=-Tdefmt.x", | ||
| 10 | |||
| 11 | # Code-size optimizations. | ||
| 12 | "-Z", "trap-unreachable=no", | ||
| 13 | ] | ||
| 14 | |||
| 15 | [build] | 4 | [build] |
| 16 | target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ | 5 | target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ |
diff --git a/examples/rp/build.rs b/examples/rp/build.rs index d534cc3df..3f915f931 100644 --- a/examples/rp/build.rs +++ b/examples/rp/build.rs | |||
| @@ -28,4 +28,9 @@ fn main() { | |||
| 28 | // here, we ensure the build script is only re-run when | 28 | // here, we ensure the build script is only re-run when |
| 29 | // `memory.x` is changed. | 29 | // `memory.x` is changed. |
| 30 | println!("cargo:rerun-if-changed=memory.x"); | 30 | println!("cargo:rerun-if-changed=memory.x"); |
| 31 | |||
| 32 | println!("cargo:rustc-link-arg-bins=--nmagic"); | ||
| 33 | println!("cargo:rustc-link-arg-bins=-Tlink.x"); | ||
| 34 | println!("cargo:rustc-link-arg-bins=-Tlink-rp.x"); | ||
| 35 | println!("cargo:rustc-link-arg-bins=-Tdefmt.x"); | ||
| 31 | } | 36 | } |
