Skip to content

Erasing flash 4096 bytes at a time is slow #3

Open
@DavidEGrayson

Description

@DavidEGrayson

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions