Calling portEND_SWITCHING_ISR() with Cooperative Scheduling.

I’m running FreeRTOS on the SAMV71 in cooperative mode. I’m having an issue where tasks unexpectedly seem to get preempted. Will calling portENDSWITCHINGISR() 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 portENDSWITCHINGISR() from an ISR when using cooperative scheduling?

Calling portEND_SWITCHING_ISR() with Cooperative Scheduling.

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

Calling portEND_SWITCHING_ISR() with Cooperative Scheduling.

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

Calling portEND_SWITCHING_ISR() with Cooperative Scheduling.

Both portENDSWITCHINGISR() and portYIELDFROMISR() are defined (the same) in the CM7 portmacro.h header. I created a modifed version of portENDSWITCHINGISR() that only calls taskYield() if the Idle-Task is the current task (when preemption is turned off). Thank you for the clarification.