diff options
| author | Ulf Lilleengen <[email protected]> | 2022-04-19 14:42:38 +0200 |
|---|---|---|
| committer | Ulf Lilleengen <[email protected]> | 2022-04-19 20:07:06 +0200 |
| commit | 2afff617f652d0fdcfa9ffcfd49062e3d2c996a3 (patch) | |
| tree | bc531122365086cd24a12a9331c94f9f042cad3a /examples/boot/src/bin/a.rs | |
| parent | e2ed41b3832db17633ae8ae1ee9391639c3a9229 (diff) | |
Support multiple flash instances in embassy-boot
* Add FlashProvider and FlashConfig traits to define flash
characteristics
* Use traits in bootloader to retrieve flash handles and for
copying data between flash instances
* Add convenience implementations for using a single flash instance.
Diffstat (limited to 'examples/boot/src/bin/a.rs')
| -rw-r--r-- | examples/boot/src/bin/a.rs | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/examples/boot/src/bin/a.rs b/examples/boot/src/bin/a.rs index 88880e688..d18b508cc 100644 --- a/examples/boot/src/bin/a.rs +++ b/examples/boot/src/bin/a.rs | |||
| @@ -12,7 +12,6 @@ use embassy_nrf::{ | |||
| 12 | Peripherals, | 12 | Peripherals, |
| 13 | }; | 13 | }; |
| 14 | use embassy_traits::adapter::BlockingAsync; | 14 | use embassy_traits::adapter::BlockingAsync; |
| 15 | use embedded_hal::digital::v2::InputPin; | ||
| 16 | use panic_reset as _; | 15 | use panic_reset as _; |
| 17 | 16 | ||
| 18 | static APP_B: &[u8] = include_bytes!("../../b.bin"); | 17 | static APP_B: &[u8] = include_bytes!("../../b.bin"); |
| @@ -29,14 +28,14 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { | |||
| 29 | 28 | ||
| 30 | loop { | 29 | loop { |
| 31 | button.wait_for_any_edge().await; | 30 | button.wait_for_any_edge().await; |
| 32 | if button.is_low().unwrap() { | 31 | if button.is_low() { |
| 33 | let mut updater = updater::new(); | 32 | let mut updater = updater::new(); |
| 34 | let mut offset = 0; | 33 | let mut offset = 0; |
| 35 | for chunk in APP_B.chunks(4096) { | 34 | for chunk in APP_B.chunks(4096) { |
| 36 | let mut buf: [u8; 4096] = [0; 4096]; | 35 | let mut buf: [u8; 4096] = [0; 4096]; |
| 37 | buf[..chunk.len()].copy_from_slice(chunk); | 36 | buf[..chunk.len()].copy_from_slice(chunk); |
| 38 | updater | 37 | updater |
| 39 | .write_firmware(offset, &buf, &mut nvmc) | 38 | .write_firmware(offset, &buf, &mut nvmc, 4096) |
| 40 | .await | 39 | .await |
| 41 | .unwrap(); | 40 | .unwrap(); |
| 42 | offset += chunk.len(); | 41 | offset += chunk.len(); |
