aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-boot-nrf/src/lib.rs8
-rw-r--r--embassy-boot-rp/src/lib.rs8
-rw-r--r--embassy-boot-stm32/src/lib.rs8
-rw-r--r--embassy-boot/src/test_flash/asynch.rs2
4 files changed, 22 insertions, 4 deletions
diff --git a/embassy-boot-nrf/src/lib.rs b/embassy-boot-nrf/src/lib.rs
index d53e78895..e5bc870b5 100644
--- a/embassy-boot-nrf/src/lib.rs
+++ b/embassy-boot-nrf/src/lib.rs
@@ -20,7 +20,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
20 pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>( 20 pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
21 config: BootLoaderConfig<ACTIVE, DFU, STATE>, 21 config: BootLoaderConfig<ACTIVE, DFU, STATE>,
22 ) -> Self { 22 ) -> Self {
23 Self::try_prepare::<ACTIVE, DFU, STATE>(config).expect("Boot prepare error") 23 if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE>(config) {
24 loader
25 } else {
26 // Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
27 // properly
28 panic!("Boot prepare error")
29 }
24 } 30 }
25 31
26 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware 32 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
diff --git a/embassy-boot-rp/src/lib.rs b/embassy-boot-rp/src/lib.rs
index d0a393bed..3e1731f5e 100644
--- a/embassy-boot-rp/src/lib.rs
+++ b/embassy-boot-rp/src/lib.rs
@@ -21,7 +21,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
21 pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>( 21 pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
22 config: BootLoaderConfig<ACTIVE, DFU, STATE>, 22 config: BootLoaderConfig<ACTIVE, DFU, STATE>,
23 ) -> Self { 23 ) -> Self {
24 Self::try_prepare::<ACTIVE, DFU, STATE>(config).expect("Boot prepare error") 24 if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE>(config) {
25 loader
26 } else {
27 // Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
28 // properly
29 panic!("Boot prepare error")
30 }
25 } 31 }
26 32
27 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware 33 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
diff --git a/embassy-boot-stm32/src/lib.rs b/embassy-boot-stm32/src/lib.rs
index 708441835..387cc0ce5 100644
--- a/embassy-boot-stm32/src/lib.rs
+++ b/embassy-boot-stm32/src/lib.rs
@@ -20,7 +20,13 @@ impl BootLoader {
20 pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash, const BUFFER_SIZE: usize>( 20 pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash, const BUFFER_SIZE: usize>(
21 config: BootLoaderConfig<ACTIVE, DFU, STATE>, 21 config: BootLoaderConfig<ACTIVE, DFU, STATE>,
22 ) -> Self { 22 ) -> Self {
23 Self::try_prepare::<ACTIVE, DFU, STATE, BUFFER_SIZE>(config).expect("Boot prepare error") 23 if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE, BUFFER_SIZE>(config) {
24 loader
25 } else {
26 // Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
27 // properly
28 panic!("Boot prepare error")
29 }
24 } 30 }
25 31
26 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware 32 /// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
diff --git a/embassy-boot/src/test_flash/asynch.rs b/embassy-boot/src/test_flash/asynch.rs
index 3ac9e71ab..c67f2495c 100644
--- a/embassy-boot/src/test_flash/asynch.rs
+++ b/embassy-boot/src/test_flash/asynch.rs
@@ -43,7 +43,7 @@ where
43 } 43 }
44 44
45 fn create_partition<T: NorFlash>(mutex: &Mutex<NoopRawMutex, T>) -> Partition<NoopRawMutex, T> { 45 fn create_partition<T: NorFlash>(mutex: &Mutex<NoopRawMutex, T>) -> Partition<NoopRawMutex, T> {
46 Partition::new(mutex, 0, mutex.try_lock().unwrap().capacity() as u32) 46 Partition::new(mutex, 0, unwrap!(mutex.try_lock()).capacity() as u32)
47 } 47 }
48} 48}
49 49