Hello!
Working with the trace macros, I came across documentation that says pxCurrentTCB-> uxTaskNumber would give me the number of the task to create or was running on the CPU.
I have read the docs and search in forum, but i have not found anything that could help me in this situation.
I set the trace setting
#define configUSE_TRACE_FACILITY 1
And I defined the macros, including this header bellow at the bottom of FreeRTOSConfig.h:
However, in debugging any task, the value contained in** pxCurrentTCB-> uxTaskNumber** is always 0 and the value that was supposed to be in uxTaskNumber, for example, 2, is in uxTCBNumber, not uxTaskNumber.
Below are the screenshots of pxCurrentTCB in debug mode on Eclipse IDE.
I suspect this is because uxTCBNumber is the value you actually want,
and that uxTaskNumber is set by the Percepio trace macros (the ones that
generate trace output for FreeRTOS+Trace/Tracealyzer). Which
documentation says uxTaskNumber is used? If it is incorrect we can get
it updated.
uxTCBNumber is statically defined and no access interface provided.
tasks.h says :
/*
Get the uxTCBNumber assigned to the task referenced by the xTask parameter.
*/
UBaseType_t uxTaskGetTaskNumber( TaskHandle_t xTask ) PRIVILEGED_FUNCTION;
BUT RETURNS :
uxReturn = pxTCB->uxTaskNumber; ← NOT uxTCBNumber soooo confusing !!
Need :
UBaseType_t uxTaskGetTCBNumber( TaskHandle_t xTask )
{
}