This has been discussed before, for example here:
Using the ARM MPU to detect stack overflow - Kernel - FreeRTOS Community Forums
This has been discussed before, for example here:
Using the ARM MPU to detect stack overflow - Kernel - FreeRTOS Community Forums