diff options
Diffstat (limited to 'examples/boot/application/stm32wl/src/bin')
| -rw-r--r-- | examples/boot/application/stm32wl/src/bin/a.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/boot/application/stm32wl/src/bin/a.rs b/examples/boot/application/stm32wl/src/bin/a.rs index 52a197a5c..c837e47b5 100644 --- a/examples/boot/application/stm32wl/src/bin/a.rs +++ b/examples/boot/application/stm32wl/src/bin/a.rs | |||
| @@ -31,19 +31,19 @@ async fn main(_spawner: Spawner) { | |||
| 31 | led.set_high(); | 31 | led.set_high(); |
| 32 | 32 | ||
| 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); | 33 | let config = FirmwareUpdaterConfig::from_linkerfile(&flash); |
| 34 | let mut updater = FirmwareUpdater::new(config); | 34 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); |
| 35 | let mut updater = FirmwareUpdater::new(config, &mut magic.0); | ||
| 35 | button.wait_for_falling_edge().await; | 36 | button.wait_for_falling_edge().await; |
| 36 | //defmt::info!("Starting update"); | 37 | //defmt::info!("Starting update"); |
| 37 | let mut magic = AlignedBuffer([0; WRITE_SIZE]); | ||
| 38 | let mut offset = 0; | 38 | let mut offset = 0; |
| 39 | for chunk in APP_B.chunks(2048) { | 39 | for chunk in APP_B.chunks(2048) { |
| 40 | let mut buf: [u8; 2048] = [0; 2048]; | 40 | let mut buf: [u8; 2048] = [0; 2048]; |
| 41 | buf[..chunk.len()].copy_from_slice(chunk); | 41 | buf[..chunk.len()].copy_from_slice(chunk); |
| 42 | // defmt::info!("Writing chunk at 0x{:x}", offset); | 42 | // defmt::info!("Writing chunk at 0x{:x}", offset); |
| 43 | updater.write_firmware(magic.as_mut(), offset, &buf).await.unwrap(); | 43 | updater.write_firmware(offset, &buf).await.unwrap(); |
| 44 | offset += chunk.len(); | 44 | offset += chunk.len(); |
| 45 | } | 45 | } |
| 46 | updater.mark_updated(magic.as_mut()).await.unwrap(); | 46 | updater.mark_updated().await.unwrap(); |
| 47 | //defmt::info!("Marked as updated"); | 47 | //defmt::info!("Marked as updated"); |
| 48 | led.set_low(); | 48 | led.set_low(); |
| 49 | cortex_m::peripheral::SCB::sys_reset(); | 49 | cortex_m::peripheral::SCB::sys_reset(); |
