Exclude MPU manager code if MPU disabled

Save around 400 bytes from images using FlashIAP by omitting MPU manager
reference counting if DEVICE_MPU is 0.
pull/9064/head
Kevin Bracey 2018-12-10 14:22:56 +02:00 committed by Cruz Monrreal II
parent 784c80f9e9
commit bb4cb774a2
2 changed files with 18 additions and 0 deletions

View File

@ -20,6 +20,8 @@
#include "hal/mpu_api.h" #include "hal/mpu_api.h"
#include <limits.h> #include <limits.h>
#if DEVICE_MPU
static uint16_t mem_xn_lock; static uint16_t mem_xn_lock;
static uint16_t mem_wn_lock; static uint16_t mem_wn_lock;
@ -78,3 +80,5 @@ void mbed_mpu_manager_unlock_rom_write()
} }
core_util_critical_section_exit(); core_util_critical_section_exit();
} }
#endif

View File

@ -32,6 +32,8 @@
extern "C" { extern "C" {
#endif #endif
#if DEVICE_MPU
/** Lock ram execute never mode off /** Lock ram execute never mode off
* *
* This disables the MPU's execute never ram protection and allows * This disables the MPU's execute never ram protection and allows
@ -80,6 +82,18 @@ void mbed_mpu_manager_lock_rom_write(void);
*/ */
void mbed_mpu_manager_unlock_rom_write(void); void mbed_mpu_manager_unlock_rom_write(void);
#else
#define mbed_mpu_manager_lock_ram_execution() (void)0
#define mbed_mpu_manager_unlock_ram_execution() (void)0
#define mbed_mpu_manager_lock_rom_write() (void)0
#define mbed_mpu_manager_unlock_rom_write() (void)0
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif