Beware that this post is related to an SDK in maintenance mode
More Info: Consider nRF Connect SDK for new designs
This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Segger Embedded Studio: adding thread awareness for FreeRTOS

Has anyone succeeded in setting up the SES thread awareness for FreeRTOS with the nRF5 SDK? That would enable showing the state of the FreeRTOS tasks (threads) in the debugger, with amount of free stack, running status, resource waited etc.

I think I have already managed the SES part (links below). The remaining part probably requires editing the FreeRTOS port in the nRF5 SDK. The SES script accesses a number of variables inside the FreeRTOS implementation that need to be made non-static.

I configured SES with the instructions found from these two pages: 
https://wiki.segger.com/How_to_enable_RTOS_thread_awareness and http://forum.segger.com/index.php?page=Thread&threadID=3012 , that was quite easy. The "Threads" tab opens in SES but it remains empty.

Pertti

Parents
  • Thanks, Christian! I now use the #define portREMOVE_STATIC_QUALIFIER as well.

    I got hints of a working solution: maybe 20% of the time, when stopping the program in debugger, the execution/stack/.. is in a place where the Threads window shows about the right information (task numbers, priorities and status). It seems to have something to do with how SES finds out memory maps etc. Did not really figure out the logic yet.

    Never have seen a name of a task, the name has always been "undefined", even though the names are set when looking at the FreeRTOS lists. The .js file is over 5 years old and could be outdated - we could improve the JS part someday when we have time. Most important would be figuring out how the memory maps etc. need to be set up so that the SES Debug.evaluate() calls would always succeed.

    We run an externally build (makefile) project.

  • This post is a bit old, but since there do not seem to be any new scripts, I'll add my findings.

    After poking around a bit in the add_task function I got the task names working.
    in add_task, there is a (char *) cast in the Debug.evaluate which should not be there.

    With the following code I now have task names :-)

    function add_task(task, state)
    {
      var tcb, task_name, current_task, regs;

      current_task = Debug.evaluate("pxCurrentTCB");
      tcb = Debug.evaluate("*(TCB_t *)" + task);

      task_name = Debug.evaluate("&((tskTCB *)" + task + ").pcTaskName[0]");
      task_name = "#" + tcb.uxTCBNumber + " \"" + task_name + "\"";

    Rob

Reply
  • This post is a bit old, but since there do not seem to be any new scripts, I'll add my findings.

    After poking around a bit in the add_task function I got the task names working.
    in add_task, there is a (char *) cast in the Debug.evaluate which should not be there.

    With the following code I now have task names :-)

    function add_task(task, state)
    {
      var tcb, task_name, current_task, regs;

      current_task = Debug.evaluate("pxCurrentTCB");
      tcb = Debug.evaluate("*(TCB_t *)" + task);

      task_name = Debug.evaluate("&((tskTCB *)" + task + ").pcTaskName[0]");
      task_name = "#" + tcb.uxTCBNumber + " \"" + task_name + "\"";

    Rob

Children
No Data
Related