Freertos debug issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Freertos debug issue

Jump to solution
3,212 Views
biafra
Senior Contributor I

Hi everyone,

 

I'm having a trouble in debugging a simple FreeRTOS project.

I'm using a MIMXRT1024-EVK board, MCUXpresso 11.5.0 and SDK 2.11.0.

The program is working fine, when I pause debugging, the debug view displays all threads, but no task is displayed in the FreeRTOS task list view; in all other FreeRTOS views are correctly displayed (except the timer list view, but no timer is created in my program, so I think this is the correct behaviour).

biafra_0-1642778260724.png

biafra_1-1642778495679.png

biafra_3-1642778743730.png

 

What do I have to check to correct this issue?

 

Many thanks

Biafra

 

1 Solution
3,202 Views
ErichStyger
Senior Contributor V

Yes, you only will see something in the Timer view if there actually timers running by the application.

As for the Task views: Can you check the console view output? Usually it reports the issue there.

I have collected some tips as well here:

https://mcuoneclipse.com/2017/07/27/troubleshooting-tips-for-freertos-thread-aware-debugging-in-ecli...

 

I hope this helps,

Erich

View solution in original post

4 Replies
3,138 Views
biafra
Senior Contributor I

Hi @ErichStyger,

 

I found the reason, in my FreeRTOSConfig.h there was:

#define configENABLE_BACKWARD_COMPATIBILITY 1

 

Now I've modified as:

#define configENABLE_BACKWARD_COMPATIBILITY 0

 

And it works.

 

In FreeRTOS.h there is this code:

#if configENABLE_BACKWARD_COMPATIBILITY == 1
    ...
    #define pxContainer pvContainer
#endif /* configENABLE_BACKWARD_COMPATIBILITY */

 

Many thanks

Biafra

 

3,194 Views
biafra
Senior Contributor I

Hi @ErichStyger,

Many thanks for your quick answer.

The string "FreeRTOS stack backtrace is enabled" is present in the Debug messages view.

These messages are in the FreeRTOS Task Aware Debugger Console view:

16:49:48.607 INFO: [Benchmark] Loading data for "Determine RTOS version" has started.
16:49:48.643 INFO: [FreeRtosTadModel] Heap type (memory allocation scheme) has been identified from FreeRTOSDebugConfig structure as Heap #4.
16:49:48.643 INFO: [FreeRtosTadModel] FreeRTOS version has been identified from FreeRTOSDebugConfig structure as 10.4.3.
16:49:48.643 INFO: [Benchmark] Loading data for "Determine RTOS version" took 36 ms.
16:49:48.643 INFO: [Benchmark] Loading data for "Task List" has started.
16:49:50.366 ERROR: [VariableReader] Could not read variable expression: "(((struct tskTaskControlBlock *) 0x20000b68)->xEventListItem.pxContainer)".
16:49:50.366 ERROR: [TaskFactory] Cannot read information from "pxReadyTasksLists[0]".
16:49:50.847 ERROR: [VariableReader] Could not read variable expression: "(((struct tskTaskControlBlock *) 0x20000fc0)->xEventListItem.pxContainer)".
16:49:50.848 ERROR: [TaskFactory] Cannot read information from "xSuspendedTaskList".
16:49:51.239 ERROR: [VariableReader] Could not read variable expression: "(((struct tskTaskControlBlock *) 0x20000970)->xEventListItem.pxContainer)".
16:49:51.239 ERROR: [TaskFactory] Cannot read information from "pxDelayedTaskList".
16:49:51.292 INFO: [Benchmark] Loading data for "Task List" took 2649 ms.

These messages are in the LinkServer Debug [C/C++ (NXP Semiconductors) MCU Application] gdb traces view:

...
190,321 (gdb)
190,321 202-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000b68)->uxTaskNumber)"
190,339 202^done,value="0"
190,339 (gdb)
190,340 203-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000b68)->uxTCBNumber)"
190,354 203^done,value="2"
190,354 (gdb)
190,355 204-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000b68)->xEventListItem.pxContainer)"
190,365 204^error,msg="There is no member named pxContainer."
190,365 (gdb)
190,366 205-data-evaluate-expression pxReadyTasksLists[1].uxNumberOfItems
190,384 205^done,value="0"
190,384 (gdb)
...
190,771 (gdb)
190,772 224-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000fc0)->uxTaskNumber)"
190,791 224^done,value="0"
190,792 (gdb)
190,792 225-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000fc0)->uxTCBNumber)"
190,821 225^done,value="3"
190,822 (gdb)
190,822 226-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000fc0)->xEventListItem.pxContainer)"
190,846 226^error,msg="There is no member named pxContainer."
190,846 (gdb)
190,848 227-data-evaluate-expression xPendingReadyList.uxNumberOfItems
190,866 227^done,value="0"
190,866 (gdb)
...
191,173 (gdb)
191,174 240-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000970)->uxTaskNumber)"
191,197 240^done,value="0"
191,197 (gdb)
191,198 241-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000970)->uxTCBNumber)"
191,212 241^done,value="1"
191,212 (gdb)
191,212 242-data-evaluate-expression "(((struct tskTaskControlBlock *) 0x20000970)->xEventListItem.pxContainer)"
191,237 242^error,msg="There is no member named pxContainer."
191,237 (gdb)
191,239 243-data-evaluate-expression pxOverflowDelayedTaskList.uxNumberOfItems
191,262 243^done,value="0"
191,262 (gdb)
...

It seems that there is a problem on accessing to pxContainer field, but I'm not able to understand it.

Many thanks

Biafra

3,184 Views
ErichStyger
Senior Contributor V

Hi @biafra ,

pxContainer is an internal struct field inside the kernel, or better: it is used for the kernel lists. You should be able to see this your grep the RTOS sources:

ErichStyger_0-1642788370612.png

There could be multiple reasons why it is not able to find it. Most likely you are using an older RTOS (I believe in older FreeRTOS versions that field name was different). In order to have the plugin detect and deal with different RTOS versions, it needs to know this with e.g. with the file freertos_task_c_additions.h which you should have present in your project.You can see this file for example in https://mcuoneclipse.com/2020/05/31/tutorial-adding-freertos-to-where-there-is-no-freertos/  or here: https://github.com/ErichStyger/McuOnEclipseLibrary/blob/master/lib/FreeRTOS/Source/include/freertos_...

From your log, it seems that you already have that part present:
16:49:48.643 INFO: [FreeRtosTadModel] FreeRTOS version has been identified from FreeRTOSDebugConfig structure as 10.4.3.

 

Additionally, the stock FreeRTOS.org and nxp.com FreeRTOS sometimes is not able to deal with higher level compiler and linker optimizations. This is why I maintain a special FreeRTOS port on https://github.com/ErichStyger/McuOnEclipseLibrary . You could use that one as a drop-in replacement, just in case.

I hope this helps,

Erich

3,203 Views
ErichStyger
Senior Contributor V

Yes, you only will see something in the Timer view if there actually timers running by the application.

As for the Task views: Can you check the console view output? Usually it reports the issue there.

I have collected some tips as well here:

https://mcuoneclipse.com/2017/07/27/troubleshooting-tips-for-freertos-thread-aware-debugging-in-ecli...

 

I hope this helps,

Erich