Skip to content

Conversation

@robhancocksed
Copy link
Contributor

This file previously defined an MPU access permission mode of 0x7 which corresponded to privileged read-only, unprivileged read-only, similar to mode 0x6. However, it appears that at least Cortex-R5 does not support this mode, defining 0x7 as UNP (Unpredictable) or a value which should not be used.

This value was in turn referenced by the REGION_FLASH_ATTR macro, which caused the offending value to be used when a memory region was declared as DT_MEM_ARM(ATTR_MPU_FLASH) in the device tree, causing such regions to not work properly on Cortex-R5.

Since 0x6 is supported by both Cortex-M and Cortex-R and does the same thing, there is no reason to use 0x7. Remove the RO_Msk definition which referenced it, and change REGION_FLASH_ATTR to use P_RO_U_RO_Msk instead.

This file previously defined an MPU access permission mode of 0x7 which
corresponded to privileged read-only, unprivileged read-only, similar to
mode 0x6. However, it appears that at least Cortex-R5 does not support
this mode, defining 0x7 as UNP (Unpredictable) or a value which should
not be used.

This value was in turn referenced by the REGION_FLASH_ATTR macro, which
caused the offending value to be used when a memory region was declared
as DT_MEM_ARM(ATTR_MPU_FLASH) in the device tree, causing such regions
to not work properly on Cortex-R5.

Since 0x6 is supported by both Cortex-M and Cortex-R and does the same
thing, there is no reason to use 0x7. Remove the RO_Msk definition which
referenced it, and change REGION_FLASH_ATTR to use P_RO_U_RO_Msk instead.

Signed-off-by: Robert Hancock <robert.hancock@calian.com>
@robhancocksed robhancocksed force-pushed the fix-cortex-r5-unsupported-permissions branch from b711405 to be51a65 Compare February 15, 2025 00:25
@wearyzen
Copy link
Contributor

wearyzen commented Mar 3, 2025

For others looking for reference, this is what I referred:

@robhancocksed
Copy link
Contributor Author

Ping? Looks like this needs an additional review.

@robhancocksed
Copy link
Contributor Author

Ping - looks like this needs another review

@JarmouniA
Copy link
Contributor

Cc @stephanosio @ithinuel

@robhancocksed
Copy link
Contributor Author

Ping - needs another review

@kartben kartben merged commit 54eeb7b into zephyrproject-rtos:main May 13, 2025
27 checks passed
@robhancocksed robhancocksed deleted the fix-cortex-r5-unsupported-permissions branch May 13, 2025 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants