I am busy putting together a set of traceXXXX macros covering the whole
scope of functions. Essentially I am mapping all functions into 3
different categories being:
vFreeRTOSTraceTASK(): all task related functions
vFreeRTOSTraceQUEUE(): queue, mutex and semaphore
vFreeRTOSTraceTIMER(): timer related functions
Within each of the functions I am just streaming max 8 character string
(built compact just identifying the object and event) as fast and direct
as possible to the UART.
What I have noticed is that with counting semaphores, no parameter is
passed. When compared with queues and mutexes, I would have assumed
passing the xHandle value would make sense. Am I missing something, a
reason why nothing is passed?
Some of the macros were updated to accommodate the specific needs of the FreeRTOS+Trace tool, so it might be related to that.
Can you give a specific example of a queue trace macro that does include the paraemter, and a mutex macro that doesn’t include the parameter, so I may be able to give a more specific answer.
In the case of a counting semaphore more than one trace macro is
invoiced, first the macros in xQueueGenericCreate() [which is itself
called by xQueueCreateCountingSemaphore()] and then
traceCREATE_COUNTING_SEMAPHORE() - so presumably the handle is already
known from when xQueueGenericCreate() was called.
You can still obtain the handle, but you would need to look at the code
to see what the handle was called at the point the macro was called. In
the case highlighted it is simply “xHandle”.
Just looking at the macro definitions used by FreeRTOS+Trace (which are
in /FreeRTOS-Plus/Source/FreeRTOS-Plus-Trace/Include/trcKernelPort.h) it
appears traceCREATE_COUNTING_SEMAPHORE() is not used - so maybe that is
why it never had the parameter?