Skip to content

Commit 8f47513

Browse files
committed
bsp(pygamer): Add defmt feature
1 parent abed929 commit 8f47513

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

boards/pygamer/.cargo/config.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,14 @@ runner = "hf2 elf"
66
[build]
77
target = "thumbv7em-none-eabihf"
88
rustflags = [
9-
109
# This is needed if your flash or ram addresses are not aligned to 0x10000 in memory.x
1110
# See https://github.com/rust-embedded/cortex-m-quickstart/pull/95
1211
"-C", "link-arg=--nmagic",
1312

13+
# To use defmt, the linker needs to be provided with this argument. The BSP
14+
# uses build.rs to supply it conditionally, uncomment this line to use it
15+
# unconditionally.
16+
# "-C", "link-arg=-Tdefmt.x",
17+
1418
"-C", "link-arg=-Tlink.x",
1519
]

boards/pygamer/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ usbd-serial = "0.2"
5252
[features]
5353
# ask the HAL to enable atsamd51j support
5454
default = ["rt", "atsamd-hal/samd51j"]
55+
# Use DEFMT_LOG environment variable to set logging level, defaults to `error`
56+
defmt = ["atsamd-hal/defmt"]
5557
dma = ["atsamd-hal/dma"]
5658
max-channels = ["dma", "atsamd-hal/max-channels"]
5759
neopixel-spi = ["dep:ws2812-spi"]

boards/pygamer/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,8 @@ fn main() {
1212
println!("cargo:rustc-link-search={}", out.display());
1313
println!("cargo:rerun-if-changed=memory.x");
1414
}
15+
if env::var_os("CARGO_FEATURE_DEFMT").is_some() {
16+
println!("cargo:rustc-link-arg=-Tdefmt.x");
17+
}
1518
println!("cargo:rerun-if-changed=build.rs");
1619
}

0 commit comments

Comments
 (0)