[ESP32 Docs]: Partition readblocks / writeblocks extended
The Partition class docs are a bit misleading, if i am right.
These methods implement the simple and extended block protocol defined by uos.AbstractBlockDev.
But the source code of the Partition class is using an internal calculated offset so atm there is just the simple protocol:
STATIC mp_obj_t esp32_partition_readblocks(mp_obj_t self_in, mp_obj_t block_num, mp_obj_t buf_in) { esp32_partition_obj_t *self = MP_OBJ_TO_PTR(self_in); uint32_t offset = mp_obj_get_int(block_num) * BLOCK_SIZE_BYTES; mp_buffer_info_t bufinfo; mp_get_buffer_raise(buf_in, &bufinfo, MP_BUFFER_WRITE); check_esp_err(esp_partition_read(self->part, offset, bufinfo.buf, bufinfo.len)); return mp_const_none; }
Please correct me if I am wrong.
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.