A general question regarding FreeRTOS MPU for Cortex M microcontrollers. I understand that using FreeRTOSMPU a task can be created in restricted mode which restricts the stack to the memory area defined for that particular task. What I would like to ask is that when and if any task tries to access outside of the defined task or when some memory violation happens how can it be detected? Is there a macro defined for this scenario where the user may generate some trigger like setting an output or something to get a notification?
if any task
tries to access outside of the defined task or when some memory
violation happens how can it be detected?
A memory fault occurs, which causes the Cortex-M core to execute the
MemManage fault handler.
The MemManage fault handler is installed in the interrupt vector table
(exception type 4 which is at offset 0x10) and should be provided by the
application. The FreeRTOS-MPU demos provide a very simple
implementation that just unwinds the stack to find the instruction that
generated the fault.