arch: arm: arm_mpu_v7m: Fix unsupported Cortex-R access permission mode #85812
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.