aboutsummaryrefslogtreecommitdiff
path: root/examples/stm32f7
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-11-07 23:06:10 +0000
committerGitHub <[email protected]>2021-11-07 23:06:10 +0000
commitdb889da0446833ff219e652bd68c397af858b999 (patch)
tree75428e4bdd94198994680070e4c3b8062e0f6f3a /examples/stm32f7
parent5322e293bdfca7c02fce76eae7a851ac59f422e0 (diff)
parent2221e1fa935fef1fbc8a39a478824f0b163e6399 (diff)
Merge #473
473: Replace rustflags with build.rs extra-link-args. r=Dirbaio a=Dirbaio 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. Co-authored-by: Dario Nieuwenhuis <[email protected]>
Diffstat (limited to 'examples/stm32f7')
-rw-r--r--examples/stm32f7/.cargo/config.toml12
-rw-r--r--examples/stm32f7/build.rs4
2 files changed, 4 insertions, 12 deletions
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}