mirror of
https://github.com/embassy-rs/embassy.git
synced 2024-11-21 22:32:29 +00:00
Route sources of panics to the crate's fmt macros
This commit is contained in:
parent
26e660722c
commit
cbc67469d3
@ -20,7 +20,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
|
||||
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
|
||||
config: BootLoaderConfig<ACTIVE, DFU, STATE>,
|
||||
) -> Self {
|
||||
Self::try_prepare::<ACTIVE, DFU, STATE>(config).expect("Boot prepare error")
|
||||
if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE>(config) {
|
||||
loader
|
||||
} else {
|
||||
// Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
|
||||
// properly
|
||||
panic!("Boot prepare error")
|
||||
}
|
||||
}
|
||||
|
||||
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
|
||||
|
@ -21,7 +21,13 @@ impl<const BUFFER_SIZE: usize> BootLoader<BUFFER_SIZE> {
|
||||
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>(
|
||||
config: BootLoaderConfig<ACTIVE, DFU, STATE>,
|
||||
) -> Self {
|
||||
Self::try_prepare::<ACTIVE, DFU, STATE>(config).expect("Boot prepare error")
|
||||
if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE>(config) {
|
||||
loader
|
||||
} else {
|
||||
// Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
|
||||
// properly
|
||||
panic!("Boot prepare error")
|
||||
}
|
||||
}
|
||||
|
||||
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
|
||||
|
@ -20,7 +20,13 @@ impl BootLoader {
|
||||
pub fn prepare<ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash, const BUFFER_SIZE: usize>(
|
||||
config: BootLoaderConfig<ACTIVE, DFU, STATE>,
|
||||
) -> Self {
|
||||
Self::try_prepare::<ACTIVE, DFU, STATE, BUFFER_SIZE>(config).expect("Boot prepare error")
|
||||
if let Ok(loader) = Self::try_prepare::<ACTIVE, DFU, STATE, BUFFER_SIZE>(config) {
|
||||
loader
|
||||
} else {
|
||||
// Use explicit panic instead of .expect() to ensure this gets routed via defmt/etc.
|
||||
// properly
|
||||
panic!("Boot prepare error")
|
||||
}
|
||||
}
|
||||
|
||||
/// Inspect the bootloader state and perform actions required before booting, such as swapping firmware
|
||||
|
@ -43,7 +43,7 @@ where
|
||||
}
|
||||
|
||||
fn create_partition<T: NorFlash>(mutex: &Mutex<NoopRawMutex, T>) -> Partition<NoopRawMutex, T> {
|
||||
Partition::new(mutex, 0, mutex.try_lock().unwrap().capacity() as u32)
|
||||
Partition::new(mutex, 0, unwrap!(mutex.try_lock()).capacity() as u32)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user