Add a platform config to disable the MPU

Add the platform config DISABLE_MPU to allow the MPU to be disabled
from an application.
pull/9040/head
Russ Butler 2018-12-10 14:26:13 -06:00 committed by Kevin Bracey
parent c1806765dd
commit 2af6642f68
6 changed files with 9 additions and 5 deletions

View File

@ -20,7 +20,7 @@
#if ((__ARM_ARCH_7M__ == 1U) || (__ARM_ARCH_7EM__ == 1U) || (__ARM_ARCH_6M__ == 1U)) && \
defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) && \
!defined(MBED_MPU_CUSTOM)
!defined(MBED_MPU_CUSTOM) && !MBED_CONF_PLATFORM_DISABLE_MPU
#if !DEVICE_MPU
#error "Device has v7m MPU but it is not enabled. Add 'MPU' to device_has in targets.json"

View File

@ -20,7 +20,7 @@
#if ((__ARM_ARCH_8M_BASE__ == 1U) || (__ARM_ARCH_8M_MAIN__ == 1U)) && \
defined (__MPU_PRESENT) && (__MPU_PRESENT == 1U) && \
!defined(MBED_MPU_CUSTOM)
!defined(MBED_MPU_CUSTOM) && !MBED_CONF_PLATFORM_DISABLE_MPU
#if !DEVICE_MPU
#error "Device has v8m MPU but it is not enabled. Add 'MPU' to device_has in targets.json"

View File

@ -26,7 +26,7 @@
extern "C" {
#endif
#if DEVICE_MPU
#if DEVICE_MPU && !MBED_CONF_PLATFORM_DISABLE_MPU
/**
* \defgroup hal_mpu MPU hal

View File

@ -128,6 +128,10 @@
"fatal-error-auto-reboot-enabled": {
"help": "Setting this to true enables auto-reboot on a fatal error.",
"value": false
},
"disable-mpu": {
"help": "Disable the MPU to save rom.",
"value": false
}
},
"target_overrides": {

View File

@ -21,7 +21,7 @@
#include "hal/mpu_api.h"
#include <limits.h>
#if DEVICE_MPU
#if DEVICE_MPU && !MBED_CONF_PLATFORM_DISABLE_MPU
static uint16_t mem_xn_lock;
static uint16_t mem_wn_lock;

View File

@ -32,7 +32,7 @@
extern "C" {
#endif
#if DEVICE_MPU
#if DEVICE_MPU && !MBED_CONF_PLATFORM_DISABLE_MPU
/** Lock ram execute never mode off
*