Commit Graph

9 Commits (9f35e71ca59f0d99a3bcfce515bf1b9ad9b76d3a)

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
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 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