MPU FAULT, Stack Guard, and Hard Faults


Hello, I'm using the nrf v2.3.0 SDK on a 5340 and 7200 platform.  I'm trying to get hooks into some of the lower level fault handling.


Reading through dev zone tickets, it looks like STACK_SENTINEL is not needed if MPU is configured to be enabled.


Is it true that the MPU will detect stack overflows on each of my threads?


Is there an example of how to detect when this happens, i.e. a callback that I can override to detect it and store some information in NVS?

Related, is there an example of how to do the same thing generically with the hard fault handler?

There are a number of hits and documentation listed on the devzone, but many are out of date, for example:

https://devzone.nordicsemi.com/f/nordic-q-a/47040/stack-overflow-and-stack-guard
https://devzone.nordicsemi.com/f/nordic-q-a/90620/stack-guard-module-raises-hard-fault-not-mmu-fault
https://infocenter.nordicsemi.com/index.jsp?topic=%2Fsdk_nrf5_v17.1.0%2Flib_hardfault.html&cp=8_1_3_22

Thanks

W

Related