How to enable MemManage_Handler when MPU violation happens?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to enable MemManage_Handler when MPU violation happens?

6,004件の閲覧回数
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 返信

5,675件の閲覧回数
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