Using vApplicationTickHook()

rwilder46 wrote on Thursday, September 08, 2011:

I’d like to use xQueueSendFromISR() inside  vApplicationTickHook(). But, how does the task preemption flag pxHigherPriorityTaskWoken get passed back to the kernel, since vApplicationTickHook() has a void return value?

richard_damon wrote on Thursday, September 08, 2011:

The tick interrupt will ALWAYS do a reschedule (unless the schedule is disabled), so it doesn’t need the flag.

rwilder46 wrote on Friday, September 09, 2011:

Thank you.

Sorry to open a realy old topic
But is the previous reply still valid since this changed (performed the year after the reply):

Look like we perform a reschedule only if xTaskIncrementTick return true.

So then, may it usefull to return back the flag pxHigherPriorityTaskWoken to xSwitchRequired ?

(small patch actually in test in our project)

The problem is this is a totally not backwards compatible change.

Sure I have no doubt about this changes may over complicated to deploy because of API break.
My Question was more about if it may usefull.

I’ve gone ahead and edited your post so that the link shows. I’ll also see about getting you hyperlink permissions.

1 Like

There definitely seems to be utility in this change. At the very least we now know that at least one person finds this useful (aka you :stuck_out_tongue: ). I agree this isn’t a backwards compatible change but it can be something we keep in mind for future versions of FreeRTOS.

For now, patching for your project makes the most sense.

Update: I’ve gone ahead and created a feature request for your ask - [Feature Request] <replace with your title> · Issue #1353 · FreeRTOS/FreeRTOS-Kernel · GitHub. I think it’s a good idea but it may be a while before it is incorporated due to backwards incompatibility.

1 Like

Why can’t you do something like the following:

void vApplicationTickHook( void )
{
    BaseType_t xHigherPriorityTaskWoken = pdFALSE;

    xQueueSendFromISR( ..., &xHigherPriorityTaskWoken );

    portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}

yes can call portEND_SWITCHING_ISR before can be acceptable solution also
(our portYIELD for cortex CM4/CM7 have extra memory Barriers so then executed multiple time?)

Thank for your feedback
(I mixing 2 task manager, one basic custom made for cheap bare metal project
And with bigger project this have to work combined with freertos)

It should be fine. Let us know if you face any issue.