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(0x20000000UL, ARM_MPU_SH_NON, 0UL, 1UL, 1UL), /* Non-shareable, read/write, non-privileged, execute-never */ ARM_MPU_RLAR(0x20000FFFUL, 0UL) /* 1MB memory block using Attr 0 */ ); ARM_MPU_Enable(4); // Execute application code that is access protected by the MPU ARM_MPU_Disable(); }
I'm trying to use the MPU on cortex-m23.I want to set the ram address from 0x20000000 to 0x20001000 to XN.
After the instruction execute after the ARM_MPU_Enable, any instructions after it will result in a hardfault.I have set the background attribute and it does not work.
Can anyone help me?
The scope of each forum is given in the list of forums:
and on the front page of each forum:
How was that not clear?
Perhaps you could provide feedback in the 'Community Help' forum - so that the site admins could provide better signposting:
https://community.arm.com/community-help/f/discussions
your input would be appreciated as this seems to be a very common problem.