flash_range_program will lock up if source data points to flash address #1089

Open
opened 2022-11-03 00:31:52 -05:00 by dpgeorge · 0 comments
dpgeorge commented 2022-11-03 00:31:52 -05:00 (Migrated from github.com)

The flash_range_program(flash_offs, data, count) will lock up if data points to an address in the XIP address range, ie points to flash.

This can happen when you want to copy some region of flash to another region. I hit this issue in MicroPython, copying a data structure from ROM (XIP flash) to the filesystem (also in flash).

I can understand that it's just a limitation of the flash_range_program() function, that you must not pass in an XIP flash address as the data argument. But I think this limitation should be documented, and also possibly an assertion added to check this case.

Or would it make sense to allow flash addresses to be passed in, and the function use a temporary SRAM buffer to copy from flash to flash?

The `flash_range_program(flash_offs, data, count)` will lock up if `data` points to an address in the XIP address range, ie points to flash. This can happen when you want to copy some region of flash to another region. I hit this issue in MicroPython, copying a data structure from ROM (XIP flash) to the filesystem (also in flash). I can understand that it's just a limitation of the `flash_range_program()` function, that you must not pass in an XIP flash address as the `data` argument. But I think this limitation should be documented, and also possibly an assertion added to check this case. Or would it make sense to allow flash addresses to be passed in, and the function use a temporary SRAM buffer to copy from flash to flash?
Sign in to join this conversation.
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk#1089
No description provided.