2024-04-17 12:33 AM - edited 2024-04-17 12:35 AM
Hi,
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`:
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.
If I don't flash anything, then debugging works fine:
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.
Thanks
Andy
2024-04-17 12:52 PM
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
2024-04-17 01:04 PM - edited 2024-04-17 01:06 PM
Hi @CMYL
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
Thanks
Andy
2024-04-17 02:54 PM - edited 2024-04-17 02:54 PM
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.
2024-04-17 11:31 PM
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...
2024-04-18 12:41 AM - edited 2024-04-18 12:43 AM
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 https://github.com/STMicroelectronics/STM32CubeH7RS/tree/main/Projects/STM32H7S78-DK/Templates/Template_XIP
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:
We get this:
I cannot continue the debugger from that.
If I set up so that the boot comes after the appli:
Then everything works, we hit my breakpoint:
If I then set it up so that the boot is not flashed:
We get the same issue we saw when the boot was before the appli in the list above:
For the final test I set it up with no flashing:
And everything works:
So I am seeing the same sort of issues using the ToughGFX project and also a ST example project.
2024-04-18 02:00 AM
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?
2024-08-15 04:52 PM - edited 2024-08-15 04:53 PM