aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--examples/nrf/.cargo/config.toml12
-rw-r--r--examples/nrf/build.rs4
-rw-r--r--examples/rp/.cargo/config.toml11
-rw-r--r--examples/rp/build.rs5
-rw-r--r--examples/std/Cargo.toml2
-rw-r--r--examples/stm32f0/.cargo/config.toml5
-rw-r--r--examples/stm32f0/Cargo.toml2
-rw-r--r--examples/stm32f0/build.rs32
-rw-r--r--examples/stm32f0/memory.x6
-rw-r--r--examples/stm32f1/.cargo/config.toml12
-rw-r--r--examples/stm32f1/build.rs5
-rw-r--r--examples/stm32f4/.cargo/config.toml12
-rw-r--r--examples/stm32f4/build.rs5
-rw-r--r--examples/stm32f7/.cargo/config.toml12
-rw-r--r--examples/stm32f7/build.rs4
-rw-r--r--examples/stm32g0/.cargo/config.toml12
-rw-r--r--examples/stm32g0/build.rs4
-rw-r--r--examples/stm32h7/.cargo/config5
-rw-r--r--examples/stm32h7/build.rs5
-rw-r--r--examples/stm32l0/.cargo/config.toml12
-rw-r--r--examples/stm32l0/build.rs4
-rw-r--r--examples/stm32l1/.cargo/config.toml12
-rw-r--r--examples/stm32l1/build.rs4
-rw-r--r--examples/stm32l4/.cargo/config.toml12
-rw-r--r--examples/stm32l4/build.rs4
-rw-r--r--examples/stm32u5/.cargo/config.toml12
-rw-r--r--examples/stm32u5/build.rs5
-rw-r--r--examples/stm32wb55/.cargo/config.toml12
-rw-r--r--examples/stm32wb55/build.rs4
-rw-r--r--examples/stm32wl55/.cargo/config.toml15
-rw-r--r--examples/stm32wl55/build.rs5
-rw-r--r--examples/stm32wl55/memory.x5
32 files changed, 63 insertions, 198 deletions
diff --git a/examples/nrf/.cargo/config.toml b/examples/nrf/.cargo/config.toml
index 0151d1ed5..c75b5c539 100644
--- a/examples/nrf/.cargo/config.toml
+++ b/examples/nrf/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace nRF82840_xxAA with your chip as listed in `probe-run --list-chips` 2# replace nRF82840_xxAA with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip nRF52840_xxAA" 3runner = "probe-run --chip nRF52840_xxAA"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7em-none-eabi" 6target = "thumbv7em-none-eabi"
diff --git a/examples/nrf/build.rs b/examples/nrf/build.rs
index d534cc3df..30691aa97 100644
--- a/examples/nrf/build.rs
+++ b/examples/nrf/build.rs
@@ -28,4 +28,8 @@ 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=-Tdefmt.x");
31} 35}
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"))']
2runner = "probe-run-rp --chip RP2040" 2runner = "probe-run-rp --chip RP2040"
3 3
4rustflags = [
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]
16target = "thumbv6m-none-eabi" # Cortex-M0 and Cortex-M0+ 5target = "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}
diff --git a/examples/std/Cargo.toml b/examples/std/Cargo.toml
index b494cd3be..002d0487a 100644
--- a/examples/std/Cargo.toml
+++ b/examples/std/Cargo.toml
@@ -11,7 +11,7 @@ smoltcp = { git = "https://github.com/smoltcp-rs/smoltcp", rev="e4241510337e095b
11 11
12async-io = "1.6.0" 12async-io = "1.6.0"
13env_logger = "0.9.0" 13env_logger = "0.9.0"
14futures = { version = "0.3.17", default-features = false, features = ["async-await"] } 14futures = { version = "0.3.17" }
15log = "0.4.14" 15log = "0.4.14"
16nix = "0.22.1" 16nix = "0.22.1"
17libc = "0.2.101" 17libc = "0.2.101"
diff --git a/examples/stm32f0/.cargo/config.toml b/examples/stm32f0/.cargo/config.toml
index 7506fa91b..4d34270cd 100644
--- a/examples/stm32f0/.cargo/config.toml
+++ b/examples/stm32f0/.cargo/config.toml
@@ -1,10 +1,5 @@
1[target.thumbv6m-none-eabi] 1[target.thumbv6m-none-eabi]
2runner = 'probe-run --chip STM32F030F4Px' 2runner = 'probe-run --chip STM32F030F4Px'
3rustflags = [
4 # LLD (shipped with the Rust toolchain) is used as the default linker
5 "-C", "link-arg=-Tlink.x",
6 "-C", "link-arg=-Tdefmt.x",
7]
8 3
9[build] 4[build]
10target = "thumbv6m-none-eabi" 5target = "thumbv6m-none-eabi"
diff --git a/examples/stm32f0/Cargo.toml b/examples/stm32f0/Cargo.toml
index 2db98488d..e586748ab 100644
--- a/examples/stm32f0/Cargo.toml
+++ b/examples/stm32f0/Cargo.toml
@@ -15,7 +15,7 @@ defmt-rtt = "0.2.0"
15panic-probe = "0.2.0" 15panic-probe = "0.2.0"
16rtt-target = { version = "0.3.1", features = ["cortex-m"] } 16rtt-target = { version = "0.3.1", features = ["cortex-m"] }
17embassy = { path = "../../embassy", features = ["defmt"] } 17embassy = { path = "../../embassy", features = ["defmt"] }
18embassy-stm32 = { path = "../../embassy-stm32", features = ["defmt", "stm32f030f4", "time-driver-tim3"] } 18embassy-stm32 = { path = "../../embassy-stm32", features = ["defmt", "memory-x", "stm32f030f4", "time-driver-tim3"] }
19 19
20[features] 20[features]
21default = [ 21default = [
diff --git a/examples/stm32f0/build.rs b/examples/stm32f0/build.rs
index d534cc3df..8cd32d7ed 100644
--- a/examples/stm32f0/build.rs
+++ b/examples/stm32f0/build.rs
@@ -1,31 +1,5 @@
1//! This build script copies the `memory.x` file from the crate root into
2//! a directory where the linker can always find it at build time.
3//! For many projects this is optional, as the linker always searches the
4//! project root directory -- wherever `Cargo.toml` is. However, if you
5//! are using a workspace or have a more complicated build setup, this
6//! build script becomes required. Additionally, by requesting that
7//! Cargo re-run the build script whenever `memory.x` is changed,
8//! updating `memory.x` ensures a rebuild of the application with the
9//! new memory settings.
10
11use std::env;
12use std::fs::File;
13use std::io::Write;
14use std::path::PathBuf;
15
16fn main() { 1fn main() {
17 // Put `memory.x` in our output directory and ensure it's 2 println!("cargo:rustc-link-arg-bins=--nmagic");
18 // on the linker search path. 3 println!("cargo:rustc-link-arg-bins=-Tlink.x");
19 let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); 4 println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
20 File::create(out.join("memory.x"))
21 .unwrap()
22 .write_all(include_bytes!("memory.x"))
23 .unwrap();
24 println!("cargo:rustc-link-search={}", out.display());
25
26 // By default, Cargo will re-run a build script whenever
27 // any file in the project changes. By specifying `memory.x`
28 // here, we ensure the build script is only re-run when
29 // `memory.x` is changed.
30 println!("cargo:rerun-if-changed=memory.x");
31} 5}
diff --git a/examples/stm32f0/memory.x b/examples/stm32f0/memory.x
deleted file mode 100644
index 3bddaed41..000000000
--- a/examples/stm32f0/memory.x
+++ /dev/null
@@ -1,6 +0,0 @@
1MEMORY
2{
3 FLASH : ORIGIN = 0x08000000, LENGTH = 16K
4 /* DTCM */
5 RAM : ORIGIN = 0x20000000, LENGTH = 4K
6}
diff --git a/examples/stm32f1/.cargo/config.toml b/examples/stm32f1/.cargo/config.toml
index 28df61383..9a7ac7b91 100644
--- a/examples/stm32f1/.cargo/config.toml
+++ b/examples/stm32f1/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace STM32F103C8 with your chip as listed in `probe-run --list-chips` 2# replace STM32F103C8 with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32F103C8" 3runner = "probe-run --chip STM32F103C8"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7m-none-eabi" 6target = "thumbv7m-none-eabi"
diff --git a/examples/stm32f1/build.rs b/examples/stm32f1/build.rs
new file mode 100644
index 000000000..8cd32d7ed
--- /dev/null
+++ b/examples/stm32f1/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/stm32f4/.cargo/config.toml b/examples/stm32f4/.cargo/config.toml
index 7563d2616..9e0a15214 100644
--- a/examples/stm32f4/.cargo/config.toml
+++ b/examples/stm32f4/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips` 2# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32F429ZITx" 3runner = "probe-run --chip STM32F429ZITx"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7em-none-eabi" 6target = "thumbv7em-none-eabi"
diff --git a/examples/stm32f4/build.rs b/examples/stm32f4/build.rs
new file mode 100644
index 000000000..8cd32d7ed
--- /dev/null
+++ b/examples/stm32f4/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/stm32f7/.cargo/config.toml b/examples/stm32f7/.cargo/config.toml
index 632e81541..f490ed8e4 100644
--- a/examples/stm32f7/.cargo/config.toml
+++ b/examples/stm32f7/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips` 2# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32F767ZITx" 3runner = "probe-run --chip STM32F767ZITx"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7em-none-eabihf" 6target = "thumbv7em-none-eabihf"
diff --git a/examples/stm32f7/build.rs b/examples/stm32f7/build.rs
index b81f6b6e1..b72dd55ec 100644
--- a/examples/stm32f7/build.rs
+++ b/examples/stm32f7/build.rs
@@ -35,5 +35,9 @@ fn main() -> Result<(), Error> {
35 // Tell Cargo where to find the file. 35 // Tell Cargo where to find the file.
36 println!("cargo:rustc-link-search={}", out_dir.display()); 36 println!("cargo:rustc-link-search={}", out_dir.display());
37 37
38 println!("cargo:rustc-link-arg-bins=--nmagic");
39 println!("cargo:rustc-link-arg-bins=-Tlink.x");
40 println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
41
38 Ok(()) 42 Ok(())
39} 43}
diff --git a/examples/stm32g0/.cargo/config.toml b/examples/stm32g0/.cargo/config.toml
index 1f7c3ecdd..3ebfbcb5c 100644
--- a/examples/stm32g0/.cargo/config.toml
+++ b/examples/stm32g0/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace STM32G071C8Rx with your chip as listed in `probe-run --list-chips` 2# replace STM32G071C8Rx with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32G071RBTx" 3runner = "probe-run --chip STM32G071RBTx"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv6m-none-eabi" 6target = "thumbv6m-none-eabi"
diff --git a/examples/stm32g0/build.rs b/examples/stm32g0/build.rs
index d534cc3df..30691aa97 100644
--- a/examples/stm32g0/build.rs
+++ b/examples/stm32g0/build.rs
@@ -28,4 +28,8 @@ 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=-Tdefmt.x");
31} 35}
diff --git a/examples/stm32h7/.cargo/config b/examples/stm32h7/.cargo/config
index 6b6a9f506..4106112cd 100644
--- a/examples/stm32h7/.cargo/config
+++ b/examples/stm32h7/.cargo/config
@@ -1,10 +1,5 @@
1[target.thumbv7em-none-eabihf] 1[target.thumbv7em-none-eabihf]
2runner = 'probe-run --chip STM32H743ZITx' 2runner = 'probe-run --chip STM32H743ZITx'
3rustflags = [
4 # LLD (shipped with the Rust toolchain) is used as the default linker
5 "-C", "link-arg=-Tlink.x",
6 "-C", "link-arg=-Tdefmt.x",
7]
8 3
9[build] 4[build]
10target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU) 5target = "thumbv7em-none-eabihf" # Cortex-M4F and Cortex-M7F (with FPU)
diff --git a/examples/stm32h7/build.rs b/examples/stm32h7/build.rs
new file mode 100644
index 000000000..8cd32d7ed
--- /dev/null
+++ b/examples/stm32h7/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/stm32l0/.cargo/config.toml b/examples/stm32l0/.cargo/config.toml
index 084722ca1..4ea047484 100644
--- a/examples/stm32l0/.cargo/config.toml
+++ b/examples/stm32l0/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace your chip as listed in `probe-run --list-chips` 2# replace your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32L072CZ" 3runner = "probe-run --chip STM32L072CZ"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv6m-none-eabi" 6target = "thumbv6m-none-eabi"
diff --git a/examples/stm32l0/build.rs b/examples/stm32l0/build.rs
index d534cc3df..30691aa97 100644
--- a/examples/stm32l0/build.rs
+++ b/examples/stm32l0/build.rs
@@ -28,4 +28,8 @@ 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=-Tdefmt.x");
31} 35}
diff --git a/examples/stm32l1/.cargo/config.toml b/examples/stm32l1/.cargo/config.toml
index e0d2bddf0..04985720b 100644
--- a/examples/stm32l1/.cargo/config.toml
+++ b/examples/stm32l1/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace your chip as listed in `probe-run --list-chips` 2# replace your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32L151CBxxA" 3runner = "probe-run --chip STM32L151CBxxA"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7m-none-eabi" 6target = "thumbv7m-none-eabi"
diff --git a/examples/stm32l1/build.rs b/examples/stm32l1/build.rs
index d534cc3df..30691aa97 100644
--- a/examples/stm32l1/build.rs
+++ b/examples/stm32l1/build.rs
@@ -28,4 +28,8 @@ 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=-Tdefmt.x");
31} 35}
diff --git a/examples/stm32l4/.cargo/config.toml b/examples/stm32l4/.cargo/config.toml
index d32ca4ae9..12e77db50 100644
--- a/examples/stm32l4/.cargo/config.toml
+++ b/examples/stm32l4/.cargo/config.toml
@@ -4,17 +4,5 @@
4#runner = "probe-run --chip STM32L475VG" 4#runner = "probe-run --chip STM32L475VG"
5runner = "probe-run --chip STM32L4S5VI" 5runner = "probe-run --chip STM32L4S5VI"
6 6
7rustflags = [
8 # LLD (shipped with the Rust toolchain) is used as the default linker
9 "-C", "link-arg=--nmagic",
10 "-C", "link-arg=-Tlink.x",
11 "-C", "link-arg=-Tdefmt.x",
12
13 # Code-size optimizations.
14 "-Z", "trap-unreachable=no",
15 "-C", "inline-threshold=5",
16 "-C", "no-vectorize-loops",
17]
18
19[build] 7[build]
20target = "thumbv7em-none-eabi" 8target = "thumbv7em-none-eabi"
diff --git a/examples/stm32l4/build.rs b/examples/stm32l4/build.rs
index d534cc3df..30691aa97 100644
--- a/examples/stm32l4/build.rs
+++ b/examples/stm32l4/build.rs
@@ -28,4 +28,8 @@ 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=-Tdefmt.x");
31} 35}
diff --git a/examples/stm32u5/.cargo/config.toml b/examples/stm32u5/.cargo/config.toml
index 7f4887008..ba3ef1dc5 100644
--- a/examples/stm32u5/.cargo/config.toml
+++ b/examples/stm32u5/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips` 2# replace STM32F429ZITx with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32U585AIIx" 3runner = "probe-run --chip STM32U585AIIx"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7em-none-eabi" 6target = "thumbv7em-none-eabi"
diff --git a/examples/stm32u5/build.rs b/examples/stm32u5/build.rs
new file mode 100644
index 000000000..8cd32d7ed
--- /dev/null
+++ b/examples/stm32u5/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/stm32wb55/.cargo/config.toml b/examples/stm32wb55/.cargo/config.toml
index b535b66d6..509517a2d 100644
--- a/examples/stm32wb55/.cargo/config.toml
+++ b/examples/stm32wb55/.cargo/config.toml
@@ -2,17 +2,5 @@
2# replace STM32WB55CCUx with your chip as listed in `probe-run --list-chips` 2# replace STM32WB55CCUx with your chip as listed in `probe-run --list-chips`
3runner = "probe-run --chip STM32WB55CCUx --speed 1000 --connect-under-reset" 3runner = "probe-run --chip STM32WB55CCUx --speed 1000 --connect-under-reset"
4 4
5rustflags = [
6 # LLD (shipped with the Rust toolchain) is used as the default linker
7 "-C", "link-arg=--nmagic",
8 "-C", "link-arg=-Tlink.x",
9 "-C", "link-arg=-Tdefmt.x",
10
11 # Code-size optimizations.
12 "-Z", "trap-unreachable=no",
13 "-C", "inline-threshold=5",
14 "-C", "no-vectorize-loops",
15]
16
17[build] 5[build]
18target = "thumbv7em-none-eabihf" 6target = "thumbv7em-none-eabihf"
diff --git a/examples/stm32wb55/build.rs b/examples/stm32wb55/build.rs
index d534cc3df..30691aa97 100644
--- a/examples/stm32wb55/build.rs
+++ b/examples/stm32wb55/build.rs
@@ -28,4 +28,8 @@ 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=-Tdefmt.x");
31} 35}
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}