embassy-boot (rp): Add WatchdogFlash

This commit is contained in:
kalkyl
2023-01-03 22:58:56 +01:00
parent 0aa2a9ac27
commit 9428c40c8d
5 changed files with 64 additions and 4 deletions

View File

@ -11,6 +11,8 @@ defmt-rtt = { version = "0.4", optional = true }
embassy-rp = { path = "../../../../embassy-rp", default-features = false, features = ["nightly"] }
embassy-boot-rp = { path = "../../../../embassy-boot/rp", default-features = false }
embassy-time = { path = "../../../../embassy-time", features = ["nightly"] }
cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
cortex-m-rt = { version = "0.7" }
embedded-storage = "0.3.0"

View File

@ -5,8 +5,8 @@ use cortex_m_rt::{entry, exception};
#[cfg(feature = "defmt")]
use defmt_rtt as _;
use embassy_boot_rp::*;
use embassy_rp::flash::{Flash, ERASE_SIZE};
use embassy_rp::peripherals::FLASH;
use embassy_rp::flash::ERASE_SIZE;
use embassy_time::Duration;
const FLASH_SIZE: usize = 2 * 1024 * 1024;
@ -23,7 +23,7 @@ fn main() -> ! {
*/
let mut bl: BootLoader = BootLoader::default();
let flash: Flash<'_, FLASH, FLASH_SIZE> = Flash::new(p.FLASH);
let flash: WatchdogFlash<'_, FLASH_SIZE> = WatchdogFlash::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8));
let mut flash = BootFlash::<_, ERASE_SIZE>::new(flash);
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
core::mem::drop(flash);