This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF52840 - How to debug Zephyr code when the radio is running. HardFault

Hi, I found that after migration from Zigbee Thread SDK to Zephyr GDB debugging functionality is broken.
I have read a lot about PRIMASK register, GDB hooks, and so on, but those didn't fix all of my problems.
I want to use Eclipse + GDB for stepping through the code and dynamic breakpoint placement.
I found a solution, that is somehow satisfying my needs - I mean Monitor mode debugging using Jtrace probe.
```
https://www.segger.com/products/debug-probes/j-link/technology/monitor-mode-debugging/
```
+ custom settings passed to JLINK cmd.

This isn't an ideal solution, as MMD works only in Jlink PRO / Jtrace programmers - so no way to get it working on your dev boards.

Can you provide some universal way to step through the code without HardFaults and resets?

Parents Reply Children
  • Hi, thanks for your fast reply.
    We are using nRF Connect SDK for the Zigbee application and building it with west + makefiles.
    According to www.segger.com/.../

    A: No, Monitor Mode Debugging is only supported by J-Link PLUS, PRO, ULTRA+, and J-Trace. J-Link BASE and on-board J-Links cannot be used for Monitor Mode Debugging

    I'm wondering if it is really possible.

    I'm using opensource toolchains and IDE, and I was able to run MMD by compiling some parts of the sample project from Segger. Next, I've added some gdb commands for init 

    mon reset 0
    mon exec SetMonModeDebug=1
    mon exec SetMonModeVTableAddr=0x1f000

    And It just works, but only using our external JTrace probe.
    You mention some additional licenses; is it possible to upgrade onboard nrf52 devkit JLlink? Or should it work out of the box in your opinion, if our second (JTrace) configuration is working? 

  • I have only tested MMD with nRF5 SDK, and the instructions in the GitHub tutorial I linked, not together with NCS or Zigbee, but I did only run it on a standard nRF52 DK. No modifications were made to the DK or J-Link FW.

    If you have the required files and commands in place, I believe you should be able to run it with the DK as well. 

    You may get some better answers regarding exactly why it does not work in the Segger Forums.

  • I will dig into this topic and will try to provide some universal open-source solution and post it here in this thread.
    Thanks for your help.

Related