aboutsummaryrefslogtreecommitdiff
path: root/examples/boot/application/stm32f3/src
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/stm32f3/src
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/stm32f3/src')
-rw-r--r--examples/boot/application/stm32f3/src/bin/a.rs7
1 files changed, 5 insertions, 2 deletions
diff --git a/examples/boot/application/stm32f3/src/bin/a.rs b/examples/boot/application/stm32f3/src/bin/a.rs
index c94676f09..c0a11d699 100644
--- a/examples/boot/application/stm32f3/src/bin/a.rs
+++ b/examples/boot/application/stm32f3/src/bin/a.rs
@@ -13,6 +13,9 @@ use embassy_stm32::gpio::{Input, Level, Output, Pull, Speed};
13use embassy_sync::mutex::Mutex; 13use embassy_sync::mutex::Mutex;
14use panic_reset as _; 14use panic_reset as _;
15 15
16#[cfg(feature = "skip-include")]
17static APP_B: &[u8] = &[0, 1, 2, 3];
18#[cfg(not(feature = "skip-include"))]
16static APP_B: &[u8] = include_bytes!("../../b.bin"); 19static APP_B: &[u8] = include_bytes!("../../b.bin");
17 20
18#[embassy_executor::main] 21#[embassy_executor::main]
@@ -31,13 +34,13 @@ async fn main(_spawner: Spawner) {
31 let mut updater = FirmwareUpdater::new(config); 34 let mut updater = FirmwareUpdater::new(config);
32 button.wait_for_falling_edge().await; 35 button.wait_for_falling_edge().await;
33 let mut offset = 0; 36 let mut offset = 0;
37 let mut magic = AlignedBuffer([0; WRITE_SIZE]);
34 for chunk in APP_B.chunks(2048) { 38 for chunk in APP_B.chunks(2048) {
35 let mut buf: [u8; 2048] = [0; 2048]; 39 let mut buf: [u8; 2048] = [0; 2048];
36 buf[..chunk.len()].copy_from_slice(chunk); 40 buf[..chunk.len()].copy_from_slice(chunk);
37 updater.write_firmware(offset, &buf).await.unwrap(); 41 updater.write_firmware(magic.as_mut(), offset, &buf).await.unwrap();
38 offset += chunk.len(); 42 offset += chunk.len();
39 } 43 }
40 let mut magic = AlignedBuffer([0; WRITE_SIZE]);
41 updater.mark_updated(magic.as_mut()).await.unwrap(); 44 updater.mark_updated(magic.as_mut()).await.unwrap();
42 led.set_low(); 45 led.set_low();
43 cortex_m::peripheral::SCB::sys_reset(); 46 cortex_m::peripheral::SCB::sys_reset();