aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/application/nrf/src
diff options
context:
space:
mode:
authorMathias <[email protected]>2023-07-01 12:17:12 +0200
committerMathias <[email protected]>2023-07-03 19:33:26 +0200
commit60b2f075dcd561cdf3ff069c1cfc5d4177c1a133 (patch)
treeb3e285258cade6618d6bb14e826fee9cf0bb284a /examples/boot/application/nrf/src
parentd372df7ddb381571fd2964e32b486b6d1cd1ad03 (diff)
parentba4344429264fa7beb99ab19c09059c2d531716d (diff)
Merge branch 'main' of https://github.com/embassy-rs/embassy into embassy-stm32/rcc-rtc-l4
Diffstat (limited to 'examples/boot/application/nrf/src')
-rw-r--r--examples/boot/application/nrf/src/bin/a.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/boot/application/nrf/src/bin/a.rs b/examples/boot/application/nrf/src/bin/a.rs
index 06c237781..021d77f3b 100644
--- a/examples/boot/application/nrf/src/bin/a.rs
+++ b/examples/boot/application/nrf/src/bin/a.rs
@@ -12,6 +12,9 @@ use embassy_nrf::wdt::{self, Watchdog};
12use embassy_sync::mutex::Mutex; 12use embassy_sync::mutex::Mutex;
13use panic_reset as _; 13use panic_reset as _;
14 14
15#[cfg(feature = "skip-include")]
16static APP_B: &[u8] = &[0, 1, 2, 3];
17#[cfg(not(feature = "skip-include"))]
15static APP_B: &[u8] = include_bytes!("../../b.bin"); 18static APP_B: &[u8] = include_bytes!("../../b.bin");
16 19
17#[embassy_executor::main] 20#[embassy_executor::main]
@@ -55,13 +58,13 @@ async fn main(_spawner: Spawner) {
55 button.wait_for_any_edge().await; 58 button.wait_for_any_edge().await;
56 if button.is_low() { 59 if button.is_low() {
57 let mut offset = 0; 60 let mut offset = 0;
61 let mut magic = [0; 4];
58 for chunk in APP_B.chunks(4096) { 62 for chunk in APP_B.chunks(4096) {
59 let mut buf: [u8; 4096] = [0; 4096]; 63 let mut buf: [u8; 4096] = [0; 4096];
60 buf[..chunk.len()].copy_from_slice(chunk); 64 buf[..chunk.len()].copy_from_slice(chunk);
61 updater.write_firmware(offset, &buf).await.unwrap(); 65 updater.write_firmware(&mut magic, offset, &buf).await.unwrap();
62 offset += chunk.len(); 66 offset += chunk.len();
63 } 67 }
64 let mut magic = [0; 4];
65 updater.mark_updated(&mut magic).await.unwrap(); 68 updater.mark_updated(&mut magic).await.unwrap();
66 led.set_high(); 69 led.set_high();
67 cortex_m::peripheral::SCB::sys_reset(); 70 cortex_m::peripheral::SCB::sys_reset();