-
Notifications
You must be signed in to change notification settings - Fork 3k
More MPU work #9061
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
More MPU work #9061
Conversation
Use the MPU through the platform layer rather than through the HAL.
Synchronisation instructions were not quite right - too strict on entry, and not quite correctly synchronising the instruction stream on exit. References: * https://static.docs.arm.com/dai0321/a/DAI0321A_programming_guide_memory_barriers_for_m_profile.pdf * https://static.docs.arm.com/100699/0100/armv8m_architecture_memory_protection_unit_100699_0100_00_en.pdf
Needs some more local testing - would be good if @c1728p9 could have a look at ARMv8-M in particular. Also intending one more commit to change MBED_ERRORs to MBED_ASSERTs. |
@kjbracey-arm Don't forget the astyle fix :) |
c212214
to
3477c45
Compare
Adjusted a bit more, making ARMv7-M use higher-level API too. ARMv7-M init code now down to 170 bytes from 215. |
3477c45
to
7631745
Compare
Please review astyle travis CI |
7631745
to
ced5cb9
Compare
Full mbed_mpu_v7m.c + mbed_mpu_mgmt.c is now 246+351 = 597, down from 659 in current master. |
ced5cb9
to
5635188
Compare
Switch to higher-level calls and macros, and fix an error in the ARMv8-M version - "inner" attributes were not being set correctly due to a copy/paste error - "outer" was being set twice. This means RAM would have been marked WTRA rather than WBWA for the inner cache. Slightly reduces ARMv7-M init code size by feeding region number into RBAR instead of using RNR.
As we build for a specific CPU, a runtime check for number of MPU regions in release builds is not worthwhile. Make it an assert only. Saves a little space in develop images, a lot in release.
Subregion mask for this region was set fully disabled, instead of fully enabled.
c3f55f3
to
cc5049f
Compare
Two more bugs found - Fixed up, including making mpu-rom-end work on ARMv8-M - was simpler than figuring out what to do to not hit the "not supported" test once JSON was fixed. Also will save a few more bytes if you do set mpu-rom-end to 0x1fffffff. |
d4d5fca
to
8ee286e
Compare
targets.json was not specifying the same macro name as the code was checking for, so setting was ineffective. Making this work tripped up not-supported checks in ARMv8-M - rather than deal with making this work, support it instead. Both ARMv7-M and ARMv8-M slightly reduce code size and runtime impact if mpu-rom-end is 0x1fffffff, using one fewer region. This means default setup for ARMv8-M now requires 5 regions, with mpu-rom-end set to default 0x0fffffff, but this can be put back to 4 by changing the setting.
So we have at least one test platform exercising the special case of mpu-rom-end being 0x1fffffff, set that for nRF52840.
a3124a5
to
574f9fa
Compare
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
This does really need rereview - I did some more significant stuff since @c1728p9 last looked at it. |
Hmm... I wonder. I recall a time when GitHub would auto-dismiss reviews when a change was made. |
Significant changes have occurred. Please re-review.
Move the start of RAM from 0x10000000 to 0x20000000 on the NUMAKER_PFM_M2351. This allows the target to work correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested this on a NUMAKER_PFM_M2351
and got crashes on boot due to the MPU. I pushed a commit to update the ram/rom split for this target to correct the crashes. This PR looks good to me. Thanks @kjbracey-arm!
CI started |
Test run: SUCCESSSummary: 11 of 11 test jobs passed |
Description
platform.use-mpu
is turned off.Pull request type