aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/bootloader/rp/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/boot/bootloader/rp/src/main.rs')
-rw-r--r--examples/boot/bootloader/rp/src/main.rs16
1 files changed, 11 insertions, 5 deletions
diff --git a/examples/boot/bootloader/rp/src/main.rs b/examples/boot/bootloader/rp/src/main.rs
index 8129591fa..6a81db804 100644
--- a/examples/boot/bootloader/rp/src/main.rs
+++ b/examples/boot/bootloader/rp/src/main.rs
@@ -1,10 +1,13 @@
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_rp::*; 9use embassy_boot_rp::*;
10use embassy_sync::blocking_mutex::Mutex;
8use embassy_time::Duration; 11use embassy_time::Duration;
9 12
10const FLASH_SIZE: usize = 2 * 1024 * 1024; 13const FLASH_SIZE: usize = 2 * 1024 * 1024;
@@ -21,13 +24,16 @@ fn main() -> ! {
21 } 24 }
22 */ 25 */
23 26
24 let mut bl: BootLoader = BootLoader::default();
25 let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8)); 27 let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8));
26 let mut flash = BootFlash::new(flash); 28 let flash = Mutex::new(RefCell::new(flash));
27 let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); 29
28 core::mem::drop(flash); 30 let config = BootLoaderConfig::from_linkerfile_blocking(&flash);
31 let active_offset = config.active.offset();
32 let mut bl: BootLoader<_, _, _> = BootLoader::new(config);
33
34 bl.prepare();
29 35
30 unsafe { bl.load(start) } 36 unsafe { bl.load(embassy_rp::flash::FLASH_BASE as u32 + active_offset) }
31} 37}
32 38
33#[no_mangle] 39#[no_mangle]