MPU is enabled with GPIO sample code for nucleo_l552ze_q successfully, But the behavior of the MPU access permissions are not expected. I am able to read and write the MPU ram region from both privilege and unprivileged space for read-only access permission. Below code is able to write data into mpu region even for read only access. Kindly reply with your valuable suggestions to make it work for all the access permissions.
Please find the below attached code snippet:
{/*Disable MPU */ ARM_MPU_Disable();
ARM_MPU_SetRegion_NS(0UL,ARM_MPU_RBAR(0x20000000UL, ARM_MPU_SH_NON, 1UL, 1UL, 0UL), /* Non-shareable , read-only=1, privileged=0/unprivilege=1, execute-never */ARM_MPU_RLAR(0x20040000UL, 0UL) /* 1MB memory block using Attr 0 */);
/*Enable MPU */ARM_MPU_Enable(1);
uint32_t *mpu_ptr = (uint32_t*)0x20000000 ;*mpu_ptr = 10;}
Hi there, thank you for asking a question. Please can you look at the list of Support Forums here: https://community.arm.com/support-forums/ and let me know where to move your question to?
Embedded Forum [https://community.arm.com/support-forums/f/embedded-forum]
Thank you, I have moved your question now.