Skip to content

Commit a29467a

Browse files
committed
Enable MemManage faults in mpu_init
1 parent 793314d commit a29467a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mpu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ void mpu_configure_region(int region, void *addr, size_t len,
6464

6565
chSysLock();
6666

67-
/* Enable MemManage faults. */
68-
SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
69-
7067
/* Update the MPU settings. */
7168
MPU->RBAR = (uintptr_t)addr + region + MPU_RBAR_VALID_Msk;
7269
MPU->RASR = rasr;
@@ -83,6 +80,9 @@ void mpu_init(void)
8380
/* Enable default memory permissions for priviledged code. */
8481
MPU->CTRL |= MPU_CTRL_PRIVDEFENA_Msk;
8582

83+
/* Enable MemManage faults. */
84+
SCB->SHCSR |= SCB_SHCSR_MEMFAULTENA_Msk;
85+
8686
/* NULL pointer protection, highest priority. */
8787
mpu_configure_region(7, NULL, 5, AP_NO_NO, false);
8888

0 commit comments

Comments
 (0)