# FreeRTOS MPU

**URL:** <https://forums.freertos.org/t/freertos-mpu/1906>\
**Category:** Kernel\
**Created:** [March 4, 2014, 11:50am UTC](https://forums.freertos.org/t/freertos-mpu/1906 "2014-03-04T11:50:50Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 4, 2014, 11:50am UTC](https://forums.freertos.org/t/freertos-mpu/1906/1 "2014-03-04T11:50:50Z")

</div>

**[owaisfazal](https://sourceforge.net/u/owaisfazal/)** wrote on [Tuesday, March 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/568a3c2e/#a221):

Hello,

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?

Regards,  
Owais.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [March 4, 2014, 12:09pm UTC](https://forums.freertos.org/t/freertos-mpu/1906/2 "2014-03-04T12:09:34Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, March 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/568a3c2e/#a221/c1d1):

> 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.

Regards.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [March 4, 2014, 4:05pm UTC](https://forums.freertos.org/t/freertos-mpu/1906/3 "2014-03-04T16:05:51Z")

</div>

**[owaisfazal](https://sourceforge.net/u/owaisfazal/)** wrote on [Tuesday, March 04, 2014](https://sourceforge.net/p/freertos/discussion/382005/thread/568a3c2e/#ef99):

Thank you very much.
