aboutsummaryrefslogtreecommitdiff
path: root/embassy-boot
diff options
context:
space:
mode:
authorchasingRs <[email protected]>2025-10-10 10:26:46 +0800
committerGitHub <[email protected]>2025-10-10 10:26:46 +0800
commit944fda48a94c2d6cb6bea56c8c8471858d75da7d (patch)
tree1e3e2f463c2440afe81ca37b2e161f85d0bfc374 /embassy-boot
parent04171d903d3676d87aa0fd85719878d3087028f3 (diff)
parent35b0ba4ce0fed7588febe504e16bbf1788384f5a (diff)
Merge branch 'embassy-rs:main' into fix/simple-pwm-32bit-timer-support
Diffstat (limited to 'embassy-boot')
-rw-r--r--embassy-boot/Cargo.toml2
-rw-r--r--embassy-boot/src/boot_loader.rs6
-rw-r--r--embassy-boot/src/firmware_updater/asynch.rs4
-rw-r--r--embassy-boot/src/firmware_updater/blocking.rs6
-rw-r--r--embassy-boot/src/lib.rs15
-rw-r--r--embassy-boot/src/test_flash/blocking.rs2
6 files changed, 19 insertions, 16 deletions
diff --git a/embassy-boot/Cargo.toml b/embassy-boot/Cargo.toml
index a18438c81..8c5c1f633 100644
--- a/embassy-boot/Cargo.toml
+++ b/embassy-boot/Cargo.toml
@@ -1,5 +1,5 @@
1[package] 1[package]
2edition = "2021" 2edition = "2024"
3name = "embassy-boot" 3name = "embassy-boot"
4version = "0.6.1" 4version = "0.6.1"
5description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks." 5description = "A lightweight bootloader supporting firmware updates in a power-fail-safe way, with trial boots and rollbacks."
diff --git a/embassy-boot/src/boot_loader.rs b/embassy-boot/src/boot_loader.rs
index 5bffdc5ea..c38940d6e 100644
--- a/embassy-boot/src/boot_loader.rs
+++ b/embassy-boot/src/boot_loader.rs
@@ -1,11 +1,11 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2 2
3use embassy_embedded_hal::flash::partition::BlockingPartition; 3use embassy_embedded_hal::flash::partition::BlockingPartition;
4use embassy_sync::blocking_mutex::raw::NoopRawMutex;
5use embassy_sync::blocking_mutex::Mutex; 4use embassy_sync::blocking_mutex::Mutex;
5use embassy_sync::blocking_mutex::raw::NoopRawMutex;
6use embedded_storage::nor_flash::{NorFlash, NorFlashError, NorFlashErrorKind}; 6use embedded_storage::nor_flash::{NorFlash, NorFlashError, NorFlashErrorKind};
7 7
8use crate::{State, DFU_DETACH_MAGIC, REVERT_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; 8use crate::{DFU_DETACH_MAGIC, REVERT_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC, State};
9 9
10/// Errors returned by bootloader 10/// Errors returned by bootloader
11#[derive(PartialEq, Eq, Debug)] 11#[derive(PartialEq, Eq, Debug)]
@@ -94,7 +94,7 @@ impl<'a, ACTIVE: NorFlash, DFU: NorFlash, STATE: NorFlash>
94 dfu_flash: &'a Mutex<NoopRawMutex, RefCell<DFU>>, 94 dfu_flash: &'a Mutex<NoopRawMutex, RefCell<DFU>>,
95 state_flash: &'a Mutex<NoopRawMutex, RefCell<STATE>>, 95 state_flash: &'a Mutex<NoopRawMutex, RefCell<STATE>>,
96 ) -> Self { 96 ) -> Self {
97 extern "C" { 97 unsafe extern "C" {
98 static __bootloader_state_start: u32; 98 static __bootloader_state_start: u32;
99 static __bootloader_state_end: u32; 99 static __bootloader_state_end: u32;
100 static __bootloader_active_start: u32; 100 static __bootloader_active_start: u32;
diff --git a/embassy-boot/src/firmware_updater/asynch.rs b/embassy-boot/src/firmware_updater/asynch.rs
index 66e311e38..26d4d39bd 100644
--- a/embassy-boot/src/firmware_updater/asynch.rs
+++ b/embassy-boot/src/firmware_updater/asynch.rs
@@ -6,7 +6,7 @@ use embassy_sync::blocking_mutex::raw::NoopRawMutex;
6use embedded_storage_async::nor_flash::NorFlash; 6use embedded_storage_async::nor_flash::NorFlash;
7 7
8use super::FirmwareUpdaterConfig; 8use super::FirmwareUpdaterConfig;
9use crate::{FirmwareUpdaterError, State, BOOT_MAGIC, DFU_DETACH_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; 9use crate::{BOOT_MAGIC, DFU_DETACH_MAGIC, FirmwareUpdaterError, STATE_ERASE_VALUE, SWAP_MAGIC, State};
10 10
11/// FirmwareUpdater is an application API for interacting with the BootLoader without the ability to 11/// FirmwareUpdater is an application API for interacting with the BootLoader without the ability to
12/// 'mess up' the internal bootloader state 12/// 'mess up' the internal bootloader state
@@ -25,7 +25,7 @@ impl<'a, DFU: NorFlash, STATE: NorFlash>
25 dfu_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, DFU>, 25 dfu_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, DFU>,
26 state_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, STATE>, 26 state_flash: &'a embassy_sync::mutex::Mutex<NoopRawMutex, STATE>,
27 ) -> Self { 27 ) -> Self {
28 extern "C" { 28 unsafe extern "C" {
29 static __bootloader_state_start: u32; 29 static __bootloader_state_start: u32;
30 static __bootloader_state_end: u32; 30 static __bootloader_state_end: u32;
31 static __bootloader_dfu_start: u32; 31 static __bootloader_dfu_start: u32;
diff --git a/embassy-boot/src/firmware_updater/blocking.rs b/embassy-boot/src/firmware_updater/blocking.rs
index 0fedac1ea..5554025fc 100644
--- a/embassy-boot/src/firmware_updater/blocking.rs
+++ b/embassy-boot/src/firmware_updater/blocking.rs
@@ -6,7 +6,7 @@ use embassy_sync::blocking_mutex::raw::NoopRawMutex;
6use embedded_storage::nor_flash::NorFlash; 6use embedded_storage::nor_flash::NorFlash;
7 7
8use super::FirmwareUpdaterConfig; 8use super::FirmwareUpdaterConfig;
9use crate::{FirmwareUpdaterError, State, BOOT_MAGIC, DFU_DETACH_MAGIC, STATE_ERASE_VALUE, SWAP_MAGIC}; 9use crate::{BOOT_MAGIC, DFU_DETACH_MAGIC, FirmwareUpdaterError, STATE_ERASE_VALUE, SWAP_MAGIC, State};
10 10
11/// Blocking FirmwareUpdater is an application API for interacting with the BootLoader without the ability to 11/// Blocking FirmwareUpdater is an application API for interacting with the BootLoader without the ability to
12/// 'mess up' the internal bootloader state 12/// 'mess up' the internal bootloader state
@@ -55,7 +55,7 @@ impl<'a, DFU: NorFlash, STATE: NorFlash>
55 dfu_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<DFU>>, 55 dfu_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<DFU>>,
56 state_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<STATE>>, 56 state_flash: &'a embassy_sync::blocking_mutex::Mutex<NoopRawMutex, core::cell::RefCell<STATE>>,
57 ) -> Self { 57 ) -> Self {
58 extern "C" { 58 unsafe extern "C" {
59 static __bootloader_state_start: u32; 59 static __bootloader_state_start: u32;
60 static __bootloader_state_end: u32; 60 static __bootloader_state_end: u32;
61 static __bootloader_dfu_start: u32; 61 static __bootloader_dfu_start: u32;
@@ -399,8 +399,8 @@ mod tests {
399 use core::cell::RefCell; 399 use core::cell::RefCell;
400 400
401 use embassy_embedded_hal::flash::partition::BlockingPartition; 401 use embassy_embedded_hal::flash::partition::BlockingPartition;
402 use embassy_sync::blocking_mutex::raw::NoopRawMutex;
403 use embassy_sync::blocking_mutex::Mutex; 402 use embassy_sync::blocking_mutex::Mutex;
403 use embassy_sync::blocking_mutex::raw::NoopRawMutex;
404 use sha1::{Digest, Sha1}; 404 use sha1::{Digest, Sha1};
405 405
406 use super::*; 406 use super::*;
diff --git a/embassy-boot/src/lib.rs b/embassy-boot/src/lib.rs
index e2c4cf771..7dc811f66 100644
--- a/embassy-boot/src/lib.rs
+++ b/embassy-boot/src/lib.rs
@@ -1,5 +1,6 @@
1#![no_std] 1#![no_std]
2#![allow(async_fn_in_trait)] 2#![allow(async_fn_in_trait)]
3#![allow(unsafe_op_in_unsafe_fn)]
3#![warn(missing_docs)] 4#![warn(missing_docs)]
4#![doc = include_str!("../README.md")] 5#![doc = include_str!("../README.md")]
5mod fmt; 6mod fmt;
@@ -341,11 +342,13 @@ mod tests {
341 &mut aligned, 342 &mut aligned,
342 ); 343 );
343 344
344 assert!(block_on(updater.verify_and_mark_updated( 345 assert!(
345 &public_key.to_bytes(), 346 block_on(updater.verify_and_mark_updated(
346 &signature.to_bytes(), 347 &public_key.to_bytes(),
347 firmware_len as u32, 348 &signature.to_bytes(),
348 )) 349 firmware_len as u32,
349 .is_ok()); 350 ))
351 .is_ok()
352 );
350 } 353 }
351} 354}
diff --git a/embassy-boot/src/test_flash/blocking.rs b/embassy-boot/src/test_flash/blocking.rs
index 5ec476c65..7334346fd 100644
--- a/embassy-boot/src/test_flash/blocking.rs
+++ b/embassy-boot/src/test_flash/blocking.rs
@@ -1,8 +1,8 @@
1use core::cell::RefCell; 1use core::cell::RefCell;
2 2
3use embassy_embedded_hal::flash::partition::BlockingPartition; 3use embassy_embedded_hal::flash::partition::BlockingPartition;
4use embassy_sync::blocking_mutex::raw::NoopRawMutex;
5use embassy_sync::blocking_mutex::Mutex; 4use embassy_sync::blocking_mutex::Mutex;
5use embassy_sync::blocking_mutex::raw::NoopRawMutex;
6use embedded_storage::nor_flash::NorFlash; 6use embedded_storage::nor_flash::NorFlash;
7 7
8use crate::BootLoaderConfig; 8use crate::BootLoaderConfig;