Skip to content

Erasing flash 4096 bytes at a time is slow #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
DavidEGrayson opened this issue Sep 2, 2024 · 0 comments
Open

Erasing flash 4096 bytes at a time is slow #3

DavidEGrayson opened this issue Sep 2, 2024 · 0 comments

Comments

@DavidEGrayson
Copy link

DavidEGrayson commented Sep 2, 2024

As I pointed out in picotool pull request #66, erasing flash one 4096-byte sector at a time is a waste of time, since the flash chips generally support other commands that erase a larger amount of flash and have a smaller time per byte. For the RP2040, I was able to work around this by using the "exec" command to upload some assembly that accessed the "Flash Range Erase" command in the ROM table, as shown in that pull request. This sped up loading by 50%, saving 1.4 seconds when loading a MicroPython image onto the chip. For the RP2350 family, "exec" has been removed, so as far as I know, we are stuck erasing flash the slow way.

In future chip revisions, it would be nice to have a new USB command for accessing the s_varm_api_flash_range_erase function that is already included in the bootloader, since that function is capable of using different, more efficient erase commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant