embassy-boot: add default nightly feature, makes it possible to compile with the stable compiler

This commit is contained in:
sander 2023-03-22 16:49:49 +01:00
parent aa77a06d58
commit ba9afbc26d
4 changed files with 19 additions and 5 deletions

View File

@ -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 = []

View File

@ -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<F: AsyncNorFlash>(
&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<F: AsyncNorFlash>(
&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<F: AsyncNorFlash>(
&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<F: AsyncNorFlash>(
&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<F: AsyncNorFlash>(
&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<F: AsyncNorFlash>(
&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<F: AsyncNorFlash>(
&mut self,
offset: usize,

View File

@ -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"]

View File

@ -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;