From 2afff617f652d0fdcfa9ffcfd49062e3d2c996a3 Mon Sep 17 00:00:00 2001 From: Ulf Lilleengen Date: Tue, 19 Apr 2022 14:42:38 +0200 Subject: 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. --- examples/boot/.cargo/config.toml | 1 - examples/boot/Cargo.toml | 4 ++-- examples/boot/src/bin/a.rs | 5 ++--- 3 files changed, 4 insertions(+), 6 deletions(-) (limited to 'examples') 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 @@ [unstable] -namespaced-features = true build-std = ["core"] build-std-features = ["panic_immediate_abort"] 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" version = "0.1.0" [dependencies] -embassy = { version = "0.1.0", path = "../../embassy" } -embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["time-driver-rtc1", "gpiote"] } +embassy = { version = "0.1.0", path = "../../embassy", features = ["nightly"] } +embassy-nrf = { version = "0.1.0", path = "../../embassy-nrf", features = ["time-driver-rtc1", "gpiote", "nightly"] } embassy-boot-nrf = { version = "0.1.0", path = "../../embassy-boot/nrf" } embassy-traits = { version = "0.1.0", path = "../../embassy-traits" } 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::{ Peripherals, }; use embassy_traits::adapter::BlockingAsync; -use embedded_hal::digital::v2::InputPin; use panic_reset as _; static APP_B: &[u8] = include_bytes!("../../b.bin"); @@ -29,14 +28,14 @@ async fn main(_s: embassy::executor::Spawner, p: Peripherals) { loop { button.wait_for_any_edge().await; - if button.is_low().unwrap() { + if button.is_low() { let mut updater = updater::new(); let mut offset = 0; for chunk in APP_B.chunks(4096) { let mut buf: [u8; 4096] = [0; 4096]; buf[..chunk.len()].copy_from_slice(chunk); updater - .write_firmware(offset, &buf, &mut nvmc) + .write_firmware(offset, &buf, &mut nvmc, 4096) .await .unwrap(); offset += chunk.len(); -- cgit