When I'm debugging STM32CubeIDE opens startup_stm32f722xx.s
file when microcontroller resets (when I start debugging or when I reset microcontroller.
It looks like the debugger has some "hidden" breakpoints and it hits them, and then continues, but the file remains open.
It is not useful for me right now. What can I do about this?
I'm using STM32CubeIDE 1.6.1 with STM Nucleo-F722ZE (STLink 3v on board).
By default, a breakpoint is placed at main when debugging. When a breakpoint is hit, an editor is opened with the cursor at the relevant line. This may be why your startup code is opened. As far as I know, STM32CubeIDE has no option to prevent opening editors on breakpoints.
You can disable this "hidden" breakpoint in the Debug Configuration, accessible through the Run menu. Select your configuration in the left column and go to the Startup tab on the right. Towards the bottom, deselect the checkbox before "Set breakpoint at: main".
If this doesn't help, and assuming you have no normal breakpoints active, you could check STLink's documentation for similar options. I have no experience with that specific debugger.
Screenshot of STM32CubeIDE's Debug Config. dialog, with "breakpoint at main" circled in red
Edit below. Thanks, oromoiluig, for clarifying the issue further in your comment.
There is also a known bug in the IDE that might affect you. An ST employee comfirmed that it "Sounds like unexpected behavior" and suggests to:
One user reported that it helped. Many more report the issue persists, even today in version 1.9.0.
To answer your question directly: No. You likely cannot stop STMCubeIDE from opening startup.s or other rource files in this situation. It is up to ST to fix their IDE.