Skip to content

soc: arm: stm32h7x mapping system memory region #60765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 30, 2023

Conversation

FRASTM
Copy link
Collaborator

@FRASTM FRASTM commented Jul 25, 2023

System memory declared by the MPU as 'Execute-Never' will inhibit the speculative fetch, preventing the RDSERR.

This is explained by the https://community.st.com/t5/stm32-mcu-products/spurious-rdperr-and-rdserr-when-all-protection-and-security/td-p/279852

Fixes #60449

@FRASTM FRASTM force-pushed the issue60449 branch 2 times, most recently from c32429b to dec3d41 Compare July 25, 2023 08:58
@FRASTM FRASTM marked this pull request as ready for review July 26, 2023 07:36
@FRASTM FRASTM requested a review from erwango as a code owner July 26, 2023 07:36
@zephyrbot zephyrbot added the platform: STM32 ST Micro STM32 label Jul 26, 2023
@FRASTM FRASTM force-pushed the issue60449 branch 2 times, most recently from 931f0bf to a4dfac0 Compare July 28, 2023 15:31
@FRASTM
Copy link
Collaborator Author

FRASTM commented Jul 28, 2023

rebased on 8505986
Change ATTRIBUTES to (STRONGLY_ORDERED_SHAREABLE | REGION_512K | FULL_ACCESS_Msk)

@FRASTM FRASTM requested review from mjaun and erwango July 31, 2023 08:47
Comment on lines 19 to 22
MPU_REGION_ENTRY("SYSTEM", 0x1FF00000,
{ (STRONGLY_ORDERED_SHAREABLE |
REGION_512K |
FULL_ACCESS_Msk) }),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't MPU_RASR_XN_Msk | P_RW_U_NA_Msk instead of FULL_ACCESS_Msk be more appropriate? Then it would be the same as REGION_RAM_ATTR above. But generally STRONGLY_ORDERED_SHAREABLE solves all issues in our application.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, this also removes the RDSERR (even if do not really catch the difference)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My understanding is that with MPU_RASR_XN_Msk we avoid to execute code from this region and with P_RW_U_NA_Msk we avoid that a user mode thread can access it. Both should not happen in my point of view and the configuration should therefore be a bit more secure.

System memory declared by the MPU as 'Strongly Ordered'
with region attributes which will inhibit the speculative fetch,
preventing the Flash RDSERR.

Signed-off-by: Francois Ramu <[email protected]>
@FRASTM
Copy link
Collaborator Author

FRASTM commented Aug 3, 2023

Changing attributes to MPU_RASR_XN_Msk | P_RW_U_NA_Msk

Copy link
Contributor

@mjaun mjaun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can confirm that the proposed changes solves issue #60449 in the provided sample application as well as in our productive application.

@heinwessels
Copy link
Contributor

Is there something blocking the PR from being merged?

@carlescufi carlescufi merged commit 66caf58 into zephyrproject-rtos:main Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: STM32 ST Micro STM32
Projects
None yet
Development

Successfully merging this pull request may close these issues.

STM32H7: Flash error flags are set spontaneously
7 participants