aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32wl55
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2021-11-07 23:52:11 +0100
committerDario Nieuwenhuis <[email protected]>2021-11-07 23:52:11 +0100
commit2221e1fa935fef1fbc8a39a478824f0b163e6399 (patch)
treee411210300b63cf3bec2e32e2fb0f2d270129d84 /examples/stm32wl55
parent90095adedf370ddcda6d364dbb5e7f3a0a9b5895 (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/stm32wl55')
-rw-r--r--examples/stm32wl55/.cargo/config.toml15
-rw-r--r--examples/stm32wl55/build.rs5
-rw-r--r--examples/stm32wl55/memory.x5
3 files changed, 5 insertions, 20 deletions
diff --git a/examples/stm32wl55/.cargo/config.toml b/examples/stm32wl55/.cargo/config.toml
index 255f399fb..60076e06b 100644
--- a/examples/stm32wl55/.cargo/config.toml
+++ b/examples/stm32wl55/.cargo/config.toml
@@ -1,21 +1,6 @@
1[unstable]
2build-std = ["core"]
3
4[target.'cfg(all(target_arch = "arm", target_os = "none"))'] 1[target.'cfg(all(target_arch = "arm", target_os = "none"))']
5# replace your chip as listed in `probe-run --list-chips` 2# replace your chip as listed in `probe-run --list-chips`
6runner = "probe-run --chip STM32WLE5JCIx" 3runner = "probe-run --chip STM32WLE5JCIx"
7 4
8rustflags = [
9 # LLD (shipped with the Rust toolchain) is used as the default linker
10 "-C", "link-arg=--nmagic",
11 "-C", "link-arg=-Tlink.x",
12 "-C", "link-arg=-Tdefmt.x",
13
14 # Code-size optimizations.
15 "-Z", "trap-unreachable=no",
16 "-C", "inline-threshold=5",
17 "-C", "no-vectorize-loops",
18]
19
20[build] 5[build]
21target = "thumbv7em-none-eabihf" 6target = "thumbv7em-none-eabihf"
diff --git a/examples/stm32wl55/build.rs b/examples/stm32wl55/build.rs
new file mode 100644
index 000000000..8cd32d7ed
--- /dev/null
+++ b/examples/stm32wl55/build.rs
@@ -0,0 +1,5 @@
1fn main() {
2 println!("cargo:rustc-link-arg-bins=--nmagic");
3 println!("cargo:rustc-link-arg-bins=-Tlink.x");
4 println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
5}
diff --git a/examples/stm32wl55/memory.x b/examples/stm32wl55/memory.x
deleted file mode 100644
index e8b2737fe..000000000
--- a/examples/stm32wl55/memory.x
+++ /dev/null
@@ -1,5 +0,0 @@
1MEMORY
2{
3 FLASH : ORIGIN = 0x08000000, LENGTH = 256K
4 RAM : ORIGIN = 0x20000000, LENGTH = 64K
5}