aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/application/stm32l1/src/bin/a.rs
diff options
context:
space:
mode:
Diffstat (limited to 'examples/boot/application/stm32l1/src/bin/a.rs')
-rw-r--r--examples/boot/application/stm32l1/src/bin/a.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/examples/boot/application/stm32l1/src/bin/a.rs b/examples/boot/application/stm32l1/src/bin/a.rs
index 1e9bf3cb9..b4cdcd44d 100644
--- a/examples/boot/application/stm32l1/src/bin/a.rs
+++ b/examples/boot/application/stm32l1/src/bin/a.rs
@@ -33,18 +33,18 @@ async fn main(_spawner: Spawner) {
33 led.set_high(); 33 led.set_high();
34 34
35 let config = FirmwareUpdaterConfig::from_linkerfile(&flash); 35 let config = FirmwareUpdaterConfig::from_linkerfile(&flash);
36 let mut updater = FirmwareUpdater::new(config);
37 button.wait_for_falling_edge().await;
38 let mut magic = AlignedBuffer([0; WRITE_SIZE]); 36 let mut magic = AlignedBuffer([0; WRITE_SIZE]);
37 let mut updater = FirmwareUpdater::new(config, &mut magic.0);
38 button.wait_for_falling_edge().await;
39 let mut offset = 0; 39 let mut offset = 0;
40 for chunk in APP_B.chunks(128) { 40 for chunk in APP_B.chunks(128) {
41 let mut buf: [u8; 128] = [0; 128]; 41 let mut buf: [u8; 128] = [0; 128];
42 buf[..chunk.len()].copy_from_slice(chunk); 42 buf[..chunk.len()].copy_from_slice(chunk);
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 46
47 updater.mark_updated(magic.as_mut()).await.unwrap(); 47 updater.mark_updated().await.unwrap();
48 led.set_low(); 48 led.set_low();
49 Timer::after(Duration::from_secs(1)).await; 49 Timer::after(Duration::from_secs(1)).await;
50 cortex_m::peripheral::SCB::sys_reset(); 50 cortex_m::peripheral::SCB::sys_reset();