cancel
Showing results for 
Search instead for 
Did you mean: 

Booting with dual flash banks vs. bank swap

Pavel A.
Evangelist III

Dear experts,

I'm reading RMs for STM32 models with dual flash banks (F4, H7...) and don't quite understand how to use bank switching.

Take the firmware update scenario when old firmware is in bank1 and new is programmed to bank2. So it programs some option byte to switch banks and next time should boot from bank2.

If the new version is bad, I'd like to boot automatically from bank1. But how? the option byte is written. Is there a way to control bank switch by external pin?

On some systems that I've seen before we did it in the following way: we made a simple watchdog (CPLD or whatever) that automatically toggles the boot selector pin.

If the CPU does not touch the watchdog in defined time since reset, it will switch the selector pin and reset again.

So if the new firmware fails to boot, the system will reboot to the old firmware.

I'd like to implement the same on STM32, with external widget if needed, but better without it.

On the other hand, for H7 you can define alternative start addresses in option bytes, for BOOT0 high and low. But without bank switch this won't be useful. My firmware is not position independent, it is built for specific addresses in 1st bank. It won't run off bank2 if banks are not switched.

Any ideas, please?

-- pa

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Pavel A.​ ,

That is true STM32H7 devices have a flash with Dual-bank organization, but it doesn't support dual boot at hardware level. That is why there is no dual-bank boot flowchart for STM32H7.

At documentation level, if you take RM0410, one of the main features of STM32F76x's flash is "Dual Boot mode". This is not the case for STM32H742 for example (RM0433).

-Amel

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.

View solution in original post

5 REPLIES 5
Amel NASRI
ST Employee

Hi @Pavel A.​ ,

To understand more about dual bank implementation on STM32 products, I recommend you to have a look to AN2606: STM32 microcontroller system memory boot mode. You will find there flowcharts of  dual bank boot implementation per product.

You have also the X-CUBE-DBANK-F7 firmware which is intended to describe the STM32F7 Flash-memory dual-bank capabilities. It is the firmware package associated to AN4826 (STM32F7 Series Flash memory dual bank mode).

Here a description of Dual boot example provided there: "describes the dual boot capability either by booting in the Flash bank1 and toggling the LED1 or by booting in the Flash bank2 and toggling the LED2".

Hope this is helpful to provide some guidelines and enlightens the feature.

-Amel

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.

Pavel A.
Evangelist III

Thank you Amel. It's complicated ...

Btw, I could not find in AN2606 description of dual-bank boot for H74x/H75x like for e.g. F76xx (figure 48)

Is there document similar to AN4826 for H74x/H75x?

-- pa

Hi @Pavel A.​ ,

That is true STM32H7 devices have a flash with Dual-bank organization, but it doesn't support dual boot at hardware level. That is why there is no dual-bank boot flowchart for STM32H7.

At documentation level, if you take RM0410, one of the main features of STM32F76x's flash is "Dual Boot mode". This is not the case for STM32H742 for example (RM0433).

-Amel

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.

Thank you Amel for the explanation

-- pa

CWei .1
Associate II

Hello Amel and to all ST Employee

I am using the STM32H747 dual core series, I would like to confirm with if the sequence works

1. Bootloader is resided within M7 Code area, there is no Bootloader develop in the M4 Code area. M4 Code area will store FW application code.

2. M7 CORE will configure to be running first upon POR, system reset.

3. We will using dual memory slot FW update strategy, so let assumes FW Memory Slot 1 will be the area where Pre-existing FW is executing. and FW Memory Slot 2 will be use for downloading new FW data.

4. Once Firmware request is received during Application code execution phase. the FW application code will download into FW Memory Slot 2 first, then initiate a system reset

5. After reset, M7 bootloader will executing, it will have some flags to know that there is new FW being downloaded into the FW Memory Slot 2. M7 Bootloader will check data integrity and FW authentication process. If both are OK, it will override the FW Memory Slot 1 with FW Memory Slot 2.

6. data integrity Check again and then jump to FW Application code

Can you advice the general strategy is workable?