Another problem with VS Code/ST Link-V3 Mini -- openocd

I’m just getting started with VS Code/Cortex Debugger/OpenOCD/ST Link-V3 Mini running under MacOS Catalina. I’m trying to debug code that I’m currently developing. I’vw set a couple of breakpoints and then started the debugger using Fn-F5. The debugger seems to be starting properly, but it’s halting at a breakpoint that is not one of the ones I’ve set. If I press the “Continue” button, VS Code will again pause at the same place. How do I get it to stop only at the breakpoints I’ve set, not at other places?

I thought I should try this on a simpler, known example. I loaded the “tone” example from Seed. After entering Fn-F5, the program compiles and starts. The debugger pauses at line 34 which is the first executable line. When I hit “Continue”, it pauses at the first breakpoint, line 39. When I hit “Continue” again, it skips over the next breakpoint (line 49), but pauses at line 55 (this is where I took the screenshot). Why?? If I hit “Continue” again, the program runs, and I hear the tones. However, I do not see any output from the “printf” that I added to the bottom of the program. Can someone help me figure out how to get the breakpoints working as expected, or at least how to do some printline debugging? Thanks.

In case it’s helpful, here’s the output window when paused at the spurious breakpoint. When I hit “continue” again, the single additional line

Info : halted: PC: 0x08000950

was generated.

Browsing the forum has paid off! This thread: Had to modify tasks.json to debug (?) described a similar problem. I tried the “magic sauce” - commenting out the “depends on” in the tasks.json for my original program, and voila! I’m able to debug. I am still seeing some “off by one” behavior, the debugger is pausing on a break statement rather than the line above it where I set a breakpoint (perhaps the same problem as the second example I posted, which was not improved by commenting out the “depends on”), but at least I can limp along now.

I would still like some help with getting printf running, if anybody reads this.

1 Like

We really need to understand what is happening with this “magic sauce”. I can’t wrap my mind around it, and that shouldn’t be the case!

Shoud out to people who can understand what is going on here? Feeling @Elby on that, the debugging experience is weird but hopefully the community will understand fully what’s it’s all about?

1 Like