2025-04-25 5:56 AM
I have a test question about STM32G474 dual banks to ask :
A test program for LED flashing has been successfully constructed in the IAR environment.
Use STM32CubeProgrammer to load BANK1 starting from 0X8000000, DBANK=1,BFB2=0, and the program runs OK
When BANK2 starting from 0x8040000 is loaded, DBANK=1 and BFB2=1, the program cannot run
May I ask to see if there are any problems with my application Settings
thank you
2025-04-25 7:31 AM - edited 2025-04-25 7:31 AM
Hello,
Look at the example provided in the STM32G4 Cube package especially the example FLASH_DualBoot located at this Github link.
2025-04-25 8:11 AM
Thank you
Yes, I have referred to this program
Now I'm just verifying the deployment of the firmware in a manual way. Later, the program switching process will be placed in the program (my application is digital power firmware deployment and upgrade).
The firmware is fine when deployed on BANK1, but not on BANK2.
This is exactly what I want to consult.
You can also have a try.
Thank you for your reply
2025-04-25 8:21 AM
the process below:
2025-05-03 10:21 AM
Both banks will be swapped with BFB2=1 and all addresses from BANK2 will be remapped to BANK1 (and vice versa).
Otherwise the flash addresses, generated by compiler, would all be wrong. So the start address for booting from BANK1 (BFB2=0) and from BANK2 (BFB2=1) also stays the same virtually @0x08000000.
If you want to ask if you booting from BANK1 or BANK2 you can read the memory remap status in MEMRMP register:
DWORD GetBootBank(void)
{
return (READ_BIT(SYSCFG->MEMRMP, SYSCFG_MEMRMP_FB_MODE) == 0) ? FLASH_BANK_1 : FLASH_BANK_2;
}