cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H757 - Bootloader in CM4

m.beddi
Associate II

Hi all,

is it possible to write a bootloader which sits at the beginning of the CM4 memory block and updates the CM7 as well as the CM4 (userapp sits in the memory area of the CM4 behind the bootloader)?


I imagine it like this: The configuration bit that boots the CM7 is deselected in the cube programmer so that only the CM4 core boots on reset. It performs the firmware upgrade in both the CM7 and the CM4 and then jumps to the user application written at the beginning of the CM7 memory block and executes it.
Would this process be conceivable or am I missing something important?
Both CM7 and CM4 are to be used in the user application.
After a reset, a button should be pressed to decide whether a firmware upgrade should be carried out or whether the useapp should be executed.

I hope I have been able to describe the problem clearly.

4 REPLIES 4
ramprakash08
Associate III

Hi,

Yes, it is possible to write a bootloader for the CM4 core that updates both the CM7 and CM4 cores. Your approach seems correct, but there are a few things to consider

1. The CM4 core should be the first to boot, as you mentioned. This can be done by configuring the option bytes. You can refer to the reference manual of STM32H757 for more details on how to configure the option bytes.

2. The bootloader should be capable of updating the firmware of both cores. This means it should be able to write to the flash memory areas of both cores. The STM32CubeProgrammer can be used to write the firmware to the flash memory

3. After the firmware update, the bootloader should jump to the user application. This can be done by setting the MSP of the CM7 core to the start of its stack (which is usually at the end of its RAM), and then jumping to the reset handler of the CM7 core. The same should be done for the CM4 core

4. The button press to decide whether to perform a firmware update or execute the user application can be handled in the bootloader. The bootloader can check the state of the button and decide what to do based on that.

Regards

FBL
ST Employee

Hello @m.beddi,

You may need to check bootloader version. It is possible that you cannot program the "CM4_BOOT_ADDx" option
byte using BL in dual core case. Check *STM32 microcontroller system memory boot mode - Application note.

FBelaid_0-1692625160774.png

 

 

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.

Hi @ramprakash08,


thank you for your answer.

As I understood you, the procedure generally works like this.
I would now implement it like this:

1. flash the bootloader in CM4 memory area 0x08100000 using the cube programmer.

2. deselect the option byte for CM7 (only CM4 boots) using the CubeProgrammer.

3. after a reset :

3.1 when the button is pressed, the bootloader performs a firmware upgrade (from SD card) for both cores. The bin file of CM4 is written to the memory area behind the bootloader (0x08120000), the bin file of CM7 is written to the location 0x08000000. Reset.


3.2 If the button is not pressed but there is nothing at the beginning of the memory area of CM4 (0x08120000), a firmware upgrade of both cores is also carried out. Reset.


3.3 If there is valid data in the memory area 0x08120000 (i.e. a bin file is programmed) and the button is not pressed, the CM7 should be booted from CM4 and then the CM4 jumps to the memory address 0x08000000 of the CM7 and the user application is executed from here.

The user application should then also use the CM4 for operations, does the CM4 have to be shut down in the user application in CM7 and then rebooted? I think so. How do I get the CM4 to start its own application from address 0x08120000 and not jump back to address 0x08000000 of the CM7 as described above?

Is this conceivable or is there something against it? Thank you.

m.beddi

Hi @FBL,

thank you for your answer.

Do I need the CM4_BOOT_ADDx option when writing my own bootloader or is this only necessary for the ROM built-in bootloader?
My bootloader is supposed to fetch the data from SD card and write it to flash, I haven't figured out yet how the system bootloader can do that. Is that also possible?

Or do I still not quite understand something? My procedure would now be as described in my answer to ramprakash08. Will I have a problem with this procedure? Thank you.

m.beddi