1 /*
2  * Copyright (c) 2017 Linaro Limited.
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/sys/slist.h>
8 #include <zephyr/arch/arm/mpu/arm_mpu.h>
9 
10 #include <zephyr/arch/arm/cortex_m/arm_mpu_mem_cfg.h>
11 
12 static const struct arm_mpu_region mpu_regions[] = {
13 #ifdef CONFIG_XIP
14 	/* Region 0 */
15 	MPU_REGION_ENTRY("FLASH_0",
16 			 CONFIG_FLASH_BASE_ADDRESS,
17 #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE)
18 			 REGION_FLASH_ATTR(CONFIG_FLASH_BASE_ADDRESS, \
19 				 CONFIG_FLASH_SIZE * 1024)),
20 #else
21 			 REGION_FLASH_ATTR(REGION_FLASH_SIZE)),
22 #endif
23 #endif
24 
25 	/* Region 1 */
26 	MPU_REGION_ENTRY("SRAM_0",
27 			 CONFIG_SRAM_BASE_ADDRESS,
28 #if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE)
29 			 REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \
30 				 CONFIG_SRAM_SIZE * 1024)),
31 #else
32 			 REGION_RAM_ATTR(REGION_SRAM_SIZE)),
33 #endif
34 };
35 
36 const struct arm_mpu_config mpu_config = {
37 	.num_regions = ARRAY_SIZE(mpu_regions),
38 	.mpu_regions = mpu_regions,
39 };
40