ESP32 – Cannot set hardware breakpoint

Sysprogs forums Forums VisualGDB ESP32 – Cannot set hardware breakpoint

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #9959
    nevyn
    Participant

    I have an ESP32 board which I programmed with successfully and managed to set two hardware breakpoints following the advice in the ESP32 Limitations article.

    I have now setup a second project based upon the LED project and have tried to execute this and set a breakpoint.  I keep getting the following message:

    Cannot insert hardware breakpoint 7.
    Could not insert hardware breakpoints:
    You may have requested too many hardware breakpoints/watchpoints.

    I have tried clearing the break points using Visual Studio (Debug -> Delete all breakpoints) and also using the GDB session directly.  The GDB command info break tells me that I have no breakpoints or watchpoints set.

    Any idea how I can use the debugger in the new application?

    Thanks in advance,
    Mark

    #9969
    support
    Keymaster

    Hi,

    The ESP32 OpenOCD sometimes shows this message if one of the cores is not stopped properly. Please try running the “mon targets” command to see if both cores are stopped. You can then forcibly stop them by running “mon halt”.

    #9974
    nevyn
    Participant

    I have just retried programming the chip and debugging as follows:

    1. Set project properties to Alway program, compiled the code.
    2. Reset the chip and hit debug to upload the code.
    3. Once complete I reset the properties to Assume programmed, reset the chip and then pressed F5.

    Doing this generates a SIGINT exception and the source windows shows the breakpoint in xPortGetCoreID method.

    If I run without the debugger attached and check the output on the COM port I get the following message:

    Guru Meditation Error of type IllegalInstruction occurred on core 0. Exception was unhandled.

    along with a register dump and traceback.  The chip then enters a cycle of software resets as the same error is generated over and over again.

    BTW – I’m using a Segger J-Link EDU.

    Regards
    Mark

    #9977
    support
    Keymaster

    Hi,

    Looks like you might be compiling the code with the -O0 optimization level that triggers a bug in the ESP32-IDF.

    Please try switching it to -Og via Visual Studio Project Properties -> C/C++ -> Optimization.

    #9985
    nevyn
    Participant

    The -Og change solved it.  Thought I’d followed the tutorial carefully, can’t believe I missed that.

    Thanks for the help,
    Mark

    #9998
    support
    Keymaster

    Hi,

    No problem. This is somewhat counter-intuitive and we will probably add a warning for this in one of the later releases.

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.