Skip to content

Commit

Permalink
stm32h5: Fixed the begin calculation for erase so the sector calculat…
Browse files Browse the repository at this point in the history
…ed is correct
  • Loading branch information
dragonmux committed Jan 14, 2025
1 parent 813f8d4 commit 6585197
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/target/stm32h5.c
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ static bool stm32h5_flash_erase(target_flash_s *const target_flash, const target
target_s *const target = target_flash->t;
const stm32h5_flash_s *const flash = (stm32h5_flash_s *)target_flash;
/* Compute how many sectors should be erased (inclusive) and from which bank */
const uint32_t begin = target_flash->start - addr;
const uint32_t begin = addr - target_flash->start;
const uint32_t bank = flash->bank_and_sector_count & STM32H5_FLASH_BANK_MASK;
const size_t sector = begin / STM32H5_FLASH_SECTOR_SIZE;

Expand Down

0 comments on commit 6585197

Please sign in to comment.