6

I've noticed that while debugging an STM32 project using the STM32CubeIDE debugger, the debugger always stops on the HAL_Init() function call even when I don't have a breakpoint listed. This even occurs when I create a brand new project, which makes me think it's not something I'm accidentally doing in my project.

Is there a way to disable this?

enter image description here

Izzo
  • 1,984
  • 2
  • 18
  • 37

2 Answers2

8

Yes, there is a way to disable this default behaviour. Under the Debugger Icon (the "bug") > Debug Configurations > [STM32 C/C++ Application > Your debug configuration] > Startup there is a "Set breakpoint at: [function name, defaults to main]" checkbox, which you can simply turn off.

STM32 Cube IDE/Eclipse toolbar, with the debugger submenu open

"Debug Configurations" dialog

4

It always stops on the first line of main() so that you can manually kick it off. You can try to declare some variable above it and you'll see it stops there instead. It feels annoying at first, but it allows you to click "debug" in IDE, start debugging, and while it's on the first line, you can always set up some testing stuff, after what you're literally one click away from running the code without any waiting. Especially handy if your hands are both full and you need to click "debugging" with nose (true story). Quick controlled start of the program.

Ilya
  • 3,478
  • 7
  • 33