diff options
| author | sander <[email protected]> | 2023-03-22 16:49:49 +0100 |
|---|---|---|
| committer | sander <[email protected]> | 2023-03-22 16:49:49 +0100 |
| commit | ba9afbc26d06ab38065cbff5b17a7f76db297ad4 (patch) | |
| tree | 4444e14e287d60d69a0153415d0186be05588e02 /embassy-boot | |
| parent | aa77a06d58a02340b455888a113287d8cac05973 (diff) | |
embassy-boot: add default nightly feature, makes it possible to compile with the stable compiler
Diffstat (limited to 'embassy-boot')
| -rw-r--r-- | embassy-boot/boot/Cargo.toml | 5 | ||||
| -rw-r--r-- | embassy-boot/boot/src/lib.rs | 11 | ||||
| -rw-r--r-- | embassy-boot/nrf/Cargo.toml | 6 | ||||
| -rw-r--r-- | embassy-boot/nrf/src/lib.rs | 2 |
4 files changed, 19 insertions, 5 deletions
diff --git a/embassy-boot/boot/Cargo.toml b/embassy-boot/boot/Cargo.toml index 3312c2f9f..04409cdc7 100644 --- a/embassy-boot/boot/Cargo.toml +++ b/embassy-boot/boot/Cargo.toml | |||
| @@ -28,7 +28,7 @@ log = { version = "0.4", optional = true } | |||
| 28 | ed25519-dalek = { version = "1.0.1", default_features = false, features = ["u32_backend"], optional = true } | 28 | ed25519-dalek = { version = "1.0.1", default_features = false, features = ["u32_backend"], optional = true } |
| 29 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync" } | 29 | embassy-sync = { version = "0.1.0", path = "../../embassy-sync" } |
| 30 | embedded-storage = "0.3.0" | 30 | embedded-storage = "0.3.0" |
| 31 | embedded-storage-async = "0.4.0" | 31 | embedded-storage-async = { version = "0.4.0", optional = true} |
| 32 | salty = { git = "https://github.com/ycrypto/salty.git", rev = "a9f17911a5024698406b75c0fac56ab5ccf6a8c7", optional = true } | 32 | salty = { git = "https://github.com/ycrypto/salty.git", rev = "a9f17911a5024698406b75c0fac56ab5ccf6a8c7", optional = true } |
| 33 | signature = { version = "1.6.4", default-features = false } | 33 | signature = { version = "1.6.4", default-features = false } |
| 34 | 34 | ||
| @@ -43,8 +43,11 @@ default_features = false | |||
| 43 | features = ["rand", "std", "u32_backend"] | 43 | features = ["rand", "std", "u32_backend"] |
| 44 | 44 | ||
| 45 | [features] | 45 | [features] |
| 46 | default = ["nightly"] | ||
| 46 | ed25519-dalek = ["dep:ed25519-dalek", "_verify"] | 47 | ed25519-dalek = ["dep:ed25519-dalek", "_verify"] |
| 47 | ed25519-salty = ["dep:salty", "_verify"] | 48 | ed25519-salty = ["dep:salty", "_verify"] |
| 48 | 49 | ||
| 50 | nightly = ["dep:embedded-storage-async"] | ||
| 51 | |||
| 49 | #Internal features | 52 | #Internal features |
| 50 | _verify = [] \ No newline at end of file | 53 | _verify = [] \ No newline at end of file |
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs index 0df44f36e..7ce0c664a 100644 --- a/embassy-boot/boot/src/lib.rs +++ b/embassy-boot/boot/src/lib.rs | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | #![feature(async_fn_in_trait)] | 1 | #![cfg_attr(feature = "nightly", feature(async_fn_in_trait))] |
| 2 | #![allow(incomplete_features)] | 2 | #![allow(incomplete_features)] |
| 3 | #![no_std] | 3 | #![no_std] |
| 4 | #![warn(missing_docs)] | 4 | #![warn(missing_docs)] |
| @@ -6,6 +6,8 @@ | |||
| 6 | mod fmt; | 6 | mod fmt; |
| 7 | 7 | ||
| 8 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; | 8 | use embedded_storage::nor_flash::{ErrorType, NorFlash, NorFlashError, NorFlashErrorKind, ReadNorFlash}; |
| 9 | |||
| 10 | #[cfg(feature = "nightly")] | ||
| 9 | use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; | 11 | use embedded_storage_async::nor_flash::NorFlash as AsyncNorFlash; |
| 10 | 12 | ||
| 11 | const BOOT_MAGIC: u8 = 0xD0; | 13 | const BOOT_MAGIC: u8 = 0xD0; |
| @@ -647,6 +649,7 @@ impl FirmwareUpdater { | |||
| 647 | /// This is useful to check if the bootloader has just done a swap, in order | 649 | /// This is useful to check if the bootloader has just done a swap, in order |
| 648 | /// to do verifications and self-tests of the new image before calling | 650 | /// to do verifications and self-tests of the new image before calling |
| 649 | /// `mark_booted`. | 651 | /// `mark_booted`. |
| 652 | #[cfg(feature = "nightly")] | ||
| 650 | pub async fn get_state<F: AsyncNorFlash>( | 653 | pub async fn get_state<F: AsyncNorFlash>( |
| 651 | &mut self, | 654 | &mut self, |
| 652 | flash: &mut F, | 655 | flash: &mut F, |
| @@ -776,6 +779,7 @@ impl FirmwareUpdater { | |||
| 776 | /// | 779 | /// |
| 777 | /// The `aligned` buffer must have a size of F::WRITE_SIZE, and follow the alignment rules for the flash being written to. | 780 | /// The `aligned` buffer must have a size of F::WRITE_SIZE, and follow the alignment rules for the flash being written to. |
| 778 | #[cfg(not(feature = "_verify"))] | 781 | #[cfg(not(feature = "_verify"))] |
| 782 | #[cfg(feature = "nightly")] | ||
| 779 | pub async fn mark_updated<F: AsyncNorFlash>( | 783 | pub async fn mark_updated<F: AsyncNorFlash>( |
| 780 | &mut self, | 784 | &mut self, |
| 781 | flash: &mut F, | 785 | flash: &mut F, |
| @@ -790,6 +794,7 @@ impl FirmwareUpdater { | |||
| 790 | /// # Safety | 794 | /// # Safety |
| 791 | /// | 795 | /// |
| 792 | /// The `aligned` buffer must have a size of F::WRITE_SIZE, and follow the alignment rules for the flash being written to. | 796 | /// The `aligned` buffer must have a size of F::WRITE_SIZE, and follow the alignment rules for the flash being written to. |
| 797 | #[cfg(feature = "nightly")] | ||
| 793 | pub async fn mark_booted<F: AsyncNorFlash>( | 798 | pub async fn mark_booted<F: AsyncNorFlash>( |
| 794 | &mut self, | 799 | &mut self, |
| 795 | flash: &mut F, | 800 | flash: &mut F, |
| @@ -799,6 +804,7 @@ impl FirmwareUpdater { | |||
| 799 | self.set_magic(aligned, BOOT_MAGIC, flash).await | 804 | self.set_magic(aligned, BOOT_MAGIC, flash).await |
| 800 | } | 805 | } |
| 801 | 806 | ||
| 807 | #[cfg(feature = "nightly")] | ||
| 802 | async fn set_magic<F: AsyncNorFlash>( | 808 | async fn set_magic<F: AsyncNorFlash>( |
| 803 | &mut self, | 809 | &mut self, |
| 804 | aligned: &mut [u8], | 810 | aligned: &mut [u8], |
| @@ -826,6 +832,7 @@ impl FirmwareUpdater { | |||
| 826 | /// # Safety | 832 | /// # Safety |
| 827 | /// | 833 | /// |
| 828 | /// Failing to meet alignment and size requirements may result in a panic. | 834 | /// Failing to meet alignment and size requirements may result in a panic. |
| 835 | #[cfg(feature = "nightly")] | ||
| 829 | pub async fn write_firmware<F: AsyncNorFlash>( | 836 | pub async fn write_firmware<F: AsyncNorFlash>( |
| 830 | &mut self, | 837 | &mut self, |
| 831 | offset: usize, | 838 | offset: usize, |
| @@ -860,6 +867,7 @@ impl FirmwareUpdater { | |||
| 860 | /// | 867 | /// |
| 861 | /// Using this instead of `write_firmware` allows for an optimized API in | 868 | /// Using this instead of `write_firmware` allows for an optimized API in |
| 862 | /// exchange for added complexity. | 869 | /// exchange for added complexity. |
| 870 | #[cfg(feature = "nightly")] | ||
| 863 | pub async fn prepare_update<F: AsyncNorFlash>( | 871 | pub async fn prepare_update<F: AsyncNorFlash>( |
| 864 | &mut self, | 872 | &mut self, |
| 865 | flash: &mut F, | 873 | flash: &mut F, |
| @@ -1112,6 +1120,7 @@ impl FirmwareWriter { | |||
| 1112 | /// # Safety | 1120 | /// # Safety |
| 1113 | /// | 1121 | /// |
| 1114 | /// Failing to meet alignment and size requirements may result in a panic. | 1122 | /// Failing to meet alignment and size requirements may result in a panic. |
| 1123 | #[cfg(feature = "nightly")] | ||
| 1115 | pub async fn write_block<F: AsyncNorFlash>( | 1124 | pub async fn write_block<F: AsyncNorFlash>( |
| 1116 | &mut self, | 1125 | &mut self, |
| 1117 | offset: usize, | 1126 | offset: usize, |
diff --git a/embassy-boot/nrf/Cargo.toml b/embassy-boot/nrf/Cargo.toml index c1a127518..90a36d014 100644 --- a/embassy-boot/nrf/Cargo.toml +++ b/embassy-boot/nrf/Cargo.toml | |||
| @@ -17,17 +17,18 @@ target = "thumbv7em-none-eabi" | |||
| 17 | defmt = { version = "0.3", optional = true } | 17 | defmt = { version = "0.3", optional = true } |
| 18 | 18 | ||
| 19 | embassy-sync = { path = "../../embassy-sync" } | 19 | embassy-sync = { path = "../../embassy-sync" } |
| 20 | embassy-nrf = { path = "../../embassy-nrf", default-features = false, features = ["nightly"] } | 20 | embassy-nrf = { path = "../../embassy-nrf", default-features = false } |
| 21 | embassy-boot = { path = "../boot", default-features = false } | 21 | embassy-boot = { path = "../boot", default-features = false } |
| 22 | cortex-m = { version = "0.7.6" } | 22 | cortex-m = { version = "0.7.6" } |
| 23 | cortex-m-rt = { version = "0.7" } | 23 | cortex-m-rt = { version = "0.7" } |
| 24 | embedded-storage = "0.3.0" | 24 | embedded-storage = "0.3.0" |
| 25 | embedded-storage-async = "0.4.0" | 25 | embedded-storage-async = { version = "0.4.0", optional = true } |
| 26 | cfg-if = "1.0.0" | 26 | cfg-if = "1.0.0" |
| 27 | 27 | ||
| 28 | nrf-softdevice-mbr = { version = "0.1.0", git = "https://github.com/embassy-rs/nrf-softdevice.git", branch = "master", optional = true } | 28 | nrf-softdevice-mbr = { version = "0.1.0", git = "https://github.com/embassy-rs/nrf-softdevice.git", branch = "master", optional = true } |
| 29 | 29 | ||
| 30 | [features] | 30 | [features] |
| 31 | default = ["nightly"] | ||
| 31 | defmt = [ | 32 | defmt = [ |
| 32 | "dep:defmt", | 33 | "dep:defmt", |
| 33 | "embassy-boot/defmt", | 34 | "embassy-boot/defmt", |
| @@ -36,3 +37,4 @@ defmt = [ | |||
| 36 | softdevice = [ | 37 | softdevice = [ |
| 37 | "nrf-softdevice-mbr", | 38 | "nrf-softdevice-mbr", |
| 38 | ] | 39 | ] |
| 40 | 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 f40ae62d6..5cc6ba448 100644 --- a/embassy-boot/nrf/src/lib.rs +++ b/embassy-boot/nrf/src/lib.rs | |||
| @@ -1,5 +1,5 @@ | |||
| 1 | #![no_std] | 1 | #![no_std] |
| 2 | #![feature(type_alias_impl_trait)] | 2 | #![cfg_attr(feature = "nightly", feature(type_alias_impl_trait))] |
| 3 | #![warn(missing_docs)] | 3 | #![warn(missing_docs)] |
| 4 | #![doc = include_str!("../README.md")] | 4 | #![doc = include_str!("../README.md")] |
| 5 | mod fmt; | 5 | mod fmt; |
