From 84bfe9b8c93ea8634ce2192fb719034b5c13e5da Mon Sep 17 00:00:00 2001 From: Rasmus Melchior Jacobsen Date: Tue, 4 Apr 2023 22:44:21 +0200 Subject: [PATCH] Align examples with bootloader changes --- embassy-boot/nrf/src/lib.rs | 2 +- embassy-boot/rp/src/lib.rs | 2 +- examples/boot/bootloader/nrf/src/main.rs | 8 +++++--- examples/boot/bootloader/rp/src/main.rs | 3 +-- 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 d3774d30..a2176f60 100644 --- a/embassy-boot/nrf/src/lib.rs +++ b/embassy-boot/nrf/src/lib.rs @@ -16,7 +16,7 @@ pub struct BootLoader { aligned_buf: AlignedBuffer, } -impl Default for BootLoader { +impl Default for BootLoader { /// Create a new bootloader instance using parameters from linker script fn default() -> Self { extern "C" { diff --git a/embassy-boot/rp/src/lib.rs b/embassy-boot/rp/src/lib.rs index c163db13..0031efa6 100644 --- a/embassy-boot/rp/src/lib.rs +++ b/embassy-boot/rp/src/lib.rs @@ -52,7 +52,7 @@ impl BootLoader { } } -impl Default for BootLoader { +impl Default for BootLoader { /// Create a new bootloader instance using parameters from linker script fn default() -> Self { extern "C" { diff --git a/examples/boot/bootloader/nrf/src/main.rs b/examples/boot/bootloader/nrf/src/main.rs index aca3b857..8818a23b 100644 --- a/examples/boot/bootloader/nrf/src/main.rs +++ b/examples/boot/bootloader/nrf/src/main.rs @@ -27,9 +27,11 @@ fn main() -> ! { wdt_config.run_during_sleep = true; wdt_config.run_during_debug_halt = false; - let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::<_, 4096>::new( - WatchdogFlash::start(Nvmc::new(p.NVMC), p.WDT, wdt_config), - ))); + let start = bl.prepare(&mut SingleFlashConfig::new(&mut BootFlash::new(WatchdogFlash::start( + Nvmc::new(p.NVMC), + p.WDT, + wdt_config, + )))); unsafe { bl.load(start) } } diff --git a/examples/boot/bootloader/rp/src/main.rs b/examples/boot/bootloader/rp/src/main.rs index fb7f0522..8129591f 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}; #[cfg(feature = "defmt")] use defmt_rtt as _; use embassy_boot_rp::*; -use embassy_rp::flash::ERASE_SIZE; use embassy_time::Duration; const FLASH_SIZE: usize = 2 * 1024 * 1024; @@ -24,7 +23,7 @@ fn main() -> ! { let mut bl: BootLoader = BootLoader::default(); let flash = WatchdogFlash::::start(p.FLASH, p.WATCHDOG, Duration::from_secs(8)); - let mut flash = BootFlash::<_, ERASE_SIZE>::new(flash); + let mut flash = BootFlash::new(flash); let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); core::mem::drop(flash); diff --git a/examples/boot/bootloader/stm32/src/main.rs b/examples/boot/bootloader/stm32/src/main.rs index 4b17cd79..b8027d19 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}; #[cfg(feature = "defmt")] use defmt_rtt as _; use embassy_boot_stm32::*; -use embassy_stm32::flash::{Flash, ERASE_SIZE, ERASE_VALUE, WRITE_SIZE}; +use embassy_stm32::flash::{Flash, ERASE_SIZE}; #[entry] fn main() -> ! { @@ -19,9 +19,9 @@ fn main() -> ! { } */ - let mut bl: BootLoader = BootLoader::default(); + let mut bl: BootLoader = BootLoader::default(); let flash = Flash::new(p.FLASH); - let mut flash = BootFlash::<_, ERASE_SIZE, ERASE_VALUE>::new(flash); + let mut flash = BootFlash::new(flash); let start = bl.prepare(&mut SingleFlashConfig::new(&mut flash)); core::mem::drop(flash); unsafe { bl.load(start) }