diff options
| author | David Flemström <[email protected]> | 2024-06-28 19:10:59 +0200 |
|---|---|---|
| committer | David Flemström <[email protected]> | 2024-06-28 22:52:03 +0200 |
| commit | cbc67469d3faa65c4839657609b8e804bcfd75fd (patch) | |
| tree | ccc41b4ffde2f49843f338127b26b032c9668dc8 /embassy-boot-rp/src/lib.rs | |
| parent | 26e660722cca9151e5a9331c328421145509ab20 (diff) | |
Route sources of panics to the crate's fmt macros
Diffstat (limited to 'embassy-boot-rp/src/lib.rs')
| -rw-r--r-- | embassy-boot-rp/src/lib.rs | 8 |
1 files changed, 7 insertions, 1 deletions
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 |
