[SOLVED] FreeRTOS + Nordic thread awareness scripts

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [SOLVED] FreeRTOS + Nordic thread awareness scripts

    I spent some time getting thread awareness scripts working for FreeRTOS on a Nordic nRF52840 device and thought I'd share my findings in case anyone else is having similar issues.

    I'm using SES 5.10b on Windows 10, and I started by going into Project Options, Debug, Debugger, and set the RTOS Awareness option to FreeRTOS CM4. This should automatically change the Threads Script File option to $(StudioDir)/samples/FreeRTOSPlugin_CM4.js.

    When I then debugged the app, I received several error popups when hitting a breakpoint, usually in the functions GetTCB or GetTaskName in the script file.

    I traced the issue to the update function in the line:

    MaxPriority = Debug.evaluate("uxTopReadyPriority");

    In the default Nordic FreeRTOSConfig.h, configUSE_PORT_OPTIMISED_TASK_SELECTION is 1, which sets uxTopReadyPriority up as a bitmap and confuses the script. The quickest way I found to fix it was to disable configUSE_PORT_OPTIMISED_TASK_SELECTION for my Debug configuration, e.g.

    #define configUSE_PORT_OPTIMISED_TASK_SELECTION ( DEBUG ? 0 : 1 )

    I did not require it, but note that there is also a portREMOVE_STATIC_QUALIFIER option you can define which may help if you have issues with older versions of SES or FreeRTOS (see comment in FreeRTOS tasks.c).

    The older threads_CM4F.js script from the SEGGER Wiki page also worked.

    I'm also using Monitor Mode Debugging, so the combination of these two features has been very helpful (thank you SEGGER).

    I hope this information is useful to someone.

    The post was edited 1 time, last by kklobe: fixed incorrect Threads Script File value ().

  • Thanks, really useful.


    kklobe wrote:

    'm also using Monitor Mode Debugging, so the combination of these two features has been very helpful (thank you SEGGER).
    Can you share your experience of using the debug monitor with nrf52840?
    I would like to see how to properly configure it for this chip. If I understand correctly, the monitor will not work on DK. Are you using a tracer?