diff options
| author | Badr Bouslikhin <[email protected]> | 2024-02-11 19:37:48 +0100 |
|---|---|---|
| committer | Badr Bouslikhin <[email protected]> | 2024-02-11 19:38:15 +0100 |
| commit | 8f7d80f9f71e55ffe97b72dbb361409aee003ea4 (patch) | |
| tree | 5cced0166db2339f019d1af9deab3cc63fb85a35 /embassy-boot | |
| parent | 2a09996a789af11951131081f0288ddd8b39b126 (diff) | |
Revert "feat(boot): introduce non-erase flash write method "
This reverts commit 2e8b7d259057a0cf345396b250cacfc04a0e64a0.
Diffstat (limited to 'embassy-boot')
| -rw-r--r-- | embassy-boot/src/firmware_updater/blocking.rs | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/embassy-boot/src/firmware_updater/blocking.rs b/embassy-boot/src/firmware_updater/blocking.rs index 3e83366af..4044871f0 100644 --- a/embassy-boot/src/firmware_updater/blocking.rs +++ b/embassy-boot/src/firmware_updater/blocking.rs | |||
| @@ -225,41 +225,6 @@ impl<'d, DFU: NorFlash, STATE: NorFlash> BlockingFirmwareUpdater<'d, DFU, STATE> | |||
| 225 | Ok(()) | 225 | Ok(()) |
| 226 | } | 226 | } |
| 227 | 227 | ||
| 228 | /// Write data directly to a flash page without erasing it first. | ||
| 229 | /// | ||
| 230 | /// This function writes the provided data to the specified offset in the flash memory, | ||
| 231 | /// without performing an erase operation beforehand. It is crucial that the area being | ||
| 232 | /// written to is either already erased. | ||
| 233 | /// This method is intended to be used in conjunction with the `prepare_update` method. | ||
| 234 | /// | ||
| 235 | /// The buffer must follow the alignment requirements of the target flash and be a multiple of | ||
| 236 | /// the page size. This is essential to ensure data integrity and prevent corruption. | ||
| 237 | /// | ||
| 238 | /// # Safety | ||
| 239 | /// | ||
| 240 | /// This function requires careful management of the memory being written to. Writing to a | ||
| 241 | /// non-erased page or not adhering to alignment and size requirements may result in a panic. | ||
| 242 | /// | ||
| 243 | /// Ensure that the data being written is compatible with the current contents of the flash | ||
| 244 | /// memory, as no erase operation will be performed to reset the page content to a default state. | ||
| 245 | /// | ||
| 246 | /// # Parameters | ||
| 247 | /// | ||
| 248 | /// - `offset`: The offset within the DFU partition where the data will be written. Must be | ||
| 249 | /// aligned according to the flash's requirements and within the writable memory range. | ||
| 250 | /// - `data`: A reference to the slice of bytes to be written. The length of the data must not | ||
| 251 | /// exceed the partition size and must follow the flash's alignment requirements. | ||
| 252 | /// | ||
| 253 | /// # Returns | ||
| 254 | /// | ||
| 255 | /// A result indicating the success or failure of the write operation. On success, returns `Ok(())`. | ||
| 256 | /// On failure, returns an `Err` with a `FirmwareUpdaterError` detailing the cause of the failure. | ||
| 257 | pub fn write_firmware_without_erase(&mut self, offset: usize, data: &[u8]) -> Result<(), FirmwareUpdaterError> { | ||
| 258 | self.dfu.write(offset as u32, data)?; | ||
| 259 | |||
| 260 | Ok(()) | ||
| 261 | } | ||
| 262 | |||
| 263 | /// Prepare for an incoming DFU update by erasing the entire DFU area and | 228 | /// Prepare for an incoming DFU update by erasing the entire DFU area and |
| 264 | /// returning its `Partition`. | 229 | /// returning its `Partition`. |
| 265 | /// | 230 | /// |
