diff options
| author | Kaitlyn Kenwell <[email protected]> | 2023-12-14 09:36:22 -0500 |
|---|---|---|
| committer | Kaitlyn Kenwell <[email protected]> | 2023-12-14 09:36:22 -0500 |
| commit | e27e00f6280683293f427d0731aa69ca32dbbe60 (patch) | |
| tree | e238a3ed8fda1b7c89c27864b62d387786e75925 /embassy-boot/boot | |
| parent | b60b3f4eb8f22ecda1c30d63213010f1b6b47686 (diff) | |
Address reviews
Diffstat (limited to 'embassy-boot/boot')
| -rw-r--r-- | embassy-boot/boot/src/firmware_updater/asynch.rs | 10 | ||||
| -rw-r--r-- | embassy-boot/boot/src/firmware_updater/blocking.rs | 10 | ||||
| -rw-r--r-- | embassy-boot/boot/src/lib.rs | 2 |
3 files changed, 21 insertions, 1 deletions
diff --git a/embassy-boot/boot/src/firmware_updater/asynch.rs b/embassy-boot/boot/src/firmware_updater/asynch.rs index 82e99965b..d8d85c3d2 100644 --- a/embassy-boot/boot/src/firmware_updater/asynch.rs +++ b/embassy-boot/boot/src/firmware_updater/asynch.rs | |||
| @@ -213,6 +213,16 @@ pub struct FirmwareState<'d, STATE> { | |||
| 213 | } | 213 | } |
| 214 | 214 | ||
| 215 | impl<'d, STATE: NorFlash> FirmwareState<'d, STATE> { | 215 | impl<'d, STATE: NorFlash> FirmwareState<'d, STATE> { |
| 216 | /// Create a firmware state instance from a FirmwareUpdaterConfig with a buffer for magic content and state partition. | ||
| 217 | /// | ||
| 218 | /// # Safety | ||
| 219 | /// | ||
| 220 | /// The `aligned` buffer must have a size of STATE::WRITE_SIZE, and follow the alignment rules for the flash being read from | ||
| 221 | /// and written to. | ||
| 222 | pub fn from_config<DFU: NorFlash>(config: FirmwareUpdaterConfig<DFU, STATE>, aligned: &'d mut [u8]) -> Self { | ||
| 223 | Self::new(config.state, aligned) | ||
| 224 | } | ||
| 225 | |||
| 216 | /// Create a firmware state instance with a buffer for magic content and state partition. | 226 | /// Create a firmware state instance with a buffer for magic content and state partition. |
| 217 | /// | 227 | /// |
| 218 | /// # Safety | 228 | /// # Safety |
diff --git a/embassy-boot/boot/src/firmware_updater/blocking.rs b/embassy-boot/boot/src/firmware_updater/blocking.rs index ae4179ba3..4f56f152d 100644 --- a/embassy-boot/boot/src/firmware_updater/blocking.rs +++ b/embassy-boot/boot/src/firmware_updater/blocking.rs | |||
| @@ -219,6 +219,16 @@ pub struct BlockingFirmwareState<'d, STATE> { | |||
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | impl<'d, STATE: NorFlash> BlockingFirmwareState<'d, STATE> { | 221 | impl<'d, STATE: NorFlash> BlockingFirmwareState<'d, STATE> { |
| 222 | /// Creates a firmware state instance from a FirmwareUpdaterConfig, with a buffer for magic content and state partition. | ||
| 223 | /// | ||
| 224 | /// # Safety | ||
| 225 | /// | ||
| 226 | /// The `aligned` buffer must have a size of STATE::WRITE_SIZE, and follow the alignment rules for the flash being read from | ||
| 227 | /// and written to. | ||
| 228 | pub fn from_config<DFU: NorFlash>(config: FirmwareUpdaterConfig<DFU, STATE>, aligned: &'d mut [u8]) -> Self { | ||
| 229 | Self::new(config.state, aligned) | ||
| 230 | } | ||
| 231 | |||
| 222 | /// Create a firmware state instance with a buffer for magic content and state partition. | 232 | /// Create a firmware state instance with a buffer for magic content and state partition. |
| 223 | /// | 233 | /// |
| 224 | /// # Safety | 234 | /// # Safety |
diff --git a/embassy-boot/boot/src/lib.rs b/embassy-boot/boot/src/lib.rs index 451992945..15b69f69d 100644 --- a/embassy-boot/boot/src/lib.rs +++ b/embassy-boot/boot/src/lib.rs | |||
| @@ -33,7 +33,7 @@ pub enum State { | |||
| 33 | Boot, | 33 | Boot, |
| 34 | /// Bootloader has swapped the active partition with the dfu partition and will attempt boot. | 34 | /// Bootloader has swapped the active partition with the dfu partition and will attempt boot. |
| 35 | Swap, | 35 | Swap, |
| 36 | /// Application has received a DFU_DETACH request over USB, and is rebooting into the bootloader to apply a DFU. | 36 | /// Application has received a request to reboot into DFU mode to apply an update. |
| 37 | DfuDetach, | 37 | DfuDetach, |
| 38 | } | 38 | } |
| 39 | 39 | ||
