cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H7743I-EVAL board, FLASH_SwapBank example code not swapping the code?

avulas76
Associate II

For the upcoming project planning to use the STM32H family of uC and try to run code from flash bank1 and use the bank2 for staging the new firmware.

Once staged firmware CRC check would like to swap the code from bank2 to bank1 and reboot the device to start booting from bank1.

To start with, got the STM32H7743I-EVAL board,  FLASH_SwapBank example code with the following order:

  1. Compiled FLASH_SwapBank1 code with the following changes:

     BSP_LED_Off(LED1);

     BSP_LED_On(LED2);

     BSP_LED_Off(LED3);

  1. Compiled FLASH_SwapBank2 code with the following changes:

     BSP_LED_On(LED1);

     BSP_LED_Off(LED2);

     BSP_LED_On(LED3);

  1. Erased the full chip using the STM32CubeProgramming
  2. Loaded the Bank2 .elf in 0x08100000 using the STM32CubeProgramming - (Bank2 start address)
  3. Loaded the Bank1 .elf in 0x08000000 using the STM32CubeProgramming - (Bank1 start address)
  4. Read the code from both bank1 and bank2 and made sure the code is loaded properly.

After rebooting the Eval board, found that the code running from bank1 by looking at the LEDs behavior. When I pressed the “Tamper�? button the assumption is the LED behavior will change.

But it is not happening.

Appreciated help on this.

13 REPLIES 13

Hello again @avulas76​,

I am investigating further the issue.

If you can work with IAR, I am sure the Led behavior works fine.

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

avulas76
Associate II

Hello, I am still struggling with this issue. I appreciate any help with this.

Hello @avulas76​,

An internal ticket has been reported to fix the issue in CubeIDE.

Internal ticket number: 134256(This is an internal tracking number and is not accessible or usable by customers).

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

Christophe VRIGNAUD
ST Employee

Hello @avulas76​,

1. Compile FLASH_SwapBank2 code with the same flash start address and vector table address than for bank 1 => same .ld file; but generate also a .bin binary file.

2. Load the Bank2 .bin (not .elf) in 0x08100000 using the STM32CubeProgramming - (Bank2 start address)

=> Depending on the value of the SWAP_BANK bit in option bytes, the address 0x08000000 points either to bank 1 or bank 2 and the address 0x08100000 points to the other bank.

- SWAP_BANK = 0:  0x08000000 > Bank 1 0x08100000 > Bank 2

- SWAP_BANK = 1:  0x08100000 > Bank 1 0x08000000 > Bank 2

For STM32H743, it is described in RM0433 Rev 8 Table 19.

Best regards