aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--embassy-boot/boot/Cargo.toml2
-rw-r--r--embassy-boot/boot/src/lib.rs4
-rw-r--r--embassy-boot/nrf/Cargo.toml2
-rw-r--r--embassy-boot/rp/Cargo.toml2
-rw-r--r--embassy-boot/stm32/Cargo.toml2
-rw-r--r--embassy-embedded-hal/Cargo.toml2
-rw-r--r--embassy-embedded-hal/src/adapter.rs19
-rw-r--r--embassy-nrf/Cargo.toml2
-rw-r--r--embassy-nrf/src/qspi.rs24
-rw-r--r--examples/boot/bootloader/rp/Cargo.toml2
-rw-r--r--examples/boot/bootloader/stm32/Cargo.toml2
11 files changed, 26 insertions, 37 deletions
diff --git a/embassy-boot/boot/Cargo.toml b/embassy-boot/boot/Cargo.toml
index 0b0c77b1e..3312c2f9f 100644
--- a/embassy-boot/boot/Cargo.toml
+++ b/embassy-boot/boot/Cargo.toml
@@ -28,7 +28,7 @@ log = { version = "0.4", optional = true }
28ed25519-dalek = { version = "1.0.1", default_features = false, features = ["u32_backend"], optional = true } 28ed25519-dalek = { version = "1.0.1", default_features = false, features = ["u32_backend"], optional = true }
29embassy-sync = { version = "0.1.0", path = "../../embassy-sync" } 29embassy-sync = { version = "0.1.0", path = "../../embassy-sync" }
30embedded-storage = "0.3.0" 30embedded-storage = "0.3.0"
31embedded-storage-async = "0.3.0" 31embedded-storage-async = "0.4.0"
32salty = { git = "https://github.com/ycrypto/salty.git", rev = "a9f17911a5024698406b75c0fac56ab5ccf6a8c7", optional = true } 32salty = { git = "https://github.com/ycrypto/salty.git", rev = "a9f17911a5024698406b75c0fac56ab5ccf6a8c7", optional = true }
33signature = { version = "1.6.4", default-features = false } 33signature = { version = "1.6.4", default-features = false }
34 34
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs
index be254e9d7..b5dad5046 100644
--- a/embassy-boot/boot/src/lib.rs
+++ b/embassy-boot/boot/src/lib.rs
@@ -5,7 +5,7 @@
5mod fmt; 5mod fmt;
6 6
7use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; 7use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash};
8use embedded_storage_async::nor_flash::AsyncNorFlash; 8use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash;
9 9
10const BOOT_MAGIC: u8 = 0xD0; 10const BOOT_MAGIC: u8 = 0xD0;
11const SWAP_MAGIC: u8 = 0xF0; 11const SWAP_MAGIC: u8 = 0xF0;
@@ -1199,7 +1199,7 @@ mod tests {
1199 use core::future::Future; 1199 use core::future::Future;
1200 1200
1201 use embedded_storage::nor_flash::ErrorType; 1201 use embedded_storage::nor_flash::ErrorType;
1202 use embedded_storage_async::nor_flash::AsyncReadNorFlash; 1202 use embedded_storage_async::nor_flash::ReadNorFlash as AsyncReadNorFlash;
1203 use futures::executor::block_on; 1203 use futures::executor::block_on;
1204 1204
1205 use super::*; 1205 use super::*;
diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml
index c6af70144..c1a127518 100644
--- a/embassy-boot/nrf/Cargo.toml
+++ b/embassy-boot/nrf/Cargo.toml
@@ -22,7 +22,7 @@ embassy-boot = { path = "../boot", default-features = false }
22cortex-m = { version = "0.7.6" } 22cortex-m = { version = "0.7.6" }
23cortex-m-rt = { version = "0.7" } 23cortex-m-rt = { version = "0.7" }
24embedded-storage = "0.3.0" 24embedded-storage = "0.3.0"
25embedded-storage-async = "0.3.0" 25embedded-storage-async = "0.4.0"
26cfg-if = "1.0.0" 26cfg-if = "1.0.0"
27 27
28nrf-softdevice-mbr = { version = "0.1.0", git = "https://github.com/embassy-rs/nrf-softdevice.git", branch = "master", optional = true } 28nrf-softdevice-mbr = { version = "0.1.0", git = "https://github.com/embassy-rs/nrf-softdevice.git", branch = "master", optional = true }
diff --git a/embassy-boot/rp/Cargo.toml b/embassy-boot/rp/Cargo.toml
index ffc36a4e0..96024cdda 100644
--- a/embassy-boot/rp/Cargo.toml
+++ b/embassy-boot/rp/Cargo.toml
@@ -25,7 +25,7 @@ embassy-time = { path = "../../embassy-time", features = ["nightly"] }
25cortex-m = { version = "0.7.6" } 25cortex-m = { version = "0.7.6" }
26cortex-m-rt = { version = "0.7" } 26cortex-m-rt = { version = "0.7" }
27embedded-storage = "0.3.0" 27embedded-storage = "0.3.0"
28embedded-storage-async = "0.3.0" 28embedded-storage-async = "0.4.0"
29cfg-if = "1.0.0" 29cfg-if = "1.0.0"
30 30
31[features] 31[features]
diff --git a/embassy-boot/stm32/Cargo.toml b/embassy-boot/stm32/Cargo.toml
index 2fc169b32..7061063bb 100644
--- a/embassy-boot/stm32/Cargo.toml
+++ b/embassy-boot/stm32/Cargo.toml
@@ -24,7 +24,7 @@ embassy-boot = { path = "../boot", default-features = false }
24cortex-m = { version = "0.7.6" } 24cortex-m = { version = "0.7.6" }
25cortex-m-rt = { version = "0.7" } 25cortex-m-rt = { version = "0.7" }
26embedded-storage = "0.3.0" 26embedded-storage = "0.3.0"
27embedded-storage-async = "0.3.0" 27embedded-storage-async = "0.4.0"
28cfg-if = "1.0.0" 28cfg-if = "1.0.0"
29 29
30[features] 30[features]
diff --git a/embassy-embedded-hal/Cargo.toml b/embassy-embedded-hal/Cargo.toml
index fa74be8c4..45eb0d43d 100644
--- a/embassy-embedded-hal/Cargo.toml
+++ b/embassy-embedded-hal/Cargo.toml
@@ -22,7 +22,7 @@ embedded-hal-02 = { package = "embedded-hal", version = "0.2.6", features = ["un
22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" } 22embedded-hal-1 = { package = "embedded-hal", version = "=1.0.0-alpha.9" }
23embedded-hal-async = { version = "=0.2.0-alpha.0", optional = true } 23embedded-hal-async = { version = "=0.2.0-alpha.0", optional = true }
24embedded-storage = "0.3.0" 24embedded-storage = "0.3.0"
25embedded-storage-async = { version = "0.3.0", optional = true } 25embedded-storage-async = { version = "0.4.0", optional = true }
26nb = "1.0.0" 26nb = "1.0.0"
27 27
28defmt = { version = "0.3", optional = true } 28defmt = { version = "0.3", optional = true }
diff --git a/embassy-embedded-hal/src/adapter.rs b/embassy-embedded-hal/src/adapter.rs
index 3680984f1..a49f8df4b 100644
--- a/embassy-embedded-hal/src/adapter.rs
+++ b/embassy-embedded-hal/src/adapter.rs
@@ -1,7 +1,5 @@
1//! Adapters between embedded-hal traits. 1//! Adapters between embedded-hal traits.
2 2
3use core::future::Future;
4
5use embedded_hal_02::{blocking, serial}; 3use embedded_hal_02::{blocking, serial};
6 4
7/// Wrapper that implements async traits using blocking implementations. 5/// Wrapper that implements async traits using blocking implementations.
@@ -182,7 +180,7 @@ where
182 180
183/// NOR flash wrapper 181/// NOR flash wrapper
184use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash}; 182use embedded_storage::nor_flash::{ErrorType, NorFlash, ReadNorFlash};
185use embedded_storage_async::nor_flash::{AsyncNorFlash, AsyncReadNorFlash}; 183use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash};
186 184
187impl<T> ErrorType for BlockingAsync<T> 185impl<T> ErrorType for BlockingAsync<T>
188where 186where
@@ -198,14 +196,12 @@ where
198 const WRITE_SIZE: usize = <T as NorFlash>::WRITE_SIZE; 196 const WRITE_SIZE: usize = <T as NorFlash>::WRITE_SIZE;
199 const ERASE_SIZE: usize = <T as NorFlash>::ERASE_SIZE; 197 const ERASE_SIZE: usize = <T as NorFlash>::ERASE_SIZE;
200 198
201 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 199 async fn write(&mut self, offset: u32, data: &[u8]) -> Result<(), Self::Error> {
202 fn write<'a>(&'a mut self, offset: u32, data: &'a [u8]) -> Self::WriteFuture<'a> { 200 self.wrapped.write(offset, data)
203 async move { self.wrapped.write(offset, data) }
204 } 201 }
205 202
206 type EraseFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 203 async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
207 fn erase<'a>(&'a mut self, from: u32, to: u32) -> Self::EraseFuture<'a> { 204 self.wrapped.erase(from, to)
208 async move { self.wrapped.erase(from, to) }
209 } 205 }
210} 206}
211 207
@@ -214,9 +210,8 @@ where
214 T: ReadNorFlash, 210 T: ReadNorFlash,
215{ 211{
216 const READ_SIZE: usize = <T as ReadNorFlash>::READ_SIZE; 212 const READ_SIZE: usize = <T as ReadNorFlash>::READ_SIZE;
217 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 213 async fn read(&mut self, address: u32, data: &mut [u8]) -> Result<(), Self::Error> {
218 fn read<'a>(&'a mut self, address: u32, data: &'a mut [u8]) -> Self::ReadFuture<'a> { 214 self.wrapped.read(address, data)
219 async move { self.wrapped.read(address, data) }
220 } 215 }
221 216
222 fn capacity(&self) -> usize { 217 fn capacity(&self) -> usize {
diff --git a/embassy-nrf/Cargo.toml b/embassy-nrf/Cargo.toml
index c31ce199b..4e62ca89e 100644
--- a/embassy-nrf/Cargo.toml
+++ b/embassy-nrf/Cargo.toml
@@ -100,7 +100,7 @@ critical-section = "1.1"
100rand_core = "0.6.3" 100rand_core = "0.6.3"
101fixed = "1.10.0" 101fixed = "1.10.0"
102embedded-storage = "0.3.0" 102embedded-storage = "0.3.0"
103embedded-storage-async = { version = "0.3.0", optional = true } 103embedded-storage-async = { version = "0.4.0", optional = true }
104cfg-if = "1.0.0" 104cfg-if = "1.0.0"
105 105
106nrf52805-pac = { version = "0.12.0", optional = true, features = [ "rt" ] } 106nrf52805-pac = { version = "0.12.0", optional = true, features = [ "rt" ] }
diff --git a/embassy-nrf/src/qspi.rs b/embassy-nrf/src/qspi.rs
index d434327fc..1b379002b 100644
--- a/embassy-nrf/src/qspi.rs
+++ b/embassy-nrf/src/qspi.rs
@@ -528,34 +528,28 @@ impl<'d, T: Instance, const FLASH_SIZE: usize> NorFlash for Qspi<'d, T, FLASH_SI
528cfg_if::cfg_if! { 528cfg_if::cfg_if! {
529 if #[cfg(feature = "nightly")] 529 if #[cfg(feature = "nightly")]
530 { 530 {
531 use embedded_storage_async::nor_flash::{AsyncNorFlash, AsyncReadNorFlash}; 531 use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash};
532 use core::future::Future;
533 532
534 impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncNorFlash for Qspi<'d, T, FLASH_SIZE> { 533 impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncNorFlash for Qspi<'d, T, FLASH_SIZE> {
535 const WRITE_SIZE: usize = <Self as NorFlash>::WRITE_SIZE; 534 const WRITE_SIZE: usize = <Self as NorFlash>::WRITE_SIZE;
536 const ERASE_SIZE: usize = <Self as NorFlash>::ERASE_SIZE; 535 const ERASE_SIZE: usize = <Self as NorFlash>::ERASE_SIZE;
537 536
538 type WriteFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 537 async fn write(&mut self, offset: u32, data: &[u8]) -> Result<(), Self::Error> {
539 fn write<'a>(&'a mut self, offset: u32, data: &'a [u8]) -> Self::WriteFuture<'a> { 538 self.write(offset as usize, data).await
540 async move { self.write(offset as usize, data).await }
541 } 539 }
542 540
543 type EraseFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 541 async fn erase(&mut self, from: u32, to: u32) -> Result<(), Self::Error> {
544 fn erase<'a>(&'a mut self, from: u32, to: u32) -> Self::EraseFuture<'a> { 542 for address in (from as usize..to as usize).step_by(<Self as AsyncNorFlash>::ERASE_SIZE) {
545 async move { 543 self.erase(address).await?
546 for address in (from as usize..to as usize).step_by(<Self as AsyncNorFlash>::ERASE_SIZE) {
547 self.erase(address).await?
548 }
549 Ok(())
550 } 544 }
545 Ok(())
551 } 546 }
552 } 547 }
553 548
554 impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncReadNorFlash for Qspi<'d, T, FLASH_SIZE> { 549 impl<'d, T: Instance, const FLASH_SIZE: usize> AsyncReadNorFlash for Qspi<'d, T, FLASH_SIZE> {
555 const READ_SIZE: usize = 4; 550 const READ_SIZE: usize = 4;
556 type ReadFuture<'a> = impl Future<Output = Result<(), Self::Error>> + 'a where Self: 'a; 551 async fn read(&mut self, address: u32, data: &mut [u8]) -> Result<(), Self::Error> {
557 fn read<'a>(&'a mut self, address: u32, data: &'a mut [u8]) -> Self::ReadFuture<'a> { 552 self.read(address as usize, data).await
558 async move { self.read(address as usize, data).await }
559 } 553 }
560 554
561 fn capacity(&self) -> usize { 555 fn capacity(&self) -> usize {
diff --git a/examples/boot/bootloader/rp/Cargo.toml b/examples/boot/bootloader/rp/Cargo.toml
index c0b576cff..a16cebe31 100644
--- a/examples/boot/bootloader/rp/Cargo.toml
+++ b/examples/boot/bootloader/rp/Cargo.toml
@@ -16,7 +16,7 @@ embassy-time = { path = "../../../../embassy-time", features = ["nightly"] }
16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 16cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
17cortex-m-rt = { version = "0.7" } 17cortex-m-rt = { version = "0.7" }
18embedded-storage = "0.3.0" 18embedded-storage = "0.3.0"
19embedded-storage-async = "0.3.0" 19embedded-storage-async = "0.4.0"
20cfg-if = "1.0.0" 20cfg-if = "1.0.0"
21 21
22[features] 22[features]
diff --git a/examples/boot/bootloader/stm32/Cargo.toml b/examples/boot/bootloader/stm32/Cargo.toml
index be659e02a..b1791620f 100644
--- a/examples/boot/bootloader/stm32/Cargo.toml
+++ b/examples/boot/bootloader/stm32/Cargo.toml
@@ -14,7 +14,7 @@ embassy-boot-stm32 = { path = "../../../../embassy-boot/stm32", default-features
14cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] } 14cortex-m = { version = "0.7.6", features = ["critical-section-single-core"] }
15cortex-m-rt = { version = "0.7" } 15cortex-m-rt = { version = "0.7" }
16embedded-storage = "0.3.0" 16embedded-storage = "0.3.0"
17embedded-storage-async = "0.3.0" 17embedded-storage-async = "0.4.0"
18cfg-if = "1.0.0" 18cfg-if = "1.0.0"
19 19
20[features] 20[features]