Skip to content

Commit a2ee483

Browse files
committed
bsp(atsame54_xpro): Add defmt feature
1 parent c08f65a commit a2ee483

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

boards/atsame54_xpro/.cargo/config.toml

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

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

boards/atsame54_xpro/Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ rtt-target = {version = "0.3", features = ["cortex-m"]}
3838

3939
[features]
4040
default = ["rt", "atsamd-hal/same54p"]
41+
# Use DEFMT_LOG environment variable to set logging level, defaults to `error`
42+
defmt = ["atsamd-hal/defmt"]
4143
dma = ["atsamd-hal/dma"]
4244
max-channels = ["dma", "atsamd-hal/max-channels"]
4345
# Enable async support from atsamd-hal

boards/atsame54_xpro/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)