Fix building of examples which do not use defmt

Uses build.rs in board directories to set the linker options locally.
The file .cargo/config can't be used for that, as in a workspace the
local .cargo/config is ignored if the build is triggered from the
workspace root.
This commit is contained in:
Jan Niehusmann 2022-07-31 15:23:36 +00:00
parent 46110c0d32
commit 365ac70ae4
4 changed files with 18 additions and 1 deletions

View file

@ -31,7 +31,6 @@ rustflags = [
"-C", "link-arg=-Tlink.x", "-C", "link-arg=-Tlink.x",
"-C", "inline-threshold=5", "-C", "inline-threshold=5",
"-C", "no-vectorize-loops", "-C", "no-vectorize-loops",
"-C", "link-arg=-Tdefmt.x",
] ]
# This runner will make a UF2 file and then copy it to a mounted RP2040 in USB # This runner will make a UF2 file and then copy it to a mounted RP2040 in USB

View file

@ -0,0 +1,6 @@
//! This build script makes sure the linker flag -Tdefmt.x is added
//! for the examples.
fn main() {
println!("cargo:rustc-link-arg-examples=-Tdefmt.x");
}

View file

@ -0,0 +1,6 @@
//! This build script makes sure the linker flag -Tdefmt.x is added
//! for the examples.
fn main() {
println!("cargo:rustc-link-arg-examples=-Tdefmt.x");
}

6
boards/rp-pico/build.rs Normal file
View file

@ -0,0 +1,6 @@
//! This build script makes sure the linker flag -Tdefmt.x is added
//! for the examples.
fn main() {
println!("cargo:rustc-link-arg-examples=-Tdefmt.x");
}