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 /embassy-boot/nrf/src/lib.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 'embassy-boot/nrf/src/lib.rs')
| -rw-r--r-- | embassy-boot/nrf/src/lib.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/embassy-boot/nrf/src/lib.rs b/embassy-boot/nrf/src/lib.rs index 32250b2db..785cb67e8 100644 --- a/embassy-boot/nrf/src/lib.rs +++ b/embassy-boot/nrf/src/lib.rs | |||
| @@ -4,7 +4,9 @@ | |||
| 4 | 4 | ||
| 5 | mod fmt; | 5 | mod fmt; |
| 6 | 6 | ||
| 7 | pub use embassy_boot::{FirmwareUpdater, Partition, State, BOOT_MAGIC}; | 7 | pub use embassy_boot::{ |
| 8 | FirmwareUpdater, FlashProvider, Partition, SingleFlashProvider, State, BOOT_MAGIC, | ||
| 9 | }; | ||
| 8 | use embassy_nrf::{ | 10 | use embassy_nrf::{ |
| 9 | nvmc::{Nvmc, PAGE_SIZE}, | 11 | nvmc::{Nvmc, PAGE_SIZE}, |
| 10 | peripherals::WDT, | 12 | peripherals::WDT, |
| @@ -62,7 +64,7 @@ impl BootLoader { | |||
| 62 | } | 64 | } |
| 63 | 65 | ||
| 64 | /// Boots the application without softdevice mechanisms | 66 | /// Boots the application without softdevice mechanisms |
| 65 | pub fn prepare<F: NorFlash + ReadNorFlash>(&mut self, flash: &mut F) -> usize { | 67 | pub fn prepare<F: FlashProvider>(&mut self, flash: &mut F) -> usize { |
| 66 | match self.boot.prepare_boot(flash) { | 68 | match self.boot.prepare_boot(flash) { |
| 67 | Ok(_) => self.boot.boot_address(), | 69 | Ok(_) => self.boot.boot_address(), |
| 68 | Err(_) => panic!("boot prepare error!"), | 70 | Err(_) => panic!("boot prepare error!"), |
