Move rtos-trace example to a separate project to simplify Cargo.toml
This commit is contained in:
parent
7dfe119fe0
commit
2edf532f8d
9
examples/nrf-rtos-trace/.cargo/config.toml
Normal file
9
examples/nrf-rtos-trace/.cargo/config.toml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[target.'cfg(all(target_arch = "arm", target_os = "none"))']
|
||||||
|
# replace nRF82840_xxAA with your chip as listed in `probe-run --list-chips`
|
||||||
|
runner = "probe-run --chip nRF52840_xxAA"
|
||||||
|
|
||||||
|
[build]
|
||||||
|
target = "thumbv7em-none-eabi"
|
||||||
|
|
||||||
|
[env]
|
||||||
|
DEFMT_LOG = "trace"
|
51
examples/nrf-rtos-trace/Cargo.toml
Normal file
51
examples/nrf-rtos-trace/Cargo.toml
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
[package]
|
||||||
|
edition = "2021"
|
||||||
|
name = "embassy-nrf-examples"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = ["log", "nightly"]
|
||||||
|
nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"]
|
||||||
|
log = [
|
||||||
|
"dep:log",
|
||||||
|
"embassy-util/log",
|
||||||
|
"embassy-executor/log",
|
||||||
|
"embassy-nrf/log",
|
||||||
|
"embassy-net/log",
|
||||||
|
"embassy-usb-ncm/log",
|
||||||
|
# Currently broken:
|
||||||
|
# "embassy-usb/log",
|
||||||
|
# "embassy-usb-serial/log",
|
||||||
|
# "embassy-usb-hid/log",
|
||||||
|
]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
embassy-util = { version = "0.1.0", path = "../../embassy-util" }
|
||||||
|
embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features=["rtos-trace", "rtos-trace-interrupt"] }
|
||||||
|
embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
|
||||||
|
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true }
|
||||||
|
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", optional = true }
|
||||||
|
embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", optional = true }
|
||||||
|
embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", optional = true }
|
||||||
|
embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", optional = true }
|
||||||
|
embedded-io = "0.3.0"
|
||||||
|
|
||||||
|
cortex-m = "0.7.3"
|
||||||
|
cortex-m-rt = "0.7.0"
|
||||||
|
panic-probe = { version = "0.3" }
|
||||||
|
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||||
|
rand = { version = "0.8.4", default-features = false }
|
||||||
|
embedded-storage = "0.3.0"
|
||||||
|
usbd-hid = "0.5.2"
|
||||||
|
serde = { version = "1.0.136", default-features = false }
|
||||||
|
rtos-trace = "0.1.3"
|
||||||
|
systemview-target = { version = "0.1.1", features = ["callbacks-app", "callbacks-os", "log", "cortex-m"] }
|
||||||
|
log = { version = "0.4.17", optional = true }
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "rtos_trace"
|
||||||
|
required-features = ["nightly"]
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
rtos-trace = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" }
|
||||||
|
systemview-target = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" }
|
36
examples/nrf-rtos-trace/build.rs
Normal file
36
examples/nrf-rtos-trace/build.rs
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
//! This build script copies the `memory.x` file from the crate root into
|
||||||
|
//! a directory where the linker can always find it at build time.
|
||||||
|
//! For many projects this is optional, as the linker always searches the
|
||||||
|
//! project root directory -- wherever `Cargo.toml` is. However, if you
|
||||||
|
//! are using a workspace or have a more complicated build setup, this
|
||||||
|
//! build script becomes required. Additionally, by requesting that
|
||||||
|
//! Cargo re-run the build script whenever `memory.x` is changed,
|
||||||
|
//! updating `memory.x` ensures a rebuild of the application with the
|
||||||
|
//! new memory settings.
|
||||||
|
|
||||||
|
use std::env;
|
||||||
|
use std::fs::File;
|
||||||
|
use std::io::Write;
|
||||||
|
use std::path::PathBuf;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
// Put `memory.x` in our output directory and ensure it's
|
||||||
|
// on the linker search path.
|
||||||
|
let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap());
|
||||||
|
File::create(out.join("memory.x"))
|
||||||
|
.unwrap()
|
||||||
|
.write_all(include_bytes!("memory.x"))
|
||||||
|
.unwrap();
|
||||||
|
println!("cargo:rustc-link-search={}", out.display());
|
||||||
|
|
||||||
|
// By default, Cargo will re-run a build script whenever
|
||||||
|
// any file in the project changes. By specifying `memory.x`
|
||||||
|
// here, we ensure the build script is only re-run when
|
||||||
|
// `memory.x` is changed.
|
||||||
|
println!("cargo:rerun-if-changed=memory.x");
|
||||||
|
|
||||||
|
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||||
|
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||||
|
#[cfg(feature = "defmt")]
|
||||||
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
|
}
|
7
examples/nrf-rtos-trace/memory.x
Normal file
7
examples/nrf-rtos-trace/memory.x
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
MEMORY
|
||||||
|
{
|
||||||
|
/* NOTE 1 K = 1 KiBi = 1024 bytes */
|
||||||
|
/* These values correspond to the NRF52840 with Softdevices S140 7.0.1 */
|
||||||
|
FLASH : ORIGIN = 0x00000000, LENGTH = 1024K
|
||||||
|
RAM : ORIGIN = 0x20000000, LENGTH = 256K
|
||||||
|
}
|
@ -4,71 +4,28 @@ name = "embassy-nrf-examples"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["defmt", "nightly"]
|
default = ["nightly"]
|
||||||
nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"]
|
nightly = ["embassy-executor/nightly", "embassy-nrf/nightly", "embassy-nrf/unstable-traits", "embassy-usb", "embassy-usb-serial", "embassy-usb-hid", "embassy-usb-ncm", "embedded-io/async", "embassy-net"]
|
||||||
defmt = [
|
|
||||||
"dep:defmt",
|
|
||||||
"dep:defmt-rtt",
|
|
||||||
"embassy-util/defmt",
|
|
||||||
"embassy-executor/defmt",
|
|
||||||
"embassy-executor/defmt-timestamp-uptime",
|
|
||||||
"embassy-nrf/defmt",
|
|
||||||
"embassy-net/defmt",
|
|
||||||
"embassy-usb/defmt",
|
|
||||||
"embassy-usb-serial/defmt",
|
|
||||||
"embassy-usb-hid/defmt",
|
|
||||||
"embassy-usb-ncm/defmt",
|
|
||||||
"panic-probe/print-defmt",
|
|
||||||
]
|
|
||||||
log = [
|
|
||||||
"dep:log",
|
|
||||||
"embassy-util/log",
|
|
||||||
"embassy-executor/log",
|
|
||||||
"embassy-nrf/log",
|
|
||||||
"embassy-net/log",
|
|
||||||
"embassy-usb-ncm/log",
|
|
||||||
# Currently broken:
|
|
||||||
# "embassy-usb/log",
|
|
||||||
# "embassy-usb-serial/log",
|
|
||||||
# "embassy-usb-hid/log",
|
|
||||||
]
|
|
||||||
rtos-trace = [
|
|
||||||
"dep:rtos-trace",
|
|
||||||
"dep:systemview-target",
|
|
||||||
"embassy-executor/rtos-trace",
|
|
||||||
"embassy-executor/rtos-trace-interrupt",
|
|
||||||
]
|
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
embassy-util = { version = "0.1.0", path = "../../embassy-util" }
|
embassy-util = { version = "0.1.0", path = "../../embassy-util", features = ["defmt"] }
|
||||||
embassy-executor = { version = "0.1.0", path = "../../embassy-executor" }
|
embassy-executor = { version = "0.1.0", path = "../../embassy-executor", features = ["defmt", "defmt-timestamp-uptime"] }
|
||||||
embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
|
embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["defmt", "nrf52840", "time-driver-rtc1", "gpiote", "unstable-pac"] }
|
||||||
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true }
|
embassy-net = { version = "0.1.0", path = "../../embassy-net", features = ["defmt", "tcp", "dhcpv4", "medium-ethernet", "pool-16"], optional = true }
|
||||||
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", optional = true }
|
embassy-usb = { version = "0.1.0", path = "../../embassy-usb", features = ["defmt"], optional = true }
|
||||||
embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", optional = true }
|
embassy-usb-serial = { version = "0.1.0", path = "../../embassy-usb-serial", features = ["defmt"], optional = true }
|
||||||
embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", optional = true }
|
embassy-usb-hid = { version = "0.1.0", path = "../../embassy-usb-hid", features = ["defmt"], optional = true }
|
||||||
embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", optional = true }
|
embassy-usb-ncm = { version = "0.1.0", path = "../../embassy-usb-ncm", features = ["defmt"], optional = true }
|
||||||
embedded-io = "0.3.0"
|
embedded-io = "0.3.0"
|
||||||
|
|
||||||
defmt = { version = "0.3", optional = true }
|
defmt = "0.3"
|
||||||
defmt-rtt = { version = "0.3", optional = true }
|
defmt-rtt = "0.3"
|
||||||
|
|
||||||
cortex-m = "0.7.3"
|
cortex-m = "0.7.3"
|
||||||
cortex-m-rt = "0.7.0"
|
cortex-m-rt = "0.7.0"
|
||||||
panic-probe = { version = "0.3" }
|
panic-probe = { version = "0.3", features = ["print-defmt"] }
|
||||||
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
futures = { version = "0.3.17", default-features = false, features = ["async-await"] }
|
||||||
rand = { version = "0.8.4", default-features = false }
|
rand = { version = "0.8.4", default-features = false }
|
||||||
embedded-storage = "0.3.0"
|
embedded-storage = "0.3.0"
|
||||||
usbd-hid = "0.5.2"
|
usbd-hid = "0.5.2"
|
||||||
serde = { version = "1.0.136", default-features = false }
|
serde = { version = "1.0.136", default-features = false }
|
||||||
rtos-trace = { version = "0.1.3", optional = true }
|
|
||||||
systemview-target = { version = "0.1.1", optional = true, features = ["callbacks-app", "callbacks-os", "log", "cortex-m"] }
|
|
||||||
log = { version = "0.4.17", optional = true }
|
|
||||||
|
|
||||||
[[bin]]
|
|
||||||
name = "rtos_trace"
|
|
||||||
required-features = ["nightly", "rtos-trace"]
|
|
||||||
|
|
||||||
[patch.crates-io]
|
|
||||||
rtos-trace = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" }
|
|
||||||
systemview-target = { git = "https://gitlab.com/quentinmit/rtos-trace.git", branch = "build-fix" }
|
|
||||||
|
@ -31,6 +31,5 @@ fn main() {
|
|||||||
|
|
||||||
println!("cargo:rustc-link-arg-bins=--nmagic");
|
println!("cargo:rustc-link-arg-bins=--nmagic");
|
||||||
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
println!("cargo:rustc-link-arg-bins=-Tlink.x");
|
||||||
#[cfg(feature = "defmt")]
|
|
||||||
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
println!("cargo:rustc-link-arg-bins=-Tdefmt.x");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user