This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

What happens if a same priority exception came while context-switch is executing?

Hello, I meet a problem while using Spin Model Checker to verify a RTOS kernel based on Cortex-m3 platform.

My PendSV is in the lowest priority 16 and perform to schedule next user task and context switch. While PendSV is executing, another exception with same priority 16 comes in. The exception will be in pending state due to the same priority of PendSV. Meanwhile, the PendSV has the higher exception number than the pending exception and the subpriority group is not been set.

Due to the rule of priority group, the later exception will be pending while it has the same priority with current exception and executes after the exception return of the current exception. However, the PendSV is performing the context switch, the user task may not be the same after the exception return. In this situation, the exception will preempt the new user task, but it was occurred while the previous user task was executing.

Or, the exception will preempt PendSV immediately but the PendSV has a higher exception number? I am not sure which situation mention above is true or non of the situations are true?

I believe first situation is close due to the documentations, but the exception occured in previous user task can preempt new user task is confusing me a long time.

kaizsv