cancel
Showing results for 
Search instead for 
Did you mean: 

Is there a breakpoint instruction?

Evan .1
Associate II

Is there a breakpoint instruction in the STM32 series? like the BKPT?

11 REPLIES 11
TDK
Guru

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)

If you feel a post has answered your question, please click "Accept as Solution".
berendi
Principal

Look up the BKPT instruction in the programming manual for your MCU.

Evan .1
Associate II

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.

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

> 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

__BKPT(0xBE) stops the debugger, but it can't continue. It could be something internal to gdb.

> __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

turboscrew
Senior III

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.

What is a "normal" gdb?