soc: arm: beetle: Add Initial MPU Support
This patch adds initial MPU support to ARM Beetle. The boot configuration prevents the following security issues: * Prevent to read at an address that is reserved in the memory map. * Prevent to write into the boot Flash/ROM. * Prevent from running code located in SRAM. Change-Id: I64f1001369896fffb0647de6be605a95161c4695 Signed-off-by: Vincenzo Frascino <vincenzo.frascino@linaro.org>
This commit is contained in:
parent
e37214062c
commit
b125767fdb
5 changed files with 51 additions and 0 deletions
|
@ -9,6 +9,7 @@
|
||||||
config ARM_MPU
|
config ARM_MPU
|
||||||
bool "ARM MPU Support"
|
bool "ARM MPU Support"
|
||||||
depends on CPU_HAS_MPU
|
depends on CPU_HAS_MPU
|
||||||
|
depends on SOC_FAMILY_ARM || SOC_FAMILY_STM32
|
||||||
default n
|
default n
|
||||||
help
|
help
|
||||||
MCU has ARM MPU
|
MCU has ARM MPU
|
||||||
|
|
|
@ -13,5 +13,6 @@ config SOC_SERIES_BEETLE
|
||||||
select CPU_CORTEX_M3
|
select CPU_CORTEX_M3
|
||||||
select SOC_FAMILY_ARM
|
select SOC_FAMILY_ARM
|
||||||
select CPU_HAS_SYSTICK
|
select CPU_HAS_SYSTICK
|
||||||
|
select CPU_HAS_MPU
|
||||||
help
|
help
|
||||||
Enable support for Beetle MCU Series
|
Enable support for Beetle MCU Series
|
||||||
|
|
|
@ -14,3 +14,11 @@ config SOC_BEETLE_R0
|
||||||
bool "ARM BEETLE R0"
|
bool "ARM BEETLE R0"
|
||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config ARM_MPU_ENABLE
|
||||||
|
bool "Enable MPU"
|
||||||
|
depends on CPU_HAS_MPU
|
||||||
|
select ARM_MPU
|
||||||
|
default n
|
||||||
|
help
|
||||||
|
Enable MPU
|
||||||
|
|
|
@ -7,3 +7,4 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
obj-y += soc.o power.o
|
obj-y += soc.o power.o
|
||||||
|
obj-$(CONFIG_ARM_MPU_ENABLE) += arm_mpu_regions.o
|
||||||
|
|
40
arch/arm/soc/arm/beetle/arm_mpu_regions.c
Normal file
40
arch/arm/soc/arm/beetle/arm_mpu_regions.c
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2017 Linaro Limited.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <soc.h>
|
||||||
|
#include <arch/arm/cortex_m/mpu/arm_mpu.h>
|
||||||
|
|
||||||
|
static struct arm_mpu_region mpu_regions[] = {
|
||||||
|
/* Region 0 */
|
||||||
|
MPU_REGION_ENTRY("FLASH_0",
|
||||||
|
CONFIG_FLASH_BASE_ADDRESS,
|
||||||
|
REGION_FLASH_ATTR(REGION_256K)),
|
||||||
|
/* Region 1 */
|
||||||
|
MPU_REGION_ENTRY("RAM_0",
|
||||||
|
CONFIG_SRAM_BASE_ADDRESS,
|
||||||
|
REGION_RAM_ATTR(REGION_128K)),
|
||||||
|
/* Region 2 */
|
||||||
|
MPU_REGION_ENTRY("APB_0",
|
||||||
|
_BEETLE_APB_BASE,
|
||||||
|
REGION_IO_ATTR(REGION_64K)),
|
||||||
|
/* Region 3 */
|
||||||
|
MPU_REGION_ENTRY("AHB_0",
|
||||||
|
_BEETLE_AHB_BASE,
|
||||||
|
REGION_IO_ATTR(REGION_64K)),
|
||||||
|
/* Region 4 */
|
||||||
|
MPU_REGION_ENTRY("BITBAND_0",
|
||||||
|
_BEETLE_BITBAND_BASE,
|
||||||
|
REGION_IO_ATTR(REGION_32M)),
|
||||||
|
/* Region 5 */
|
||||||
|
MPU_REGION_ENTRY("PPB_0",
|
||||||
|
_BEETLE_PPB_BASE,
|
||||||
|
REGION_PPB_ATTR(REGION_1M)),
|
||||||
|
};
|
||||||
|
|
||||||
|
struct arm_mpu_config mpu_config = {
|
||||||
|
.num_regions = ARRAY_SIZE(mpu_regions),
|
||||||
|
.mpu_regions = mpu_regions,
|
||||||
|
};
|
Loading…
Add table
Add a link
Reference in a new issue