aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/application/nrf/src/bin
diff options
context:
space:
mode:
authorUlf Lilleengen <[email protected]>2023-06-19 23:30:51 +0200
committerUlf Lilleengen <[email protected]>2023-06-19 23:34:07 +0200
commit161d3ce05c812f7ee951b6265735187b4994037a (patch)
treec9e82c062ac089cf37cc175810a8a2041bddea0e /examples/boot/application/nrf/src/bin
parent76659d9003104f8edd2472a36149565e4a55c0e6 (diff)
Add firmware updater examples to CI
CI was not building the a.rs application due to the requirement of b.bin having been built first. Add a feature flag to examples so that CI can build them including a dummy application. Update a.rs application examples so that they compile again.
Diffstat (limited to 'examples/boot/application/nrf/src/bin')
-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();