mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
esp32: Fix Partition.writeblocks() partial write corruption.
To simulate a partial erase, the code reads a native block, erases it, and writes back the data before and after the erased area. However, the current logic was filling the area after the erased block with data from the beginning of the native block-aligned data, instead of applying the proper offset. Fixes #12474. Signed-off-by: Luca Burelli <l.burelli@arduino.cc>
This commit is contained in:
@@ -200,7 +200,7 @@ STATIC mp_obj_t esp32_partition_writeblocks(size_t n_args, const mp_obj_t *args)
|
||||
check_esp_err(esp_partition_write(self->part, addr, self->cache, o));
|
||||
}
|
||||
if (top_addr < addr + NATIVE_BLOCK_SIZE_BYTES) {
|
||||
check_esp_err(esp_partition_write(self->part, top_addr, self->cache, addr + NATIVE_BLOCK_SIZE_BYTES - top_addr));
|
||||
check_esp_err(esp_partition_write(self->part, top_addr, self->cache + (top_addr - addr), addr + NATIVE_BLOCK_SIZE_BYTES - top_addr));
|
||||
}
|
||||
o = 0;
|
||||
addr += NATIVE_BLOCK_SIZE_BYTES;
|
||||
|
||||
Reference in New Issue
Block a user