Showing results for 
Search instead for 
Did you mean: 

STM32H7R/S - bootflash/stm32cubeide, how to debug without flashing boot every time.



This is using the STM32H7S78-DK.

So I have a stm32cubeide project containing two sub projects

1. `STM32H7S78-DK_Appli`

2. `STM32H7S78-DK_Boot`

`STM32H7S78-DK_Boot` is not changing, code changes are in `STM32H7S78-DK_Appli`.

The only way I can find to debug that works is to flash `STM32H7S78-DK_Appli` and then `STM32H7S78-DK_Boot`:

Screenshot 2024-04-17 at 08.24.58.png

If instead I only flash the `Appli` then it gets stuck in the HardFault_handler, if I then reset the board via the button I hit my breakpoint.

Screenshot 2024-04-17 at 08.28.51.png

If I don't flash anything, then debugging works fine:

Screenshot 2024-04-17 at 08.30.24.png

Is there some trick to getting debugging working when just flashing the `Appli`, I have tried the different "Reset Behaviours" but that seems to have no impact.




ST Employee

Hello @ACapo.1 ,

To debug you need to follow the steps below:

 - Compile the example/application; the elf file is required to configure the debug profile (the "active configuration" must be "debug", else only assembly debug is available)

 - Open the menu [Run]->[Debug configuration] and double click on [STM32 C/C++ Application] (it creates a default debug configuration for the current project selected)

 - In [Debugger] tab, section "External loaders" add the external loader corresponding to your Board/Memory as described below:

 - In "External loaders" section, click on [Add]

 - Select the loader among the available list (**MX66UW1G45G_STM32H7S78-DK. stldr**)

 - Option "Enabled" checked and Option "Initialize" unchecked

 - In "Misc" section, uncheck the option "Verify flash download"

 - In [Startup] tab, section "Load Image and Symbols":

   - Click on [Add]

     - click on "Project" and then select the boot project.

     - click on Build configuration and select "Use active".

     - then select the following options:

       - "Perform build" checked.

       - "Download" checked.

       - "Load symbols" unchecked.


To debug you need to download the boot once by checking "Download" for the first time, then you can uncheck "Download" the second time and flash just the Application project.

 Step 1 : check "Download" of Boot project for the first time





Step 2: uncheck "Download» of Boot project in second time and flash just the Application project.



Best regards



Thanks for the reply but what I am saying is that even if the boot is flashed, then just flashing the appli doesn't work unless I press the reset button on the board.


So taken the state that the boot is already flashed, the following work with debugging:

1. Don't flash either.

2. Flash Appli then Boot.

The following does not work (stuck in HardFault_handler, requires reboot via board button):

3. Flash Appli






Pavel A.
Evangelist III

This looks like the external loader leaves the system in awkward state.

Maybe the bootloader can be fixed to detect this condition and call system reset if needed.


Hi @Pavel A. 

Thanks for the reply.

It's a TouchGFX generated project that I am seeing the issue with.

I did have a quick look at generating a new project for the board in stm32cubeide, the boot code generated does not actually jump to the application code at all, it just loops!

I'll spend a bit of time trying to get this stm32cubeide generated code going to see if it suffers with the same issue, maybe there is a setting in the ioc setup than needs setting...

So I could not find anything in the IOC to generate the code so thought I would grab an example, GPIO_IOToggle.

This example uses the `Boot_XIP.hex` from

First issue, if I follow the instructions in the readme, which are like the instructions from @CMYL above and add the boot before the application as follows:

Screenshot 2024-04-18 at 08.30.40.png

We get this:

Screenshot 2024-04-18 at 08.32.35.png

I cannot continue the debugger from that.

If I set up so that the boot comes after the appli:

Screenshot 2024-04-18 at 08.35.02.png

Then everything works, we hit my breakpoint:

Screenshot 2024-04-18 at 08.35.55.png

If I then set it up so that the boot is not flashed:

Screenshot 2024-04-18 at 08.37.08.png

We get the same issue we saw when the boot was before the appli in the list above:

Screenshot 2024-04-18 at 08.38.10.png

For the final test I set it up with no flashing:

Screenshot 2024-04-18 at 08.39.46.png

And everything works:

Screenshot 2024-04-18 at 08.40.38.png

So I am seeing the same sort of issues using the ToughGFX project and also a  ST example project.



In the readme of another example I found this:

To configure STM32CubeIDE Debug Configuration, you must do the following :

    1. Upload the template XIP
    2. Add the adequate external loader (MX66UW1G45G_STM32H7S78-DK.stldr file) in Project->Debugger Configuration
    3. Add in the startup the template_XIP_Boot in Project->Debugger Configuration
    4. Move up the application in the startup

This is actually saying that you need to move the application up in the list.

Maybe you always need to flash both?