2020-04-06 06:00 AM
Is there a breakpoint instruction in the STM32 series? like the BKPT?
2020-04-06 06:22 AM
The "STM32" series is quite expansive. You probably want to narrow it down a bit. But yes, there is:
/**
\brief Breakpoint
\details Causes the processor to enter Debug state.
Debug tools can use this to investigate system state when the instruction at a particular address is reached.
\param [in] value is ignored by the processor.
If required, a debugger can use it to store additional information about the breakpoint.
*/
#define __BKPT(value) __ASM volatile ("bkpt "#value)
2020-04-06 06:27 AM
Look up the BKPT instruction in the programming manual for your MCU.
2020-04-06 06:47 AM
Ok thanks. Only If I use the instruction my STM32Cube doesn't stop I have to pause it manually. It doesn't behave like a breakpoint. Is there something that I need to configure ?
Thanks.
2020-04-06 08:19 AM
Perhaps you need something like Keil or IAR ? Perhaps check GNU/GDB docs, and use debugger scripts
Why not make a break-point function, and then break-point that? Call it in such a way as you can identify where it came from via __LINE__, __FILE__, or your own text string, and then step-forward.
2020-04-06 12:39 PM
> If I use the instruction my STM32Cube doesn't stop I have to pause it manually. It doesn't behave like a breakpoint.
Strange. Maybe yet another anomaly in the CubeIDE debugger.
What is your cubeIDE version and debugger options (ST gdb server or OpenOCD? any customization in the launch script?)
-- pa
2020-04-06 12:47 PM
__BKPT(0xBE) stops the debugger, but it can't continue. It could be something internal to gdb.
2020-04-06 05:34 PM
> __BKPT(0xBE) stops the debugger, but it can't continue.
It can continue if manually moved over the instruction. The gdb "monitor" (or what's its name) is not smart enough to do this automatically.
-- pa
2020-04-06 08:50 PM
I've never had problems with BKPT. On the other hand, I've never used CubeIDE. For "normal" GDB that's no problem, and "normal" GDB steps over BKPT just fine.
Also "normal" GDB doesn't care about the number. The HW certailnly doesn't. On the other hand, BKPT is really just a software exception, It can be used as a system call as well.
2020-04-07 02:12 AM
What is a "normal" gdb?