-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
Add 'erase_sectors' function to flash-algorithm #2132
base: master
Are you sure you want to change the base?
Conversation
In the esp loaders we pretty much just ended up setting sector size to block size, and doing block erases in the flash algos, because I didn't want to add exactly this. However, if we're at it, I think I would prefer an |
would you expect the |
I think exclusive is more logical, and easier to work with. |
probe-rs/src/flashing/erase.rs
Outdated
first.base_address.try_into().unwrap(), | ||
qty.try_into().unwrap(), | ||
)?; | ||
active.erase_range(first.base_address, last.base_address + last.size - 1)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come you need that -1
? If I'm not mixing up my intervals, the end of an exclusive range is just address + size
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My brain malfunctioning, basically 🤦.
I probably should have not done any programming today.
With SPI flash, erasing sector-by-sector is much slowing than erasing by block.
The CMSIS flash algo standard doesn't provide an interface for doing a block erase.
By augmenting the
flash_sector
function with a "number of sectors to erase" parameter, we allow the flash algo to use larger erase blocks.This change results in slightly more than a 2x improvement in erase times for large binaries.
Open questions:
flash_sectors
to make it less easy to confuse withflash_sector
This draft impl assumes that all sectors sent to the erase command are of the same size and are contiguous - before merging I need to write something to collect all contiguous areas into batches to pass on to erase.
This draft also includes an update to the rp2040 flash algo to exercise this functionality