← index #5596Issue #5913
Related · high · value 1.074
QUERY · ISSUE

[ESP32 Docs]: Partition readblocks / writeblocks extended

openby mrwhy-origopened 2020-01-31updated 2024-10-01
docsneeds-info

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.

CANDIDATE · ISSUE

ESP32-OTA: Partition.writeblocks with buffer size not multiple of blocksize gives OSError

openby chtinnesopened 2020-04-12updated 2024-01-10
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.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied