Skip to content

Commit

Permalink
fixup! [flash] STM32G4 flash erase dual bank BKER bit
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Mar 27, 2024
1 parent b0f7fa0 commit de6a0c2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/modm/platform/flash/stm32/flash.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ Flash::erase(uint8_t index)
%% if dual_bank
uint32_t cr = FLASH_CR_STRT | FLASH_CR_PER;
uint32_t page = index;
%% set second_bank = 256 if family == "g0" else "(Size/2 >> 11)"
%% set second_bank = "(Size/2 >> 11)"
if (FLASH->OPTR & {{dual_bank}} and index >= {{second_bank}})
{
page -= {{second_bank}};
Expand Down
5 changes: 3 additions & 2 deletions src/modm/platform/flash/stm32/module.lb
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,9 @@ def build(env):
block_shift = 10
elif target.family in ["g0"]:
busy_bit = "FLASH_SR_BSY1"
dual_bank = "FLASH_OPTR_DUAL_BANK"
block_shift = "(FLASH->OPTR & FLASH_OPTR_DUAL_BANK ? 11 : 12)"
block_shift = 11
if target.name[0] in ["b", "c"]:
dual_bank = "FLASH_OPTR_DUAL_BANK"
elif target.family in ["g4"]:
block_shift = 11
# Only Cat3 devices have dual bank, so g47x or g48x
Expand Down

0 comments on commit de6a0c2

Please sign in to comment.