Skip to content
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

WB55: fix flash verification error #816

Merged
merged 3 commits into from
Jul 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -1759,8 +1759,11 @@ int stlink_erase_flash_page(stlink_t *sl, stm32_addr_t flashaddr)
if (sl->flash_type == STLINK_FLASH_TYPE_WB) {
uint32_t flash_page = ((flashaddr - STM32_FLASH_BASE) / sl->flash_pgsz);
stlink_read_debug32(sl, STM32WB_FLASH_CR, &val);

// sec 3.10.5 - PNB[7:0] is offset by 3.
val &= ~(0xFF << 3); // Clear previously set page number (if any)
val |= ((flash_page & 0xFF) << 3);

stlink_write_debug32(sl, STM32WB_FLASH_CR, val);
} else if (sl->flash_type == STLINK_FLASH_TYPE_G0) {
uint32_t flash_page = ((flashaddr - STM32_FLASH_BASE) / sl->flash_pgsz);
Expand Down