Commit Graph

11 Commits (d6a48b5124f4ba8983c6e7eaf505ee4f76f52ed2)

Author SHA1 Message Date
Kevin Bracey 02330336f2 Fix target.mpu-rom-end setting, for ARMv8-M too
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.
2018-12-12 15:44:21 +02:00
Kevin Bracey 170b73442b ARMv7-M MPU: correctly protect 80000000 RAM region
Subregion mask for this region was set fully disabled, instead of fully
enabled.
2018-12-12 15:12:50 +02:00
Kevin Bracey 171e575b94 Assert MPU regions, rather than error
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.
2018-12-12 15:12:49 +02:00
Kevin Bracey 9e300013e5 MPU - use higher-level calls, fix ARMv8-M error
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.
2018-12-12 15:12:49 +02:00
Kevin Bracey 2b5518a3d8 Reduce dynamic MPU code size with a loop 2018-12-11 18:59:59 +02:00
Kevin Bracey e585eac31b Fix MPU synchronisation
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
2018-12-11 18:59:59 +02:00
Kevin Bracey 842587ddb5 Save ROM by specifying initial MPU state
We can omit the need for the "change MPU state" calls from simple images
by specifying the initial state at init.
2018-12-10 15:53:34 +02:00
Russ Butler 7cdfbee28b Fix asyle problems
Run astyle to fix CI failures.
2018-11-27 09:29:33 +00:00
Russ Butler 1821d37621 Overhaul MPU for new requirements
Make the following changes:
-Allow a vector specific ARM MPU driver by defining MBED_MPU_CUSTOM
-Allow ROM address to be configured for ARMv7-M devices by
    setting the define MBED_MPU_ROM_END
-Add ROM write protection
    -Add new functions and lock
    -enable at boot
    -disable during flash programming
2018-11-27 09:29:32 +00:00
Russ Butler a4aa5eaf93 Add v8m MPU
Add a driver for the v8m MPU.
2018-11-27 09:29:32 +00:00
Russ Butler d00f59fdc8 Rework MPU layout for future changes
Create a dedicated MPU directory for standard Arm MPU implementations
in preparation for the Arm v8m MPU. Replace MBED_MPU_ENABLED with
DEVICE_MPU to align with the porting layer of other HAL APIs.
2018-11-27 09:29:31 +00:00