Align examples

This commit is contained in:
Rasmus Melchior Jacobsen
2023-05-30 14:03:31 +02:00
parent c2aca45b8d
commit 36e00caf4d
18 changed files with 108 additions and 65 deletions

View File

@ -1,10 +1,13 @@
#![no_std]
#![no_main]
use core::cell::RefCell;
use cortex_m_rt::{entry, exception};
#[cfg(feature = "defmt")]
use defmt_rtt as _;
use embassy_boot_rp::*;
use embassy_sync::blocking_mutex::Mutex;
use embassy_time::Duration;
const FLASH_SIZE: usize = 2 * 1024 * 1024;
@ -21,13 +24,16 @@ fn main() -> ! {
}
*/
let mut bl: BootLoader = BootLoader::default();
let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8));
let mut flash = BootFlash::new(flash);
let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash));
core::mem::drop(flash);
let flash = Mutex::new(RefCell::new(flash));
unsafe { bl.load(start) }
let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
let active_offset = config.active.offset();
let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
bl.prepare();
unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) }
}
#[no_mangle]