diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index 0d30d2d96b..0ab4a6a549 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -68,6 +68,7 @@ config ARCH_CHIP_KINETIS bool "Freescale Kinetis" select ARCH_CORTEXM4 select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_FPU select ARCH_HAVE_RAMFUNCS ---help--- @@ -84,6 +85,7 @@ config ARCH_CHIP_LM bool "TI/Luminary Stellaris" select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED ---help--- TI/Luminary Stellaris LMS3 and LM4F architectures (ARM Cortex-M3/4) @@ -91,6 +93,7 @@ config ARCH_CHIP_TIVA bool "TI Tiva" select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_FPU ---help--- TI Tiva TM4C architectures (ARM Cortex-M4) @@ -107,6 +110,7 @@ config ARCH_CHIP_LPC17XX select ARCH_CORTEXM3 select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED ---help--- NXP LPC17xx architectures (ARM Cortex-M3) @@ -137,6 +141,7 @@ config ARCH_CHIP_LPC43XX select ARCH_HAVE_CMNVECTOR select ARMV7M_CMNVECTOR select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_FPU ---help--- NPX LPC43XX architectures (ARM Cortex-M4). @@ -178,6 +183,7 @@ config ARCH_CHIP_SAM34 bool "Atmel SAM3/SAM4" select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_RAMFUNCS select ARMV7M_HAVE_STACKCHECK ---help--- @@ -189,6 +195,7 @@ config ARCH_CHIP_SAMV7 select ARMV7M_CMNVECTOR select ARCH_CORTEXM7 select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_RAMFUNCS select ARCH_HAVE_TICKLESS select ARMV7M_HAVE_STACKCHECK @@ -199,6 +206,7 @@ config ARCH_CHIP_STM32 bool "STMicro STM32 F1/F2/F3/F4" select ARCH_HAVE_CMNVECTOR select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_I2CRESET select ARCH_HAVE_HEAPCHECK select ARMV7M_HAVE_STACKCHECK @@ -211,6 +219,7 @@ config ARCH_CHIP_STM32F7 select ARMV7M_CMNVECTOR select ARCH_CORTEXM7 select ARCH_HAVE_MPU + select ARM_HAVE_MPU_UNIFIED select ARCH_HAVE_I2CRESET select ARCH_HAVE_HEAPCHECK select ARMV7M_HAVE_STACKCHECK @@ -416,6 +425,10 @@ config ARCH_DPFPU Enable toolchain support for double precision (64-bit) floating point if both the toolchain and the hardware support it. +config ARM_HAVE_MPU_UNIFIED + bool + default n + config ARM_MPU bool "MPU support" default n diff --git a/arch/arm/src/armv7-m/mpu.h b/arch/arm/src/armv7-m/mpu.h index fa17d4fe3f..1418ca9770 100644 --- a/arch/arm/src/armv7-m/mpu.h +++ b/arch/arm/src/armv7-m/mpu.h @@ -86,7 +86,15 @@ /* MPU Region Number Register Bit Definitions */ -#define MPU_RNR_MASK (0xff) +#ifdef CONFIG_ARM_MPU_NREGIONS <= 8 +# define MPU_RNR_MASK (0x00000007) +#elif CONFIG_ARM_MPU_NREGIONS <= 16 +# define MPU_RNR_MASK (0x0000000f) +#elif CONFIG_ARM_MPU_NREGIONS <= 32 +# define MPU_RNR_MASK (0x0000001f) +#else +# error "FIXME: Unsupported number of MPU regions" +#endif /* MPU Region Base Address Register Bit Definitions */