FreeRTOS Support Archive

The FreeRTOS support forum can be used for active support both from Amazon Web Services
and the community. In return for using our software for
free, we request you play fair and do your bit to help others! Sign up
to receive notifications of new support topics then help where you can.

This is a read only archive of threads posted to the FreeRTOS support forum.
The archive is updated every week, so will not always contain the very latest posts.
Use these archive pages to search previous posts. Use the Live FreeRTOS Forum
link to reply to a post, or start a new support thread.

v8.2.2 - xTaskCallApplicationTaskHook() Question

when I step through in a debugger - the task hook is called twice -
I was wondering if there was a way to have it only called once - of course this (probably) has everything to do with the parent task but I was wondering if there is a way to make sure the call only happens once per time slice of the parent task. (Or maybe the parent task in this case is getting two time slices in a row?)

Thanks,
John W.

v8.2.2 - xTaskCallApplicationTaskHook() Question

Where are you calling xTaskCallApplicationTaskHook() from, and which port are you using?

If you are calling it from traceTASKSWITCHEDOUT() then some (older) ports might call it on each tick, whereas newer ports should only call it when a context switch is actually required. The way to tell would be to look at how xTaskIncrementTick() is called in the port layer. If the return value of xTaskIncrementTick() is used to determine if vTaskSwitchContext() is called then it should traceTASKSWITCHEDOUT() should not be called on each tick, if the return value is ignored then it probably will be called on each tick.

If you are using traceTASKSWITCHEDOUT() then you can update your macro definition as follows: