aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/bootloader/nrf/src/main.rs
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2023-01-04 07:44:23 +0000
committerGitHub <[email protected]>2023-01-04 07:44:23 +0000
commitbf4c0de16a119b9e3a42daf76c4bc60face3c2a1 (patch)
tree1d45b18b0c0b00e783163cf11950ac7bf49efba5 /examples/boot/bootloader/nrf/src/main.rs
parent35afb60dd490d95a972ad64db8a38652538bceba (diff)
parent8497f98de244f0f8800df78d6e83a2fb886016bf (diff)
Merge #1139
1139: Wdt config changes r=lulf a=huntc Per commits: * By passing WDT config around we can control it more easily and promote sharing it between files. * The memory layout of the s140 crept into a number of memory files, which can cause confusion (well, it did for me!). * Obtaining the current WDT config is useful so that we do not have to duplicate configurations around the place. A constructor method has been introduced that attempts to return the current running WDT config from the WDT peripheral. The bootloader example has also been updated to show how the watchdog can be obtained and used. Co-authored-by: huntc <[email protected]>
Diffstat (limited to 'examples/boot/bootloader/nrf/src/main.rs')
-rw-r--r--examples/boot/bootloader/nrf/src/main.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs
index 8266206b3..aca3b857a 100644
--- a/examples/boot/bootloader/nrf/src/main.rs
+++ b/examples/boot/bootloader/nrf/src/main.rs
@@ -6,6 +6,7 @@ use cortex_m_rt::{entry, exception};
6use defmt_rtt as _; 6use defmt_rtt as _;
7use embassy_boot_nrf::*; 7use embassy_boot_nrf::*;
8use embassy_nrf::nvmc::Nvmc; 8use embassy_nrf::nvmc::Nvmc;
9use embassy_nrf::wdt;
9 10
10#[entry] 11#[entry]
11fn main() -> ! { 12fn main() -> ! {
@@ -20,8 +21,14 @@ fn main() -> ! {
20 */ 21 */
21 22
22 let mut bl = BootLoader::default(); 23 let mut bl = BootLoader::default();
24
25 let mut wdt_config = wdt::Config::default();
26 wdt_config.timeout_ticks = 32768 * 5; // timeout seconds
27 wdt_config.run_during_sleep = true;
28 wdt_config.run_during_debug_halt = false;
29
23 let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::<_, 4096>::new( 30 let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::<_, 4096>::new(
24 WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, 5), 31 WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config),
25 ))); 32 )));
26 unsafe { bl.load(start) } 33 unsafe { bl.load(start) }
27} 34}