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

IAR Monitor Mode Debugging not linking correctly

I'm attempting to get MMD set up in an IAR project following this tutorial: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/monitor-mode-debugging---revolutionize-the-way-you-debug-ble-applications.

The top of the page has a link to a newer tutorial, but the new tutorial only deals with SES. I've got the project working with MMD in SES, but need to port it to IAR.

Here's what I have:

1. Project compiles fine in IAR. This includes: JLINK_MONITOR.c, JLINK_MONITOR.h, and JLINK_MONITOR_ISR_IAR.s. All three of these files can be found linked in the tutorial.

2. Project includes the EnableMonMode.mac file linked in the tutorial, with SetMonModeVTableAddr=0x1C000, which I believe is the location of the VTable with SoftDevice 133/NRF52 devices.

The project compiles fine, but does not link. I get the following errors when it links:

- "Error[Li005]: no definition for "JLINK_MONITOR_OnEnter"

- "Error[Li005]: no definition for "JLINK_MONITOR_OnPoll"

- "Error[Li005]: no definition for "JLINK_MONITOR_OnExit"

These functions are of course defined in JLINK_MONITOR.c. However, they are defined only if CONFIG_JLINK_MONITOR_ENABLED is defined, which it apparently is not.

I've tried just defining CONFIG_JLINK_MONITOR_ENABLED, both in the code and in the preprocessor portion of the compiler options. This gets everything to link, but MMD does not work when I program the device (get hard faults when I put a breakpoint, for instance, and do not see the MMD pop-ups).

So, I think there must be a very simple answer to my question that I'm just missing. Everything I see about MMD seems to suggest it's fairly turnkey, so as long as I have the right files, which I think I do, and set up the files correctly it should just work.

There isn't a whole lot of information on MMD with IAR other than the out of date tutorial. Can someone please assist with this? It seems I could have one of two problems, either I just need to define CONFIG_JLINK_MONITOR_ENABLED and then fix a problem with my JLINK, or the MMD files are out of date and do not work.

I've tried the tutorial on both my main development project and a simple example from the SDK (ble_app_uart). The projects function fine without MMD, in so far as they advertise and are connectable with BLE devices.

Parents
  • SetMonModeVTableAddr=0x1C000

     This should be 0x26000 for S132 for SDK 15 and 16.

    Have you enabled the ISR? 
    "NVIC_SetPriority(DebugMonitor_IRQn, 6ul);"

  • Haakonsh,

    As RTMerkel said below, we are using s113, not s132. My apologies for writing s133 earlier. It was a typo.

    I think I did find out what's going on, or at least get closer to an answer.

    I define CONFIG_JLINK_MONITOR_ENABLED in the preprocessor and everything compiles and links just fine, like I said above. I then added --drv_vector_table_base=0x1C000 in Project->Debugger->Extra Options. With this, I can step through code just fine. However, when I go to reprogram, I need to fully erase the device before programming.

    It seems I'm very close. Is 0x1C000 the correct location for the vector table? There should be a solution where we don't need to fully erase the flash before reprogramming with the SoftDevice, correct?

  • Are you combining in the SoftDevice hex file in IAR? If not then adding this does automatic erase and download, need to specify correct version of course ..

    Project->Options->Debugger->Images->Download Extra Image:.\HexFiles\Releases\s113_nrf52_6.1.1_softdevice.hex

  • Thanks hmolesworth,

    We do have the extra image for the SoftDevice set to download. It seems that if we get a fault during init, we have to fully erase the device in order for it to work, and this has to be done in something like NRF Connect rather than IAR. This could definitely be an issue in our project rather than anything on Nordic's end. We are investigating.

Reply Children
Related