Skip to content

Commit 08f5fb5

Browse files
Julien Massotcarlescufi
authored andcommitted
soc: arm: fvp_aemv8r_aarch32: define static mpu regions
Add static MPU regions for this SoC. These regions will be initialized as static region during system boot. Signed-off-by: Julien Massot <[email protected]> Signed-off-by: Manuel Arguelles <[email protected]>
1 parent ddcc5fb commit 08f5fb5

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
# Copyright (c) 2022 IoT.bzh
22
# SPDX-License-Identifier: Apache-2.0
3+
4+
zephyr_library_sources_ifdef(CONFIG_ARM_MPU arm_mpu_regions.c)

soc/arm/arm/fvp_aemv8r_aarch32/Kconfig.defconfig.series

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ config FLASH_SIZE
2626
config FLASH_BASE_ADDRESS
2727
default $(dt_chosen_reg_addr_hex,$(DT_CHOSEN_Z_FLASH))
2828

29+
config MAX_DOMAIN_PARTITIONS
30+
default 24 if USERSPACE
31+
2932
endif # SOC_FVP_AEMV8R_AARCH32
3033

3134
endif # SOC_SERIES_FVP_AEMV8R_AARCH32

soc/arm/arm/fvp_aemv8r_aarch32/Kconfig.soc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ choice
88
config SOC_FVP_AEMV8R_AARCH32
99
bool "ARM FVP AEMv8R aarch32 simulation"
1010
select CPU_CORTEX_R52
11+
select CPU_HAS_ARM_MPU
1112
select CPU_HAS_MPU
1213
select GIC_V3
1314
select GIC_SINGLE_SECURITY_STATE
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
/*
2+
* Copyright (c) 2022 IoT.bzh
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
#include <zephyr/sys/slist.h>
7+
#include <zephyr/linker/linker-defs.h>
8+
#include <zephyr/arch/arm/aarch32/mpu/arm_mpu.h>
9+
10+
#define DEVICE_REGION_START 0x80000000UL
11+
#define DEVICE_REGION_END 0xFFFFFFFFUL
12+
13+
static const struct arm_mpu_region mpu_regions[] = {
14+
/* Region 0 zephyr vector */
15+
MPU_REGION_ENTRY("vector",
16+
(uintptr_t)_vector_start,
17+
REGION_RAM_TEXT_ATTR((uintptr_t)_vector_end)),
18+
19+
/* Region 1 zephyr text */
20+
MPU_REGION_ENTRY("SRAM_0",
21+
(uintptr_t)__text_region_start,
22+
REGION_RAM_TEXT_ATTR((uintptr_t)__rodata_region_start)),
23+
24+
/* Region 2 zephyr rodata */
25+
MPU_REGION_ENTRY("SRAM_1",
26+
(uintptr_t)__rodata_region_start,
27+
REGION_RAM_RO_ATTR((uintptr_t)__rodata_region_end)),
28+
29+
/* Region 3 zephyr data */
30+
MPU_REGION_ENTRY("SRAM_2",
31+
#ifdef CONFIG_USERSPACE
32+
(uintptr_t)_app_smem_start,
33+
#else
34+
(uintptr_t)__kernel_ram_start,
35+
#endif
36+
REGION_RAM_ATTR((uintptr_t)__kernel_ram_end)),
37+
38+
/* Region 4 device region */
39+
MPU_REGION_ENTRY("DEVICE",
40+
DEVICE_REGION_START,
41+
REGION_DEVICE_ATTR(DEVICE_REGION_END)),
42+
};
43+
44+
const struct arm_mpu_config mpu_config = {
45+
.num_regions = ARRAY_SIZE(mpu_regions),
46+
.mpu_regions = mpu_regions,
47+
};

0 commit comments

Comments
 (0)