diff options
Diffstat (limited to 'embassy-boot/boot/src')
| -rw-r--r-- | embassy-boot/boot/src/firmware_updater/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-boot/boot/src/lib.rs | 21 | ||||
| -rw-r--r-- | embassy-boot/boot/src/mem_flash.rs | 3 | ||||
| -rw-r--r-- | embassy-boot/boot/src/test_flash/blocking.rs | 1 | ||||
| -rw-r--r-- | embassy-boot/boot/src/test_flash/mod.rs | 2 |
5 files changed, 8 insertions, 21 deletions
diff --git a/embassy-boot/boot/src/firmware_updater/mod.rs b/embassy-boot/boot/src/firmware_updater/mod.rs index 937ddcc69..4814786bf 100644 --- a/embassy-boot/boot/src/firmware_updater/mod.rs +++ b/embassy-boot/boot/src/firmware_updater/mod.rs | |||
| @@ -1,8 +1,6 @@ | |||
| 1 | #[cfg(feature = "nightly")] | ||
| 2 | mod asynch; | 1 | mod asynch; |
| 3 | mod blocking; | 2 | mod blocking; |
| 4 | 3 | ||
| 5 | #[cfg(feature = "nightly")] | ||
| 6 | pub use asynch::{FirmwareState, FirmwareUpdater}; | 4 | pub use asynch::{FirmwareState, FirmwareUpdater}; |
| 7 | pub use blocking::{BlockingFirmwareState, BlockingFirmwareUpdater}; | 5 | pub use blocking::{BlockingFirmwareState, BlockingFirmwareUpdater}; |
| 8 | use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind}; | 6 | use embedded_storage::nor_flash::{NorFlashError, NorFlashErrorKind}; |
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs index 9f0356375..9e70a4dca 100644 --- a/embassy-boot/boot/src/lib.rs +++ b/embassy-boot/boot/src/lib.rs | |||
| @@ -1,6 +1,5 @@ | |||
| 1 | #![cfg_attr(feature = "nightly", feature(async_fn_in_trait))] | ||
| 2 | #![cfg_attr(feature = "nightly", allow(stable_features, unknown_lints, async_fn_in_trait))] | ||
| 3 | #![no_std] | 1 | #![no_std] |
| 2 | #![allow(async_fn_in_trait)] | ||
| 4 | #![warn(missing_docs)] | 3 | #![warn(missing_docs)] |
| 5 | #![doc = include_str!("../README.md")] | 4 | #![doc = include_str!("../README.md")] |
| 6 | mod fmt; | 5 | mod fmt; |
| @@ -18,10 +17,9 @@ mod test_flash; | |||
| 18 | pub(crate) const STATE_ERASE_VALUE: u8 = 0xFF; | 17 | pub(crate) const STATE_ERASE_VALUE: u8 = 0xFF; |
| 19 | pub use boot_loader::{BootError, BootLoader, BootLoaderConfig}; | 18 | pub use boot_loader::{BootError, BootLoader, BootLoaderConfig}; |
| 20 | pub use firmware_updater::{ | 19 | pub use firmware_updater::{ |
| 21 | BlockingFirmwareState, BlockingFirmwareUpdater, FirmwareUpdaterConfig, FirmwareUpdaterError, | 20 | BlockingFirmwareState, BlockingFirmwareUpdater, FirmwareState, FirmwareUpdater, FirmwareUpdaterConfig, |
| 21 | FirmwareUpdaterError, | ||
| 22 | }; | 22 | }; |
| 23 | #[cfg(feature = "nightly")] | ||
| 24 | pub use firmware_updater::{FirmwareState, FirmwareUpdater}; | ||
| 25 | 23 | ||
| 26 | pub(crate) const BOOT_MAGIC: u8 = 0xD0; | 24 | pub(crate) const BOOT_MAGIC: u8 = 0xD0; |
| 27 | pub(crate) const SWAP_MAGIC: u8 = 0xF0; | 25 | pub(crate) const SWAP_MAGIC: u8 = 0xF0; |
| @@ -57,7 +55,6 @@ mod tests { | |||
| 57 | #![allow(unused_imports)] | 55 | #![allow(unused_imports)] |
| 58 | 56 | ||
| 59 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; | 57 | use embedded_storage::nor_flash::{NorFlash, ReadNorFlash}; |
| 60 | #[cfg(feature = "nightly")] | ||
| 61 | use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; | 58 | use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; |
| 62 | use futures::executor::block_on; | 59 | use futures::executor::block_on; |
| 63 | 60 | ||
| @@ -65,9 +62,7 @@ mod tests { | |||
| 65 | use crate::boot_loader::BootLoaderConfig; | 62 | use crate::boot_loader::BootLoaderConfig; |
| 66 | use crate::firmware_updater::FirmwareUpdaterConfig; | 63 | use crate::firmware_updater::FirmwareUpdaterConfig; |
| 67 | use crate::mem_flash::MemFlash; | 64 | use crate::mem_flash::MemFlash; |
| 68 | #[cfg(feature = "nightly")] | 65 | use crate::test_flash::{AsyncTestFlash, BlockingTestFlash}; |
| 69 | use crate::test_flash::AsyncTestFlash; | ||
| 70 | use crate::test_flash::BlockingTestFlash; | ||
| 71 | 66 | ||
| 72 | /* | 67 | /* |
| 73 | #[test] | 68 | #[test] |
| @@ -105,7 +100,7 @@ mod tests { | |||
| 105 | } | 100 | } |
| 106 | 101 | ||
| 107 | #[test] | 102 | #[test] |
| 108 | #[cfg(all(feature = "nightly", not(feature = "_verify")))] | 103 | #[cfg(not(feature = "_verify"))] |
| 109 | fn test_swap_state() { | 104 | fn test_swap_state() { |
| 110 | const FIRMWARE_SIZE: usize = 57344; | 105 | const FIRMWARE_SIZE: usize = 57344; |
| 111 | let flash = AsyncTestFlash::new(BootLoaderConfig { | 106 | let flash = AsyncTestFlash::new(BootLoaderConfig { |
| @@ -183,7 +178,7 @@ mod tests { | |||
| 183 | } | 178 | } |
| 184 | 179 | ||
| 185 | #[test] | 180 | #[test] |
| 186 | #[cfg(all(feature = "nightly", not(feature = "_verify")))] | 181 | #[cfg(not(feature = "_verify"))] |
| 187 | fn test_swap_state_active_page_biggest() { | 182 | fn test_swap_state_active_page_biggest() { |
| 188 | const FIRMWARE_SIZE: usize = 12288; | 183 | const FIRMWARE_SIZE: usize = 12288; |
| 189 | let flash = AsyncTestFlash::new(BootLoaderConfig { | 184 | let flash = AsyncTestFlash::new(BootLoaderConfig { |
| @@ -228,7 +223,7 @@ mod tests { | |||
| 228 | } | 223 | } |
| 229 | 224 | ||
| 230 | #[test] | 225 | #[test] |
| 231 | #[cfg(all(feature = "nightly", not(feature = "_verify")))] | 226 | #[cfg(not(feature = "_verify"))] |
| 232 | fn test_swap_state_dfu_page_biggest() { | 227 | fn test_swap_state_dfu_page_biggest() { |
| 233 | const FIRMWARE_SIZE: usize = 12288; | 228 | const FIRMWARE_SIZE: usize = 12288; |
| 234 | let flash = AsyncTestFlash::new(BootLoaderConfig { | 229 | let flash = AsyncTestFlash::new(BootLoaderConfig { |
| @@ -272,7 +267,7 @@ mod tests { | |||
| 272 | } | 267 | } |
| 273 | 268 | ||
| 274 | #[test] | 269 | #[test] |
| 275 | #[cfg(all(feature = "nightly", feature = "_verify"))] | 270 | #[cfg(feature = "_verify")] |
| 276 | fn test_verify() { | 271 | fn test_verify() { |
| 277 | // The following key setup is based on: | 272 | // The following key setup is based on: |
| 278 | // https://docs.rs/ed25519-dalek/latest/ed25519_dalek/#example | 273 | // https://docs.rs/ed25519-dalek/latest/ed25519_dalek/#example |
diff --git a/embassy-boot/boot/src/mem_flash.rs b/embassy-boot/boot/src/mem_flash.rs index 2728e9720..40f352c8d 100644 --- a/embassy-boot/boot/src/mem_flash.rs +++ b/embassy-boot/boot/src/mem_flash.rs | |||
| @@ -3,7 +3,6 @@ | |||
| 3 | use core::ops::{Bound, Range, RangeBounds}; | 3 | use core::ops::{Bound, Range, RangeBounds}; |
| 4 | 4 | ||
| 5 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; | 5 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; |
| 6 | #[cfg(feature = "nightly")] | ||
| 7 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; | 6 | use embedded_storage_async::nor_flash::{NorFlash as AsyncNorFlash, ReadNorFlash as AsyncReadNorFlash}; |
| 8 | 7 | ||
| 9 | pub struct MemFlash<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> { | 8 | pub struct MemFlash<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> { |
| @@ -141,7 +140,6 @@ impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> NorFla | |||
| 141 | } | 140 | } |
| 142 | } | 141 | } |
| 143 | 142 | ||
| 144 | #[cfg(feature = "nightly")] | ||
| 145 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncReadNorFlash | 143 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncReadNorFlash |
| 146 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> | 144 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> |
| 147 | { | 145 | { |
| @@ -156,7 +154,6 @@ impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncR | |||
| 156 | } | 154 | } |
| 157 | } | 155 | } |
| 158 | 156 | ||
| 159 | #[cfg(feature = "nightly")] | ||
| 160 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncNorFlash | 157 | impl<const SIZE: usize, const ERASE_SIZE: usize, const WRITE_SIZE: usize> AsyncNorFlash |
| 161 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> | 158 | for MemFlash<SIZE, ERASE_SIZE, WRITE_SIZE> |
| 162 | { | 159 | { |
diff --git a/embassy-boot/boot/src/test_flash/blocking.rs b/embassy-boot/boot/src/test_flash/blocking.rs index ba33c9208..5ec476c65 100644 --- a/embassy-boot/boot/src/test_flash/blocking.rs +++ b/embassy-boot/boot/src/test_flash/blocking.rs | |||
| @@ -51,7 +51,6 @@ where | |||
| 51 | } | 51 | } |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | #[cfg(feature = "nightly")] | ||
| 55 | impl<ACTIVE, DFU, STATE> BlockingTestFlash<ACTIVE, DFU, STATE> | 54 | impl<ACTIVE, DFU, STATE> BlockingTestFlash<ACTIVE, DFU, STATE> |
| 56 | where | 55 | where |
| 57 | ACTIVE: NorFlash + embedded_storage_async::nor_flash::NorFlash, | 56 | ACTIVE: NorFlash + embedded_storage_async::nor_flash::NorFlash, |
diff --git a/embassy-boot/boot/src/test_flash/mod.rs b/embassy-boot/boot/src/test_flash/mod.rs index a0672322e..79b15a081 100644 --- a/embassy-boot/boot/src/test_flash/mod.rs +++ b/embassy-boot/boot/src/test_flash/mod.rs | |||
| @@ -1,7 +1,5 @@ | |||
| 1 | #[cfg(feature = "nightly")] | ||
| 2 | mod asynch; | 1 | mod asynch; |
| 3 | mod blocking; | 2 | mod blocking; |
| 4 | 3 | ||
| 5 | #[cfg(feature = "nightly")] | ||
| 6 | pub(crate) use asynch::AsyncTestFlash; | 4 | pub(crate) use asynch::AsyncTestFlash; |
| 7 | pub(crate) use blocking::BlockingTestFlash; | 5 | pub(crate) use blocking::BlockingTestFlash; |
