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.
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
[unstable]
|
||||
namespaced-features = true
|
||||
build-std = ["core"]
|
||||
build-std-features = ["panic_immediate_abort"]
|
||||
|
||||
|
@ -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" }
|
||||
|
||||
|
@ -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();
|
||||
|
Reference in New Issue
Block a user