nrf/modules: Fix access of read-only buffer in Flash.writeblocks.
When writing to flash, the source buffer only needs to be read-only, not writable. This fix allows passing in `bytes` and other read-only buffer objects. Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
@@ -80,7 +80,7 @@ mp_obj_t nrf_flashbdev_writeblocks(size_t n_args, const mp_obj_t *args) {
|
|||||||
nrf_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
|
nrf_flash_obj_t *self = MP_OBJ_TO_PTR(args[0]);
|
||||||
uint32_t block_num = mp_obj_get_int(args[1]);
|
uint32_t block_num = mp_obj_get_int(args[1]);
|
||||||
mp_buffer_info_t bufinfo;
|
mp_buffer_info_t bufinfo;
|
||||||
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_WRITE);
|
mp_get_buffer_raise(args[2], &bufinfo, MP_BUFFER_READ);
|
||||||
|
|
||||||
mp_int_t address = self->start + (block_num * FLASH_PAGESIZE);
|
mp_int_t address = self->start + (block_num * FLASH_PAGESIZE);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user