[STM32G473] Is it possible to keep dual bank active and executing the whole FLASH?
Hi,
In a matter of days, I'll have to port a user bootloader from STM32F303 to a STM32G473 mcu.
The question is about the Dual Bank feature of G473: since Dual Bank is active by default (DBANK=1), I'd prefer to NOT switch to Single Bank (as it is necessary to use specific Segger Flash Loaders).
So, keeping dual bank active, in my scenario:
- the bootloader takes the first 16 kBytes of Bank1
- the user application takes the last 112 kBytes of Bank1 and the whole Bank2
I studied a bit the Flash_WriteProtection demo and the EraseInitStruct can be initialized to perform erase on bank1 or bank2.
EraseInitStruct.TypeErase = FLASH_TYPEERASE_PAGES;
EraseInitStruct.Banks = FLASH_BANK_1; // or FLASH_BANK_2
EraseInitStruct.Page = StartPage;
EraseInitStruct.NbPages = EndPage - StartPage + 1;
if (HAL_FLASHEx_Erase(&EraseInitStruct, &PageError) != HAL_OK)The write API implementation seems to not care about which bank to write as it takes in only the destination address.
My doubt is about the execution: is it possible to execute code from bank2 or jump from bank1 to bank2 and back when BFB2 = 0?
Thanks for any help,
Regards
