execution fault after enabling mpu

void test_mpu(){
	 ARM_MPU_SetMemAttr(0UL, ARM_MPU_ATTR(       /* Normal memory */
    ARM_MPU_ATTR_MEMORY_(0UL, 1UL, 1UL, 1UL), /* Outer Write-Back transient with read and write allocate */
    ARM_MPU_ATTR_MEMORY_(0UL, 0UL, 1UL, 1UL)  /* Inner Write-Through transient with read and write allocate */
  ));
	
  ARM_MPU_SetRegion(0UL,
    ARM_MPU_RBAR(0x00000000UL, ARM_MPU_SH_NON, 0UL, 1UL, 0UL),  /* Non-shareable, read/write, non-privileged, execute-never */
    ARM_MPU_RLAR(0x0000FFFFUL, 0UL)                             /* 1MB memory block using Attr 0 */
  );
  
  ARM_MPU_Enable(0x4);
	
  // Execute application code that is access protected by the MPU
  
  ARM_MPU_Disable();
}

Hi

SAML11 board. I am trying to use mpu on sam11 with the code bellow.

After enabling the MPU, any instructions follows result in a hard fault.

Has anyone met the sam problem?

Parents Reply Children
No data
More questions in this forum