diff options
| author | Dario Nieuwenhuis <[email protected]> | 2023-05-30 20:08:01 +0000 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-30 20:08:01 +0000 |
| commit | f5d0d28ac3cfcb74eaa59bbe984b7969a0743724 (patch) | |
| tree | 9b156e69b39cd79f4b977dbd59f6ae1d5cbfc902 /examples/boot/bootloader/rp | |
| parent | 05688934a131b023e147e7c4c24afd1d7b01582a (diff) | |
| parent | c22d2b5b5bbc5e3c7d3a039e90b50d39809a10f2 (diff) | |
Merge pull request #1498 from rmja/remove-bootloader-partitions
Remove bootloader partitions
Diffstat (limited to 'examples/boot/bootloader/rp')
| -rw-r--r-- | examples/boot/bootloader/rp/Cargo.toml | 1 | ||||
| -rw-r--r-- | examples/boot/bootloader/rp/src/main.rs | 16 |
2 files changed, 12 insertions, 5 deletions
diff --git a/examples/boot/bootloader/rp/Cargo.toml b/examples/boot/bootloader/rp/Cargo.toml index bf9226993..8d60f18be 100644 --- a/examples/boot/bootloader/rp/Cargo.toml +++ b/examples/boot/bootloader/rp/Cargo.toml | |||
| @@ -11,6 +11,7 @@ defmt-rtt = { version = "0.4", optional = true } | |||
| 11 | 11 | ||
| 12 | embassy-rp = { path = "../../../../embassy-rp", features = ["nightly"] } | 12 | embassy-rp = { path = "../../../../embassy-rp", features = ["nightly"] } |
| 13 | embassy-boot-rp = { path = "../../../../embassy-boot/rp" } | 13 | embassy-boot-rp = { path = "../../../../embassy-boot/rp" } |
| 14 | embassy-sync = { path = "../../../../embassy-sync" } | ||
| 14 | embassy-time = { path = "../../../../embassy-time", features = ["nightly"] } | 15 | embassy-time = { path = "../../../../embassy-time", features = ["nightly"] } |
| 15 | 16 | ||
| 16 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } | 17 | cortex-m = { version = "0.7.6", features = ["inline-asm", "critical-section-single-core"] } |
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 | ||
| 4 | use core::cell::RefCell; | ||
| 5 | |||
| 4 | use cortex_m_rt::{entry, exception}; | 6 | use cortex_m_rt::{entry, exception}; |
| 5 | #[cfg(feature = "defmt")] | 7 | #[cfg(feature = "defmt")] |
| 6 | use defmt_rtt as _; | 8 | use defmt_rtt as _; |
| 7 | use embassy_boot_rp::*; | 9 | use embassy_boot_rp::*; |
| 10 | use embassy_sync::blocking_mutex::Mutex; | ||
| 8 | use embassy_time::Duration; | 11 | use embassy_time::Duration; |
| 9 | 12 | ||
| 10 | const FLASH_SIZE: usize = 2 * 1024 * 1024; | 13 | const 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] |
