Optimise erase time for stm32f410/413/423#1493
Closed
jameswalmsley wants to merge 1 commit into
Closed
Conversation
STM32F410 and STM32F413/F423 were missing from the F4 sector-size list in stlink_calculate_pagesize(), so they fell back to the uniform flash_pagesize (16 KB) from the chip config. The erase loop advances by that page size, but calculate_F4_sectornum() maps every address within a sector to the same sector number -- so a 64 KB sector was erased 4 times and a 128 KB sector 8 times. Add both chip ids to the list so the erase advances by the real sector size (16/64/128 KB) and erases each sector once. Measured on a Nucleo-F413ZH: a 512 KiB write dropped from ~44 s to ~16 s (32 -> 4 sector erases). Small 16 KB sectors are unchanged (page size already matched the sector). Signed-off-by: James Walmsley <james@fullfat-fs.co.uk>
f78e03e to
686ec2d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Repeated flashing f413 with st-link is very very slow compared to j-link / stm32 cube.
This ensures full sector erases are used when possible.