diff --git a/embassy-boot/boot/Cargo.toml b/embassy-boot/boot/Cargo.toml index 3312c2f9..04409cdc 100644 --- a/embassy-boot/boot/Cargo.toml +++ b/embassy-boot/boot/Cargo.toml @@ -28,7 +28,7 @@ log = { version = "0.4", optional = true } ed25519-dalek = { version = "1.0.1", default_features = false, features = ["u32_backend"], optional = true } embassy-sync = { version = "0.1.0", path = "../../embassy-sync" } embedded-storage = "0.3.0" -embedded-storage-async = "0.4.0" +embedded-storage-async = { version = "0.4.0", optional = true} salty = { git = "https://github.com/ycrypto/salty.git", rev = "a9f17911a5024698406b75c0fac56ab5ccf6a8c7", optional = true } signature = { version = "1.6.4", default-features = false } @@ -43,8 +43,11 @@ default_features = false features = ["rand", "std", "u32_backend"] [features] +default = ["nightly"] ed25519-dalek = ["dep:ed25519-dalek", "_verify"] ed25519-salty = ["dep:salty", "_verify"] +nightly = ["dep:embedded-storage-async"] + #Internal features _verify = [] \ No newline at end of file diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs index 0df44f36..7ce0c664 100644 --- a/embassy-boot/boot/src/lib.rs +++ b/embassy-boot/boot/src/lib.rs @@ -1,4 +1,4 @@ -#![feature(async_fn_in_trait)] +#![cfg_attr(feature = "nightly", feature(async_fn_in_trait))] #![allow(incomplete_features)] #![no_std] #![warn(missing_docs)] @@ -6,6 +6,8 @@ mod fmt; use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; + +#[cfg(feature = "nightly")] use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; const BOOT_MAGIC: u8 = 0xD0; @@ -647,6 +649,7 @@ impl FirmwareUpdater { /// This is useful to check if the bootloader has just done a swap, in order /// to do verifications and self-tests of the new image before calling /// `mark_booted`. + #[cfg(feature = "nightly")] pub async fn get_state( &mut self, flash: &mut F, @@ -776,6 +779,7 @@ impl FirmwareUpdater { /// /// The `aligned` buffer must have a size of F::WRITE_SIZE, and follow the alignment rules for the flash being written to. #[cfg(not(feature = "_verify"))] + #[cfg(feature = "nightly")] pub async fn mark_updated( &mut self, flash: &mut F, @@ -790,6 +794,7 @@ impl FirmwareUpdater { /// # Safety /// /// The `aligned` buffer must have a size of F::WRITE_SIZE, and follow the alignment rules for the flash being written to. + #[cfg(feature = "nightly")] pub async fn mark_booted( &mut self, flash: &mut F, @@ -799,6 +804,7 @@ impl FirmwareUpdater { self.set_magic(aligned, BOOT_MAGIC, flash).await } + #[cfg(feature = "nightly")] async fn set_magic( &mut self, aligned: &mut [u8], @@ -826,6 +832,7 @@ impl FirmwareUpdater { /// # Safety /// /// Failing to meet alignment and size requirements may result in a panic. + #[cfg(feature = "nightly")] pub async fn write_firmware( &mut self, offset: usize, @@ -860,6 +867,7 @@ impl FirmwareUpdater { /// /// Using this instead of `write_firmware` allows for an optimized API in /// exchange for added complexity. + #[cfg(feature = "nightly")] pub async fn prepare_update( &mut self, flash: &mut F, @@ -1112,6 +1120,7 @@ impl FirmwareWriter { /// # Safety /// /// Failing to meet alignment and size requirements may result in a panic. + #[cfg(feature = "nightly")] pub async fn write_block( &mut self, offset: usize, diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml index c1a12751..90a36d01 100644 --- a/embassy-boot/nrf/Cargo.toml +++ b/embassy-boot/nrf/Cargo.toml @@ -17,17 +17,18 @@ target = "thumbv7em-none-eabi" defmt = { version = "0.3", optional = true } embassy-sync = { path = "../../embassy-sync" } -embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] } +embassy-nrf = { path = "../../embassy-nrf", default-features = false } embassy-boot = { path = "../boot", default-features = false } cortex-m = { version = "0.7.6" } cortex-m-rt = { version = "0.7" } embedded-storage = "0.3.0" -embedded-storage-async = "0.4.0" +embedded-storage-async = { version = "0.4.0", optional = true } cfg-if = "1.0.0" nrf-softdevice-mbr = { version = "0.1.0", git = "https://github.com/embassy-rs/nrf-softdevice.git", branch = "master", optional = true } [features] +default = ["nightly"] defmt = [ "dep:defmt", "embassy-boot/defmt", @@ -36,3 +37,4 @@ defmt = [ softdevice = [ "nrf-softdevice-mbr", ] +nightly = ["dep:embedded-storage-async", "embassy-boot/nightly", "embassy-nrf/nightly"] diff --git a/embassy-boot/nrf/src/lib.rs b/embassy-boot/nrf/src/lib.rs index f40ae62d..5cc6ba44 100644 --- a/embassy-boot/nrf/src/lib.rs +++ b/embassy-boot/nrf/src/lib.rs @@ -1,5 +1,5 @@ #![no_std] -#![feature(type_alias_impl_trait)] +#![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))] #![warn(missing_docs)] #![doc = include_str!("../README.md")] mod fmt;