-
Notifications
You must be signed in to change notification settings - Fork 581
/
arm_mpu_regions.c
53 lines (47 loc) · 1.35 KB
/
arm_mpu_regions.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*
* Copyright (c) 2017 Linaro Limited.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr/sys/slist.h>
#include <zephyr/arch/arm/aarch32/mpu/arm_mpu.h>
#include <zephyr/linker/devicetree_regions.h>
#include "arm_mpu_mem_cfg.h"
#if USE_PARTITION_MANAGER
#include <pm_config.h>
#endif
static const struct arm_mpu_region mpu_regions[] = {
/* Region 0 */
MPU_REGION_ENTRY("FLASH_0",
CONFIG_FLASH_BASE_ADDRESS,
#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE)
REGION_FLASH_ATTR(CONFIG_FLASH_BASE_ADDRESS, \
CONFIG_FLASH_SIZE * 1024)),
#else
REGION_FLASH_ATTR(REGION_FLASH_SIZE)),
#endif
/* Region 1 */
MPU_REGION_ENTRY("SRAM_0",
#if USE_PARTITION_MANAGER
PM_SRAM_ADDRESS,
#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE)
REGION_RAM_ATTR(PM_SRAM_ADDRESS, PM_SRAM_SIZE)),
#else
REGION_RAM_ATTR(REGION_SRAM_SIZE)),
#endif
#else
CONFIG_SRAM_BASE_ADDRESS,
#if defined(CONFIG_ARMV8_M_BASELINE) || defined(CONFIG_ARMV8_M_MAINLINE)
REGION_RAM_ATTR(CONFIG_SRAM_BASE_ADDRESS, \
CONFIG_SRAM_SIZE * 1024)),
#else
REGION_RAM_ATTR(REGION_SRAM_SIZE)),
#endif
#endif /* USE_PARTITION_MANAGER */
/* DT-defined regions */
LINKER_DT_REGION_MPU(ARM_MPU_REGION_INIT)
};
const struct arm_mpu_config mpu_config = {
.num_regions = ARRAY_SIZE(mpu_regions),
.mpu_regions = mpu_regions,
};