cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G4 DualBoot example not working

MScho.1
Associate III

Hi,

I'm trying to get the dual bank image swap feature of the STM32G4 to work, so far without success.

I tried first on my own board by following the (very sparse) information in the reference manual. However every time I set the BFB2 bit in software and reboot afterwards, the code in bank 2 doesn't seem to execute at all (and yes, address 0x08040000 is pointing to a valid RAM location for the stackpointer)

I finally decided to just try the example code from the firmware package (see https://github.com/STMicroelectronics/STM32CubeG4/tree/master/Projects/NUCLEO-G474RE/Examples/FLASH/FLASH_DualBoot) on my Nucleo G474RE eval board, just to verify the feature is actually working. However it seems to me that even this example program is not working!

Maybe I am doing something wrong here and someone can help me.

So here are my steps:

  1. Compile example program with "FLASH_BANK2" define active
  2. Flash binary to address offset 0x08040000 using ST-LINK
  3. Compile example program with "FLASH_BANK1" define active
  4. Flash binary to address offset 0x08000000 using ST-LINK (no erase)
  5. Verify that the flash content actually contains the two programs at the desired address offsets
  6. Make sure the BFB2 bit in the option bytes is cleared
  7. Re-power the eval-board
  8. I see the LED2 blinking --> correct
  9. Push the "user button" B1
  10. See no LED blinking anymore --> wrong (I should see LED2 being on)

Could someone verify this behavior?

Attached you can find screenshots of the flash content and option bytes set.

3 REPLIES 3
MScho.1
Associate III

Anyone? @Imen DAHMEN​ @Imen GH​ 

(actually seems to be a duplicate of https://community.st.com/s/question/0D50X0000CEqc1SSQR/dual-boot-on-the-stm32g4-not-quite-working-boot-from-second-bank-fails but there's no answer in the this post as well)

Imen.D
ST Employee

Hello @MScho.1​ ,

After analysis, this issue is due to bootloader and it has been fixed with bootloader version 13.4.

So, can you please confirm that you are using a board with bootloader v13.4? or share the binary of the applications that you load in Bank1 and Bank2 ?

In fact, the example is not working as you reported when using bootloader v13.3 and older.

To be ensure that the bootloader version used is v13.4, please folow these steps:

- connect the board to STM32Cubeprogrammer

- read the address 0x1FFF6FFE

- the first bytes must have value 0xD4:

D ==> 13

4 ==> .4

Otherwise, the FLASH Dual Boot example will not be working with older releases.

Note that the example is working using IAR toolchain and BL 13.4, but we have the same issue as you reported when using Bootloader v13.3 and 13.2 .

Best Regards,

Imen

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

Will continue the discussion in https://community.st.com/s/question/0D50X0000CEqc1SSQR/dual-boot-on-the-stm32g4-not-quite-working-boot-from-second-bank-fails. I think you can close this issue here, @Imen DAHMEN​ .