diff options
| author | Raul Alimbekov <[email protected]> | 2025-12-16 09:05:22 +0300 |
|---|---|---|
| committer | GitHub <[email protected]> | 2025-12-16 09:05:22 +0300 |
| commit | c9a04b4b732b7a3b696eb8223664c1a7942b1875 (patch) | |
| tree | 6dbe5c02e66eed8d8762f13f95afd24f8db2b38c /examples/boot/bootloader/nrf | |
| parent | cde24a3ef1117653ba5ed4184102b33f745782fb (diff) | |
| parent | 5ae6e060ec1c90561719aabdc29d5b6e7b8b0a82 (diff) | |
Merge branch 'main' into main
Diffstat (limited to 'examples/boot/bootloader/nrf')
| -rw-r--r-- | examples/boot/bootloader/nrf/Cargo.toml | 6 | ||||
| -rw-r--r-- | examples/boot/bootloader/nrf/src/main.rs | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/examples/boot/bootloader/nrf/Cargo.toml b/examples/boot/bootloader/nrf/Cargo.toml index 72b7114d4..59fc6e4ed 100644 --- a/examples/boot/bootloader/nrf/Cargo.toml +++ b/examples/boot/bootloader/nrf/Cargo.toml | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | [package] | 1 | [package] |
| 2 | edition = "2021" | 2 | edition = "2024" |
| 3 | name = "nrf-bootloader-example" | 3 | name = "nrf-bootloader-example" |
| 4 | version = "0.1.0" | 4 | version = "0.1.0" |
| 5 | description = "Bootloader for nRF chips" | 5 | description = "Bootloader for nRF chips" |
| @@ -27,6 +27,7 @@ defmt = [ | |||
| 27 | softdevice = [ | 27 | softdevice = [ |
| 28 | "embassy-boot-nrf/softdevice", | 28 | "embassy-boot-nrf/softdevice", |
| 29 | ] | 29 | ] |
| 30 | nrf54 = [] | ||
| 30 | 31 | ||
| 31 | [profile.dev] | 32 | [profile.dev] |
| 32 | debug = 2 | 33 | debug = 2 |
| @@ -65,5 +66,6 @@ build = [ | |||
| 65 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9160-ns"] }, | 66 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9160-ns"] }, |
| 66 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9120-ns"] }, | 67 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9120-ns"] }, |
| 67 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9151-ns"] }, | 68 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9151-ns"] }, |
| 68 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns"] } | 69 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf9161-ns"] }, |
| 70 | { target = "thumbv8m.main-none-eabihf", features = ["embassy-nrf/nrf54l15-app-s", "nrf54"] } | ||
| 69 | ] | 71 | ] |
diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs index b849a0df3..9ba57e81b 100644 --- a/examples/boot/bootloader/nrf/src/main.rs +++ b/examples/boot/bootloader/nrf/src/main.rs | |||
| @@ -28,7 +28,10 @@ fn main() -> ! { | |||
| 28 | wdt_config.action_during_sleep = SleepConfig::RUN; | 28 | wdt_config.action_during_sleep = SleepConfig::RUN; |
| 29 | wdt_config.action_during_debug_halt = HaltConfig::PAUSE; | 29 | wdt_config.action_during_debug_halt = HaltConfig::PAUSE; |
| 30 | 30 | ||
| 31 | #[cfg(not(feature = "nrf54"))] | ||
| 31 | let flash = WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config); | 32 | let flash = WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config); |
| 33 | #[cfg(feature = "nrf54")] | ||
| 34 | let flash = WatchdogFlash::start(Nvmc::new(p.RRAMC), p.WDT0, wdt_config); | ||
| 32 | let flash = Mutex::new(RefCell::new(flash)); | 35 | let flash = Mutex::new(RefCell::new(flash)); |
| 33 | 36 | ||
| 34 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash, &flash, &flash); | 37 | let config = BootLoaderConfig::from_linkerfile_blocking(&flash, &flash, &flash); |
| @@ -38,8 +41,8 @@ fn main() -> ! { | |||
| 38 | unsafe { bl.load(active_offset) } | 41 | unsafe { bl.load(active_offset) } |
| 39 | } | 42 | } |
| 40 | 43 | ||
| 41 | #[no_mangle] | 44 | #[unsafe(no_mangle)] |
| 42 | #[cfg_attr(target_os = "none", link_section = ".HardFault.user")] | 45 | #[cfg_attr(target_os = "none", unsafe(link_section = ".HardFault.user"))] |
| 43 | unsafe extern "C" fn HardFault() { | 46 | unsafe extern "C" fn HardFault() { |
| 44 | cortex_m::peripheral::SCB::sys_reset(); | 47 | cortex_m::peripheral::SCB::sys_reset(); |
| 45 | } | 48 | } |
| @@ -47,7 +50,7 @@ unsafe extern "C" fn HardFault() { | |||
| 47 | #[exception] | 50 | #[exception] |
| 48 | unsafe fn DefaultHandler(_: i16) -> ! { | 51 | unsafe fn DefaultHandler(_: i16) -> ! { |
| 49 | const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; | 52 | const SCB_ICSR: *const u32 = 0xE000_ED04 as *const u32; |
| 50 | let irqn = core::ptr::read_volatile(SCB_ICSR) as u8 as i16 - 16; | 53 | let irqn = unsafe { core::ptr::read_volatile(SCB_ICSR) } as u8 as i16 - 16; |
| 51 | 54 | ||
| 52 | panic!("DefaultHandler #{:?}", irqn); | 55 | panic!("DefaultHandler #{:?}", irqn); |
| 53 | } | 56 | } |
