Stack guard is a module that helps detect stack violation which can be caused by errors in the code or by a too small stack size.
It is difficult to detect issues related to stack overflow because symptoms differ in every case and they may appear a long time after stack violation has occurred. The stack guard uses MPU (Memory Protection Unit) driver to protect a block of memory at the base of the main stack. MPU generates an exception on the first stack violation.
- Note
- When stack guard is enabled, the usable size of the stack is reduced by NRF_STACK_GUARD_CONFIG_SIZE because the protected memory block is within the stack.
For API documentation of this module, see Stack guard .