aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/bootloader/nrf/src/main.rs
diff options
context:
space:
mode:
authorDario Nieuwenhuis <[email protected]>2023-05-30 20:08:01 +0000
committerGitHub <[email protected]>2023-05-30 20:08:01 +0000
commitf5d0d28ac3cfcb74eaa59bbe984b7969a0743724 (patch)
tree9b156e69b39cd79f4b977dbd59f6ae1d5cbfc902 /examples/boot/bootloader/nrf/src/main.rs
parent05688934a131b023e147e7c4c24afd1d7b01582a (diff)
parentc22d2b5b5bbc5e3c7d3a039e90b50d39809a10f2 (diff)
Merge pull request #1498 from rmja/remove-bootloader-partitions
Remove bootloader partitions
Diffstat (limited to 'examples/boot/bootloader/nrf/src/main.rs')
-rw-r--r--examples/boot/bootloader/nrf/src/main.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs
index 8818a23b8..72c95c02a 100644
--- a/examples/boot/bootloader/nrf/src/main.rs
+++ b/examples/boot/bootloader/nrf/src/main.rs
@@ -1,12 +1,15 @@
1#![no_std] 1#![no_std]
2#![no_main] 2#![no_main]
3 3
4use core::cell::RefCell;
5
4use cortex_m_rt::{entry, exception}; 6use cortex_m_rt::{entry, exception};
5#[cfg(feature = "defmt")] 7#[cfg(feature = "defmt")]
6use defmt_rtt as _; 8use defmt_rtt as _;
7use embassy_boot_nrf::*; 9use embassy_boot_nrf::*;
8use embassy_nrf::nvmc::Nvmc; 10use embassy_nrf::nvmc::Nvmc;
9use embassy_nrf::wdt; 11use embassy_nrf::wdt;
12use embassy_sync::blocking_mutex::Mutex;
10 13
11#[entry] 14#[entry]
12fn main() -> ! { 15fn main() -> ! {
@@ -20,19 +23,21 @@ fn main() -> ! {
20 } 23 }
21 */ 24 */
22 25
23 let mut bl = BootLoader::default();
24
25 let mut wdt_config = wdt::Config::default(); 26 let mut wdt_config = wdt::Config::default();
26 wdt_config.timeout_ticks = 32768 * 5; // timeout seconds 27 wdt_config.timeout_ticks = 32768 * 5; // timeout seconds
27 wdt_config.run_during_sleep = true; 28 wdt_config.run_during_sleep = true;
28 wdt_config.run_during_debug_halt = false; 29 wdt_config.run_during_debug_halt = false;
29 30
30 let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::new(WatchdogFlash::start( 31 let flash = WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config);
31 Nvmc::new(p.NVMC), 32 let flash = Mutex::new(RefCell::new(flash));
32 p.WDT, 33
33 wdt_config, 34 let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
34 )))); 35 let active_offset = config.active.offset();
35 unsafe { bl.load(start) } 36 let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
37
38 bl.prepare();
39
40 unsafe { bl.load(active_offset) }
36} 41}
37 42
38#[no_mangle] 43#[no_mangle]