diff options
| author | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-04 22:44:21 +0200 |
|---|---|---|
| committer | Rasmus Melchior Jacobsen <[email protected]> | 2023-04-04 22:44:21 +0200 |
| commit | 84bfe9b8c93ea8634ce2192fb719034b5c13e5da (patch) | |
| tree | 55438e15f173ab3ce23f48ede11876e1a8aab23e | |
| parent | a77ce1088d927266a23cbc971aed6facd3b7f918 (diff) | |
Align examples with bootloader changes
| -rw-r--r-- | embassy-boot/nrf/src/lib.rs | 2 | ||||
| -rw-r--r-- | embassy-boot/rp/src/lib.rs | 2 | ||||
| -rw-r--r-- | examples/boot/bootloader/nrf/src/main.rs | 8 | ||||
| -rw-r--r-- | examples/boot/bootloader/rp/src/main.rs | 3 | ||||
| -rw-r--r-- | examples/boot/bootloader/stm32/src/main.rs | 6 |
5 files changed, 11 insertions, 10 deletions
diff --git a/embassy-boot/nrf/src/lib.rs b/embassy-boot/nrf/src/lib.rs index d3774d308..a2176f609 100644 --- a/embassy-boot/nrf/src/lib.rs +++ b/embassy-boot/nrf/src/lib.rs | |||
| @@ -16,7 +16,7 @@ pub struct BootLoader<const BUFFER_SIZE: usize = PAGE_SIZE> { | |||
| 16 | aligned_buf: AlignedBuffer<BUFFER_SIZE>, | 16 | aligned_buf: AlignedBuffer<BUFFER_SIZE>, |
| 17 | } | 17 | } |
| 18 | 18 | ||
| 19 | impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> { | 19 | impl Default for BootLoader<PAGE_SIZE> { |
| 20 | /// Create a new bootloader instance using parameters from linker script | 20 | /// Create a new bootloader instance using parameters from linker script |
| 21 | fn default() -> Self { | 21 | fn default() -> Self { |
| 22 | extern "C" { | 22 | extern "C" { |
diff --git a/embassy-boot/rp/src/lib.rs b/embassy-boot/rp/src/lib.rs index c163db131..0031efa63 100644 --- a/embassy-boot/rp/src/lib.rs +++ b/embassy-boot/rp/src/lib.rs | |||
| @@ -52,7 +52,7 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> { | |||
| 52 | } | 52 | } |
| 53 | } | 53 | } |
| 54 | 54 | ||
| 55 | impl<const BUFFER_SIZE: usize> Default for BootLoader<BUFFER_SIZE> { | 55 | impl Default for BootLoader<ERASE_SIZE> { |
| 56 | /// Create a new bootloader instance using parameters from linker script | 56 | /// Create a new bootloader instance using parameters from linker script |
| 57 | fn default() -> Self { | 57 | fn default() -> Self { |
| 58 | extern "C" { | 58 | extern "C" { |
diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs index aca3b857a..8818a23b8 100644 --- a/examples/boot/bootloader/nrf/src/main.rs +++ b/examples/boot/bootloader/nrf/src/main.rs | |||
| @@ -27,9 +27,11 @@ fn main() -> ! { | |||
| 27 | wdt_config.run_during_sleep = true; | 27 | wdt_config.run_during_sleep = true; |
| 28 | wdt_config.run_during_debug_halt = false; | 28 | wdt_config.run_during_debug_halt = false; |
| 29 | 29 | ||
| 30 | let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::<_, 4096>::new( | 30 | let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::new(WatchdogFlash::start( |
| 31 | WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config), | 31 | Nvmc::new(p.NVMC), |
| 32 | ))); | 32 | p.WDT, |
| 33 | wdt_config, | ||
| 34 | )))); | ||
| 33 | unsafe { bl.load(start) } | 35 | unsafe { bl.load(start) } |
| 34 | } | 36 | } |
| 35 | 37 | ||
diff --git a/examples/boot/bootloader/rp/src/main.rs b/examples/boot/bootloader/rp/src/main.rs index fb7f0522b..8129591fa 100644 --- a/examples/boot/bootloader/rp/src/main.rs +++ b/examples/boot/bootloader/rp/src/main.rs | |||
| @@ -5,7 +5,6 @@ use cortex_m_rt::{entry, exception}; | |||
| 5 | #[cfg(feature = "defmt")] | 5 | #[cfg(feature = "defmt")] |
| 6 | use defmt_rtt as _; | 6 | use defmt_rtt as _; |
| 7 | use embassy_boot_rp::*; | 7 | use embassy_boot_rp::*; |
| 8 | use embassy_rp::flash::ERASE_SIZE; | ||
| 9 | use embassy_time::Duration; | 8 | use embassy_time::Duration; |
| 10 | 9 | ||
| 11 | const FLASH_SIZE: usize = 2 * 1024 * 1024; | 10 | const FLASH_SIZE: usize = 2 * 1024 * 1024; |
| @@ -24,7 +23,7 @@ fn main() -> ! { | |||
| 24 | 23 | ||
| 25 | let mut bl: BootLoader = BootLoader::default(); | 24 | let mut bl: BootLoader = BootLoader::default(); |
| 26 | let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8)); | 25 | let flash = WatchdogFlash::<FLASH_SIZE>::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8)); |
| 27 | let mut flash = BootFlash::<_, ERASE_SIZE>::new(flash); | 26 | let mut flash = BootFlash::new(flash); |
| 28 | let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); | 27 | let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); |
| 29 | core::mem::drop(flash); | 28 | core::mem::drop(flash); |
| 30 | 29 | ||
diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs index 4b17cd799..b8027d19a 100644 --- a/examples/boot/bootloader/stm32/src/main.rs +++ b/examples/boot/bootloader/stm32/src/main.rs | |||
| @@ -5,7 +5,7 @@ use cortex_m_rt::{entry, exception}; | |||
| 5 | #[cfg(feature = "defmt")] | 5 | #[cfg(feature = "defmt")] |
| 6 | use defmt_rtt as _; | 6 | use defmt_rtt as _; |
| 7 | use embassy_boot_stm32::*; | 7 | use embassy_boot_stm32::*; |
| 8 | use embassy_stm32::flash::{Flash, ERASE_SIZE, ERASE_VALUE, WRITE_SIZE}; | 8 | use embassy_stm32::flash::{Flash, ERASE_SIZE}; |
| 9 | 9 | ||
| 10 | #[entry] | 10 | #[entry] |
| 11 | fn main() -> ! { | 11 | fn main() -> ! { |
| @@ -19,9 +19,9 @@ fn main() -> ! { | |||
| 19 | } | 19 | } |
| 20 | */ | 20 | */ |
| 21 | 21 | ||
| 22 | let mut bl: BootLoader<ERASE_SIZE, WRITE_SIZE> = BootLoader::default(); | 22 | let mut bl: BootLoader<ERASE_SIZE> = BootLoader::default(); |
| 23 | let flash = Flash::new(p.FLASH); | 23 | let flash = Flash::new(p.FLASH); |
| 24 | let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash); | 24 | let mut flash = BootFlash::new(flash); |
| 25 | let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); | 25 | let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); |
| 26 | core::mem::drop(flash); | 26 | core::mem::drop(flash); |
| 27 | unsafe { bl.load(start) } | 27 | unsafe { bl.load(start) } |
