Set configCHECK_FOR_STACK_OVERFLOW to 3 to use this method.
This method is available only for selected ports. When available, this method enables ISR stack checking. When an ISR stack overflow is detected, an assert is triggered. Note that the stack overflow hook function is not called in this case because it is specific to a task stack and not the ISR stack.
In above para, If I am configuring configCHECK_FOR_STACK_OVERFLOW to 3 it is only checking the ISR stack means it is checking MSP only right? Then what if task stack overflow happens, how can it detect?
My interpretation is that if the MPU has a dedicated stack limit register together with an exception that occurs if the limit is exceeded (for example most implementations of the ARM Cortex M33 and some implementations of the ARM Cortex M23) or other hardware to detect stack overflow, then FreeRTOS can use that. I haven’t yet written code for such a processor so I could be wrong. Such a feature makes the other types of stack checking redundant.
Yes, my understanding is that for processors that support a Stack Limit Register, the Port will generally set it up to abort a task that over runs its stack.
Yes, the check ( configCHECK_FOR_STACK_OVERFLOW > 1 )here ensures that we run level 2 checks too when configCHECK_FOR_STACK_OVERFLOW is set to 3.
configCHECK_FOR_STACK_OVERFLOW == 3 is only implemented for some ports which set up an ISR stack. Here is an example - configCHECK_FOR_STACK_OVERFLOW > 1.