How to enable MemManage_Handler when MPU violation happens?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to enable MemManage_Handler when MPU violation happens?

4,829 次查看
anita_tranzillo
Contributor I

Hello, I have a problem wih MPU.

I'm using S32K144 uC.

I'm using MPU to detect stack overflow/underflow.

I have enabled MPU protection for two regions which surrounds the stack. 

After this, I enable MemManage_Handler and then the MPU, like this:

    S32_SCB->SHCSR |= 1<<16;
    MPU->CESR |= MPU_CESR_VLD_MASK;

The problem is that when I try to write in a protected region, HardFault exception Always occurs.

Do you have experience on this issue?

Is there any restriction to enable MemManage exception?

I have also redefined MemManage handler

void MemManage_Handler(void)

{
  FailureCbk();

since I need to apply a recovery action.

I hope you will help me

1 回复

4,500 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello Anita,
MemManage exceptions rise on an attempt to access regions that are protected by the core ARM Cortex M4 Memory Protection Unit.
However, the S32K144 MCU implements its own system Memory Protection Unit on the bus and therefore an attempt to access a protected region results in a bus fault exception instead.

pastedImage_1.png

BR, Daniel