cancel
Showing results for 
Search instead for 
Did you mean: 

STM32Cube IDE "Run" works, "Debug" doesn´t

JStei.6
Associate III

Hello everyone,

I have a problem with my STM32f746g_Disco. When I started a project, I could hit the "Debug" button and everything worked fine.

Now it uploads everything and the Screen just shows a static noise (like on an old TV). When I use the "Run" button next to the "Debug" button, everything works as expected. So there is no code Error.

But now I cannot use the debug function, wich is essential for me.

I could not find any differences between the "debug Configurations" and "run configurations". Is there another place I could look for differences?

 

 

When Using "Debug" the console is giving me the following lines:

	STMicroelectronics ST-LINK GDB server. Version 7.3.0	
Copyright (c) 2023, STMicroelectronics. All rights reserved.	
Starting server with the following options:	
        Persistent Mode            : Disabled	
        Logging Level              : 1	
        Listen Port Number         : 61234	
        Status Refresh Delay       : 15s	
        Verbose Mode               : Disabled	
        SWD Debug                  : Enabled	
        InitWhile                  : Enabled	
Waiting for debugger connection...	
Debugger connected	
Waiting for debugger connection...	
Debugger connected	
Waiting for debugger connection...	
      -------------------------------------------------------------------	
                       STM32CubeProgrammer v2.13.0                  	
      -------------------------------------------------------------------	
Log output file:   C:\Users\Model\AppData\Local\Temp\STM32CubeProgrammer_a24180.log	
ST-LINK SN  : 066FFF534956866687013736	
ST-LINK FW  : V2J41M27	
Board       : 32F746GDISCOVERY	
Voltage     : 3.24V	
SWD freq    : 4000 KHz	
Connect mode: Under Reset	
Reset mode  : Hardware reset	
Device ID   : 0x449	
Revision ID : Rev Z	
Device name : STM32F74x/STM32F75x	
Flash size  : 1 MBytes	
Device type : MCU	
Device CPU  : Cortex-M7	
BL Version  : 0x90	
Debug in Low Power mode enabled	
Memory Programming ...	
Opening and parsing file: ST-LINK_GDB_server_a24180.srec	
  File          : ST-LINK_GDB_server_a24180.srec	
  Size          : 599.43 KB 	
  Address       : 0x08000000 	
Erasing memory corresponding to segment 0:	
Erasing internal memory sectors [0 6]	
Download in Progress:	
File download complete	
Time elapsed during download operation: 00:00:10.570	
Verifying ...	
Download verified successfully

When using "run" I get the following:

STMicroelectronics ST-LINK GDB server. Version 7.3.0
Copyright (c) 2023, STMicroelectronics. All rights reserved.
Starting server with the following options:
        Persistent Mode            : Disabled
        Logging Level              : 1
        Listen Port Number         : 61234
        Status Refresh Delay       : 15s
        Verbose Mode               : Disabled
        SWD Debug                  : Enabled
        InitWhile                  : Enabled
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
Debugger connected
Waiting for debugger connection...
      -------------------------------------------------------------------
                       STM32CubeProgrammer v2.13.0                  
      -------------------------------------------------------------------
Log output file:   C:\Users\Model\AppData\Local\Temp\STM32CubeProgrammer_a06584.log
ST-LINK SN  : 066FFF534956866687013736
ST-LINK FW  : V2J41M27
Board       : 32F746GDISCOVERY
Voltage     : 3.24V
SWD freq    : 4000 KHz
Connect mode: Under Reset
Reset mode  : Hardware reset
Device ID   : 0x449
Revision ID : Rev Z
Device name : STM32F74x/STM32F75x
Flash size  : 1 MBytes
Device type : MCU
Device CPU  : Cortex-M7
BL Version  : 0x90
Debug in Low Power mode enabled
Memory Programming ...
Opening and parsing file: ST-LINK_GDB_server_a06584.srec
  File          : ST-LINK_GDB_server_a06584.srec
  Size          : 599.43 KB 
  Address       : 0x08000000 
Erasing memory corresponding to segment 0:
Erasing internal memory sectors [0 6]
Download in Progress:
File download complete
Time elapsed during download operation: 00:00:10.765
Verifying ...
Download verified successfully 
Shutting down...
Exit.

I don´t see any differences there.

After using the "debug" command, I always press "resume" to start the programm. Is anything wrong with that?

 

Thanks for your help!

6 REPLIES 6
RhSilicon
Lead

I don't know if it can help in your case, but I found these videos about advanced debugging:

STM32CubeIDE Advanced Debug Features
https://youtube.com/playlist?list=PLnMKNibPkDnEDEsV7IBXNvg7oNn3MfRd6

TDK
Guru

In Debug configurations, uncheck the "set breakpoint on main" box. This will let you launch it without having to "resume" when it hits the breakpoint at main, which may be causing the issue.

You can also set "Download: False" which will cause it not to update the flash before it runs the program. To debug in this mode, hit "Run" to upload the file, then hit "Debug" and it will attach to the process wherever it happens to be at. I don't think there is any upset in program flow, but there may be something minor.

TDK_1-1692309142695.png

 

If you feel a post has answered your question, please click "Accept as Solution".
Rim LANDOLSI
ST Employee

Hello @JStei.6 ,

Could you, please, share a screenshot of the debug configuration. You could activate the gdb-server log in the debug configuration. It would be , also, helpful to post the gdb-server log and the .launch file that's in the root of your project .

RimLANDOLSI_0-1692364425462.png

Thanks,

Rim

JStei.6
Associate III

I have tried a bit here and there. Turning off "Download" as suggested by TDK didn´t do anything. But I looked into other projects that still debug correctly, and the external loader was not configured correctly. But it is still behaving weired. 

"Run" still works perfectly fine, and programming it with the "STM32CubeProgrammer" also works fine, but when I try "Debug" it downloads everything, but when I hit the "Resume" button, it shows the startup screen of the last program that was loaded to it (with a few of missing pixels) as if the starting occures at a wrong memory spot. Now I can press the reset button, and the correct program starts.

 

Here are my screenshots of the debug config:

SamPlay_debug_2.pngSamPlay_Debug_1.png

 

I could not upload the .launch file because the file format is not supported, and the gdb server log is too big to be uploaded. So I put it into my onedrive cloud an I have generated the following link:

 https://1drv.ms/f/s!AjN2hZR42EKhiPZ-X5K2Wf9nbSoTNQ?e=bpnIMF

 

Thank you!

Rim LANDOLSI
ST Employee

It seems that you are working with an old STM32CubeIDE version. Could, please, you try the project with newer version.

JStei.6
Associate III

I have now updated to 1.13.1 but nothing changed.

I have tried different things now and saved the gdb server logs.

The two logs where I have unchecked the "download" option are small enough to be uploaded here.

The behaviour is the same. Run works, debug just gives static noise. (The programm has been downloaded with "run". Then the the "download" checkbus has been unchecked, then the two server logs were created.

everything else is on the cloud (same Link from my last post).

 

Another thing I noticed is that when the problem occurs, CubeIde alway higlights the "HardFault_Handler" in "stm32f7xx_it.c" So something while debugging causes this hardfault. "Run" does not do that.