File tree Expand file tree Collapse file tree 7 files changed +15
-13
lines changed
Expand file tree Collapse file tree 7 files changed +15
-13
lines changed Original file line number Diff line number Diff line change 2020
2121#if ((__ARM_ARCH_7M__ == 1U ) || (__ARM_ARCH_7EM__ == 1U ) || (__ARM_ARCH_6M__ == 1U )) && \
2222 defined (__MPU_PRESENT ) && (__MPU_PRESENT == 1U ) && \
23- !defined(MBED_MPU_CUSTOM ) && ! MBED_CONF_PLATFORM_DISABLE_MPU
23+ !defined(MBED_MPU_CUSTOM )
2424
2525#if !DEVICE_MPU
2626#error "Device has v7m MPU but it is not enabled. Add 'MPU' to device_has in targets.json"
Original file line number Diff line number Diff line change 2020
2121#if ((__ARM_ARCH_8M_BASE__ == 1U ) || (__ARM_ARCH_8M_MAIN__ == 1U )) && \
2222 defined (__MPU_PRESENT ) && (__MPU_PRESENT == 1U ) && \
23- !defined(MBED_MPU_CUSTOM ) && ! MBED_CONF_PLATFORM_DISABLE_MPU
23+ !defined(MBED_MPU_CUSTOM )
2424
2525#if !DEVICE_MPU
2626#error "Device has v8m MPU but it is not enabled. Add 'MPU' to device_has in targets.json"
Original file line number Diff line number Diff line change 2626extern "C" {
2727#endif
2828
29- #if DEVICE_MPU && ! MBED_CONF_PLATFORM_DISABLE_MPU
29+ #if DEVICE_MPU
3030
3131/**
3232 * \defgroup hal_mpu MPU hal
Original file line number Diff line number Diff line change 129129 "help" : " Setting this to true enables auto-reboot on a fatal error." ,
130130 "value" : false
131131 },
132- "disable -mpu" : {
133- "help" : " Disable the MPU to save rom ." ,
134- "value" : false
132+ "use -mpu" : {
133+ "help" : " Use the MPU if available to fault execution from RAM and writes to ROM. Can be disabled to reduce image size ." ,
134+ "value" : true
135135 }
136136 },
137137 "target_overrides" : {
Original file line number Diff line number Diff line change 1616
1717#include "platform/mbed_mpu_mgmt.h"
1818#include "platform/mbed_critical.h"
19- #include "platform/mbed_error.h"
2019#include "platform/mbed_assert.h"
2120#include "hal/mpu_api.h"
2221#include <limits.h>
2322
24- #if DEVICE_MPU && ! MBED_CONF_PLATFORM_DISABLE_MPU
23+ #if DEVICE_MPU && MBED_CONF_PLATFORM_USE_MPU
2524
2625static uint16_t mem_xn_lock ;
2726static uint16_t mem_wn_lock ;
Original file line number Diff line number Diff line change 2323#ifndef MBED_MPU_MGMT_H
2424#define MBED_MPU_MGMT_H
2525
26- #include "hal/sleep_api.h"
2726#include "mbed_toolchain.h"
28- #include "hal/ticker_api .h"
27+ #include "hal/mpu_api .h"
2928#include <stdbool.h>
3029
3130#ifdef __cplusplus
3231extern "C" {
3332#endif
3433
35- #if DEVICE_MPU && !MBED_CONF_PLATFORM_DISABLE_MPU
34+ #if (DEVICE_MPU && MBED_CONF_PLATFORM_USE_MPU ) || defined(DOXYGEN_ONLY )
35+
36+ #define mbed_mpu_manager_init () mbed_mpu_init()
3637
3738/** Lock ram execute never mode off
3839 *
@@ -84,6 +85,8 @@ void mbed_mpu_manager_unlock_rom_write(void);
8485
8586#else
8687
88+ #define mbed_mpu_manager_init () (void)0
89+
8790#define mbed_mpu_manager_lock_ram_execution () (void)0
8891
8992#define mbed_mpu_manager_unlock_ram_execution () (void)0
Original file line number Diff line number Diff line change 7676#include "mbed_toolchain.h"
7777#include "mbed_boot.h"
7878#include "mbed_error.h"
79- #include "mpu_api .h"
79+ #include "mbed_mpu_mgmt .h"
8080
8181int main (void );
8282static void mbed_cpy_nvic (void );
@@ -87,7 +87,7 @@ uint32_t mbed_stack_isr_size = 0;
8787
8888void mbed_init (void )
8989{
90- mbed_mpu_init ();
90+ mbed_mpu_manager_init ();
9191 mbed_cpy_nvic ();
9292 mbed_sdk_init ();
9393 mbed_rtos_init ();
You can’t perform that action at this time.
0 commit comments