QUERY · ISSUE
ESP32-OTA: Partition.writeblocks with buffer size not multiple of blocksize gives OSError
port-esp32
Hey,
Just realized, that writing data into partition with a data buffer with size != 0 mod BLOCK_SIZE leads to an OSError: -260.
It is due to the erase call esp_partition_erase_range(self->part, offset, bufinfo.len) in
esp32_partition_writeblocks.
I am not sure if this is intended behavior. If not, I would recommend either to return a proper error message or to erase ceil(buffer_size/BLOCK_SIZE) blocks.
CANDIDATE · PULL REQUEST
esp32: fix Partition.writeblocks partial write corruption
port-esp32
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.