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 | |
| 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')
| -rw-r--r-- | examples/boot/.cargo/config.toml | 1 | ||||
| -rw-r--r-- | examples/boot/Cargo.toml | 4 | ||||
| -rw-r--r-- | examples/boot/src/bin/a.rs | 5 |
3 files changed, 4 insertions, 6 deletions
diff --git a/examples/boot/.cargo/config.toml b/examples/boot/.cargo/config.toml index d044e9b4c..bbe06fd03 100644 --- a/examples/boot/.cargo/config.toml +++ b/examples/boot/.cargo/config.toml | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | [unstable] | 1 | [unstable] |
| 2 | namespaced-features = true | ||
| 3 | build-std = ["core"] | 2 | build-std = ["core"] |
| 4 | build-std-features = ["panic_immediate_abort"] | 3 | build-std-features = ["panic_immediate_abort"] |
| 5 | 4 | ||
diff --git a/examples/boot/Cargo.toml b/examples/boot/Cargo.toml index 36e2e169d..2da659478 100644 --- a/examples/boot/Cargo.toml +++ b/examples/boot/Cargo.toml | |||
| @@ -5,8 +5,8 @@ name = "embassy-boot-examples" | |||
| 5 | version = "0.1.0" | 5 | version = "0.1.0" |
| 6 | 6 | ||
| 7 | [dependencies] | 7 | [dependencies] |
| 8 | embassy = { version = "0.1.0", path = "../../embassy" } | 8 | embassy = { version = "0.1.0", path = "../../embassy", features = ["nightly"] } |
| 9 | embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["time-driver-rtc1", "gpiote"] } | 9 | embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly"] } |
| 10 | embassy-boot-nrf = { version = "0.1.0", path = "../../embassy-boot/nrf" } | 10 | embassy-boot-nrf = { version = "0.1.0", path = "../../embassy-boot/nrf" } |
| 11 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits" } | 11 | embassy-traits = { version = "0.1.0", path = "../../embassy-traits" } |
| 12 | 12 | ||
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(); |
