Skip to content

Use real F4 sector sizes for STM32F410/F413 erase#1494

Open
jameswalmsley wants to merge 1 commit into
stlink-org:testingfrom
jameswalmsley:jw/f4-fast-erase
Open

Use real F4 sector sizes for STM32F410/F413 erase#1494
jameswalmsley wants to merge 1 commit into
stlink-org:testingfrom
jameswalmsley:jw/f4-fast-erase

Conversation

@jameswalmsley

Copy link
Copy Markdown
Collaborator

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).

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants