Calling portEND_SWITCHING_ISR() with Cooperative Scheduling.

medaver wrote on Thursday, May 31, 2018:

I’m running FreeRTOS on the SAMV71 in cooperative mode. I’m having an issue where tasks unexpectedly seem to get preempted.

Will calling portEND_SWITCHING_ISR() form an ISR (with xProrityTaskWoken set) cause a lower priority task to get preempted? Or does the lower priority task need to yield before a context switch occurs?

If the lower priority task must yield first, is there any reason to call portEND_SWITCHING_ISR() from an ISR when using cooperative scheduling?

rtel wrote on Thursday, May 31, 2018:

Calling porEND_SWITCHING_ISR() is effectively asking for a yield. Other
ports call the same macro portYIELD_FROM_ISR() (in fact, I thought that
was what it was called in the Cortex-M7 demo). So yes - calling
portEND_SWITCHING_ISR() will cause a context switch just as calling
taskYIELD() would from a task.

richard_damon wrote on Friday, June 01, 2018:

In some ways, if premption is turned off, portEND_SWITCHING_ISR() should be created as an empty macro, so that the decision to use premption automatically get reflected in the ISRs.

medaver wrote on Monday, June 04, 2018:

Both portEND_SWITCHING_ISR() and portYIELD_FROM_ISR() are defined (the same) in the CM7 portmacro.h header.

I created a modifed version of portEND_SWITCHING_ISR() that only calls taskYield() if the Idle-Task is the current task (when preemption is turned off).

Thank you for the clarification.