From 2a54a3b93f38569a0a7aa585e75d6939a1726cce Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Mon, 8 Dec 2025 11:27:07 +0100 Subject: chore: update devtool dependency --- .github/ci/build-nightly.sh | 2 +- .github/ci/build-xtensa.sh | 2 +- .github/ci/build.sh | 2 +- .github/ci/doc.sh | 2 +- .github/ci/janitor.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/ci/build-nightly.sh b/.github/ci/build-nightly.sh index 82e9436f3..04fbd2353 100755 --- a/.github/ci/build-nightly.sh +++ b/.github/ci/build-nightly.sh @@ -23,7 +23,7 @@ fi hashtime restore /ci/cache/filetime.json || true hashtime save /ci/cache/filetime.json -cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6 +cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev c60400e213f7eb0296581183140ec147dd7a848b ./ci-nightly.sh diff --git a/.github/ci/build-xtensa.sh b/.github/ci/build-xtensa.sh index 3f74b4a5a..f07816861 100755 --- a/.github/ci/build-xtensa.sh +++ b/.github/ci/build-xtensa.sh @@ -25,7 +25,7 @@ fi hashtime restore /ci/cache/filetime.json || true hashtime save /ci/cache/filetime.json -cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6 +cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev c60400e213f7eb0296581183140ec147dd7a848b ./ci-xtensa.sh diff --git a/.github/ci/build.sh b/.github/ci/build.sh index 3c196f72b..cd3006c49 100755 --- a/.github/ci/build.sh +++ b/.github/ci/build.sh @@ -28,7 +28,7 @@ fi hashtime restore /ci/cache/filetime.json || true hashtime save /ci/cache/filetime.json -cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6 +cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev c60400e213f7eb0296581183140ec147dd7a848b ./ci.sh diff --git a/.github/ci/doc.sh b/.github/ci/doc.sh index 535fc5262..5a0032d9d 100755 --- a/.github/ci/doc.sh +++ b/.github/ci/doc.sh @@ -12,7 +12,7 @@ export CARGO_TARGET_DIR=/ci/cache/target export PATH=$CARGO_HOME/bin:$PATH mv rust-toolchain-nightly.toml rust-toolchain.toml -cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6 +cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev c60400e213f7eb0296581183140ec147dd7a848b cargo embassy-devtool doc -o webroot diff --git a/.github/ci/janitor.sh b/.github/ci/janitor.sh index bc43075bd..9679308f2 100755 --- a/.github/ci/janitor.sh +++ b/.github/ci/janitor.sh @@ -9,7 +9,7 @@ export CARGO_HOME=/ci/cache/cargo export CARGO_TARGET_DIR=/ci/cache/target export PATH=$CARGO_HOME/bin:$PATH -cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev d015fd5e972a3e550ebef0da6748099b88a93ba6 +cargo install --git https://github.com/embassy-rs/cargo-embassy-devtool --locked --rev c60400e213f7eb0296581183140ec147dd7a848b cargo embassy-devtool check-crlf cargo embassy-devtool check-manifest -- cgit From 31543f38ec05965b0903c7da0854b375ac6a3d1c Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Mon, 8 Dec 2025 11:28:54 +0100 Subject: feat: add support for nrf54 to embassy-boot examples --- examples/boot/application/nrf/Cargo.toml | 5 +++-- examples/boot/application/nrf/README.md | 2 +- examples/boot/application/nrf/src/bin/a.rs | 13 ++++++++++--- examples/boot/application/nrf/src/bin/b.rs | 2 ++ examples/boot/bootloader/nrf/Cargo.toml | 4 +++- examples/boot/bootloader/nrf/src/main.rs | 3 +++ 6 files changed, 22 insertions(+), 7 deletions(-) diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml index 55053bc33..4176fd499 100644 --- a/examples/boot/application/nrf/Cargo.toml +++ b/examples/boot/application/nrf/Cargo.toml @@ -9,7 +9,7 @@ publish = false embassy-sync = { version = "0.7.2", path = "../../../../embassy-sync" } embassy-executor = { version = "0.9.0", path = "../../../../embassy-executor", features = ["arch-cortex-m", "executor-thread", "arch-cortex-m", "executor-thread"] } embassy-time = { version = "0.5.0", path = "../../../../embassy-time", features = [] } -embassy-nrf = { version = "0.8.0", path = "../../../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", ] } +embassy-nrf = { version = "0.8.0", path = "../../../../embassy-nrf", features = ["gpiote", ] } embassy-boot = { version = "0.6.1", path = "../../../../embassy-boot", features = [] } embassy-boot-nrf = { version = "0.9.0", path = "../../../../embassy-boot-nrf", features = [] } embassy-embedded-hal = { version = "0.5.0", path = "../../../../embassy-embedded-hal" } @@ -40,5 +40,6 @@ build = [ { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9160-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9160" }, { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9120-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9120" }, { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9151-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9151" }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9161" } + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9161" }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf54l15-app-s", "skip-include"], artifact-dir = "out/examples/boot/nrf54l15" } ] diff --git a/examples/boot/application/nrf/README.md b/examples/boot/application/nrf/README.md index 9d6d20336..c92ccb358 100644 --- a/examples/boot/application/nrf/README.md +++ b/examples/boot/application/nrf/README.md @@ -22,7 +22,7 @@ cp memory-bl.x ../../bootloader/nrf/memory.x # Flash bootloader cargo flash --manifest-path ../../bootloader/nrf/Cargo.toml --features embassy-nrf/nrf52840 --target thumbv7em-none-eabi --release --chip nRF52840_xxAA # Build 'b' -cargo build --release --bin b --features embassy-nrf/nrf52840 +cargo build --release --bin b --features embassy-nrf/nrf52840,time-driver-rtc1 # Generate binary for 'b' cargo objcopy --release --bin b --features embassy-nrf/nrf52840 --target thumbv7em-none-eabi -- -O binary b.bin ``` diff --git a/examples/boot/application/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs index 2c1d1a7bb..f317414fc 100644 --- a/examples/boot/application/nrf/src/bin/a.rs +++ b/examples/boot/application/nrf/src/bin/a.rs @@ -27,6 +27,11 @@ async fn main(_spawner: Spawner) { let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); let mut led_reverted = Output::new(p.P0_14, Level::High, OutputDrive::Standard); + // nRF54 DK + // let mut button = Input::new(p.P1_13, Pull::Up); + // let mut led = Output::new(p.P1_14, Level::Low, OutputDrive::Standard); + // let mut led_reverted = Output::new(p.P2_09, Level::High, OutputDrive::Standard); + //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); //let mut button = Input::new(p.P1_02, Pull::Up); @@ -40,8 +45,8 @@ async fn main(_spawner: Spawner) { // the watchdog will cause the device to reset as per its configured timeout in the bootloader. // This helps is avoid a situation where new firmware might be bad and block our executor. // If firmware is bad in this way then the bootloader will revert to any previous version. - let wdt_config = wdt::Config::try_new(&p.WDT).unwrap(); - let (_wdt, [_wdt_handle]) = match Watchdog::try_new(p.WDT, wdt_config) { + let wdt_config = wdt::Config::try_new(&p.WDT0).unwrap(); + let (_wdt, [_wdt_handle]) = match Watchdog::try_new(p.WDT0, wdt_config) { Ok(x) => x, Err(_) => { // Watchdog already active with the wrong number of handles, waiting for it to timeout... @@ -51,11 +56,13 @@ async fn main(_spawner: Spawner) { } }; + // RRAMC for nRF54 + // let nvmc = Nvmc::new(p.RRAMC); let nvmc = Nvmc::new(p.NVMC); let nvmc = Mutex::new(BlockingAsync::new(nvmc)); let config = FirmwareUpdaterConfig::from_linkerfile(&nvmc, &nvmc); - let mut magic = [0; 4]; + let mut magic = [0; 16]; let mut updater = FirmwareUpdater::new(config, &mut magic); let state = updater.get_state().await.unwrap(); if state == State::Revert { diff --git a/examples/boot/application/nrf/src/bin/b.rs b/examples/boot/application/nrf/src/bin/b.rs index de97b6a22..7ed78ea85 100644 --- a/examples/boot/application/nrf/src/bin/b.rs +++ b/examples/boot/application/nrf/src/bin/b.rs @@ -15,6 +15,8 @@ async fn main(_spawner: Spawner) { // nRF91 DK // let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard); + // nrf54l15 dk + // let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); loop { led.set_high(); diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml index 1fea2b7d7..59fc6e4ed 100644 --- a/examples/boot/bootloader/nrf/Cargo.toml +++ b/examples/boot/bootloader/nrf/Cargo.toml @@ -27,6 +27,7 @@ defmt = [ softdevice = [ "embassy-boot-nrf/softdevice", ] +nrf54 = [] [profile.dev] debug = 2 @@ -65,5 +66,6 @@ build = [ { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9160-ns"] }, { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9120-ns"] }, { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9151-ns"] }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns"] } + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns"] }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf54l15-app-s", "nrf54"] } ] diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs index 76c4c1048..9ba57e81b 100644 --- a/examples/boot/bootloader/nrf/src/main.rs +++ b/examples/boot/bootloader/nrf/src/main.rs @@ -28,7 +28,10 @@ fn main() -> ! { wdt_config.action_during_sleep = SleepConfig::RUN; wdt_config.action_during_debug_halt = HaltConfig::PAUSE; + #[cfg(not(feature = "nrf54"))] let flash = WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config); + #[cfg(feature = "nrf54")] + let flash = WatchdogFlash::start(Nvmc::new(p.RRAMC), p.WDT0, wdt_config); let flash = Mutex::new(RefCell::new(flash)); let config = BootLoaderConfig::from_linkerfile_blocking(&flash, &flash, &flash); -- cgit From 427c6a495d5d3a9b76da7f1673a85f45ad6e1227 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Mon, 8 Dec 2025 11:43:51 +0100 Subject: chore: use feature guards for nrf54 in examples --- examples/boot/application/nrf/Cargo.toml | 13 +++++++------ examples/boot/application/nrf/src/bin/a.rs | 24 ++++++++++++++++++------ examples/boot/application/nrf/src/bin/b.rs | 4 +++- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/examples/boot/application/nrf/Cargo.toml b/examples/boot/application/nrf/Cargo.toml index 4176fd499..79286e295 100644 --- a/examples/boot/application/nrf/Cargo.toml +++ b/examples/boot/application/nrf/Cargo.toml @@ -33,13 +33,14 @@ defmt = [ "embassy-boot-nrf/defmt", "embassy-sync/defmt", ] +nrf54 = ["embassy-nrf/time-driver-grtc"] [package.metadata.embassy] build = [ - { target = "thumbv7em-none-eabi", features = ["embassy-nrf/nrf52840", "skip-include"], artifact-dir = "out/examples/boot/nrf52840" }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9160-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9160" }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9120-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9120" }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9151-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9151" }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns", "skip-include"], artifact-dir = "out/examples/boot/nrf9161" }, - { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf54l15-app-s", "skip-include"], artifact-dir = "out/examples/boot/nrf54l15" } + { target = "thumbv7em-none-eabi", features = ["embassy-nrf/nrf52840", "embassy-nrf/time-driver-rtc1", "skip-include"], artifact-dir = "out/examples/boot/nrf52840" }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9160-ns", "embassy-nrf/time-driver-rtc1", "skip-include"], artifact-dir = "out/examples/boot/nrf9160" }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9120-ns", "embassy-nrf/time-driver-rtc1", "skip-include"], artifact-dir = "out/examples/boot/nrf9120" }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9151-ns", "embassy-nrf/time-driver-rtc1", "skip-include"], artifact-dir = "out/examples/boot/nrf9151" }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns", "embassy-nrf/time-driver-rtc1", "skip-include"], artifact-dir = "out/examples/boot/nrf9161" }, + { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf54l15-app-s", "nrf54", "skip-include"], artifact-dir = "out/examples/boot/nrf54l15" } ] diff --git a/examples/boot/application/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs index f317414fc..035ffe214 100644 --- a/examples/boot/application/nrf/src/bin/a.rs +++ b/examples/boot/application/nrf/src/bin/a.rs @@ -23,14 +23,20 @@ static APP_B: &[u8] = include_bytes!("../../b.bin"); async fn main(_spawner: Spawner) { let p = embassy_nrf::init(Default::default()); + #[cfg(not(feature = "nrf54"))] let mut button = Input::new(p.P0_11, Pull::Up); + #[cfg(not(feature = "nrf54"))] let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); + #[cfg(not(feature = "nrf54"))] let mut led_reverted = Output::new(p.P0_14, Level::High, OutputDrive::Standard); // nRF54 DK - // let mut button = Input::new(p.P1_13, Pull::Up); - // let mut led = Output::new(p.P1_14, Level::Low, OutputDrive::Standard); - // let mut led_reverted = Output::new(p.P2_09, Level::High, OutputDrive::Standard); + #[cfg(feature = "nrf54")] + let mut button = Input::new(p.P1_13, Pull::Up); + #[cfg(feature = "nrf54")] + let mut led = Output::new(p.P1_14, Level::Low, OutputDrive::Standard); + #[cfg(feature = "nrf54")] + let mut led_reverted = Output::new(p.P2_09, Level::High, OutputDrive::Standard); //let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); //let mut button = Input::new(p.P1_02, Pull::Up); @@ -45,8 +51,12 @@ async fn main(_spawner: Spawner) { // the watchdog will cause the device to reset as per its configured timeout in the bootloader. // This helps is avoid a situation where new firmware might be bad and block our executor. // If firmware is bad in this way then the bootloader will revert to any previous version. - let wdt_config = wdt::Config::try_new(&p.WDT0).unwrap(); - let (_wdt, [_wdt_handle]) = match Watchdog::try_new(p.WDT0, wdt_config) { + #[cfg(feature = "nrf54")] + let wdt = p.WDT0; + #[cfg(not(feature = "nrf54"))] + let wdt = p.WDT; + let wdt_config = wdt::Config::try_new(&wdt).unwrap(); + let (_wdt, [_wdt_handle]) = match Watchdog::try_new(wdt, wdt_config) { Ok(x) => x, Err(_) => { // Watchdog already active with the wrong number of handles, waiting for it to timeout... @@ -57,7 +67,9 @@ async fn main(_spawner: Spawner) { }; // RRAMC for nRF54 - // let nvmc = Nvmc::new(p.RRAMC); + #[cfg(feature = "nrf54")] + let nvmc = Nvmc::new(p.RRAMC); + #[cfg(not(feature = "nrf54"))] let nvmc = Nvmc::new(p.NVMC); let nvmc = Mutex::new(BlockingAsync::new(nvmc)); diff --git a/examples/boot/application/nrf/src/bin/b.rs b/examples/boot/application/nrf/src/bin/b.rs index 7ed78ea85..6718df5a1 100644 --- a/examples/boot/application/nrf/src/bin/b.rs +++ b/examples/boot/application/nrf/src/bin/b.rs @@ -10,13 +10,15 @@ use panic_reset as _; #[embassy_executor::main] async fn main(_spawner: Spawner) { let p = embassy_nrf::init(Default::default()); + #[cfg(not(feature = "nrf54"))] let mut led = Output::new(p.P0_13, Level::Low, OutputDrive::Standard); // let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); // nRF91 DK // let mut led = Output::new(p.P0_02, Level::Low, OutputDrive::Standard); // nrf54l15 dk - // let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); + #[cfg(feature = "nrf54")] + let mut led = Output::new(p.P1_10, Level::Low, OutputDrive::Standard); loop { led.set_high(); -- cgit