Zephyr API Documentation 4.0.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
arm_mpu_mem_cfg.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2017 Linaro Limited.
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef _ARM_CORTEX_M_MPU_MEM_CFG_H_
7#define _ARM_CORTEX_M_MPU_MEM_CFG_H_
8
10
11#if !defined(CONFIG_ARMV8_M_BASELINE) && !defined(CONFIG_ARMV8_M_MAINLINE)
12
13/* Flash Region Definitions */
14#if CONFIG_FLASH_SIZE <= 64
15#define REGION_FLASH_SIZE REGION_64K
16#elif CONFIG_FLASH_SIZE <= 128
17#define REGION_FLASH_SIZE REGION_128K
18#elif CONFIG_FLASH_SIZE <= 256
19#define REGION_FLASH_SIZE REGION_256K
20#elif CONFIG_FLASH_SIZE <= 512
21#define REGION_FLASH_SIZE REGION_512K
22#elif CONFIG_FLASH_SIZE <= 1024
23#define REGION_FLASH_SIZE REGION_1M
24#elif CONFIG_FLASH_SIZE <= 2048
25#define REGION_FLASH_SIZE REGION_2M
26#elif CONFIG_FLASH_SIZE <= 4096
27#define REGION_FLASH_SIZE REGION_4M
28#elif CONFIG_FLASH_SIZE <= 8192
29#define REGION_FLASH_SIZE REGION_8M
30#elif CONFIG_FLASH_SIZE <= 16384
31#define REGION_FLASH_SIZE REGION_16M
32#elif CONFIG_FLASH_SIZE <= 65536
33#define REGION_FLASH_SIZE REGION_64M
34#elif CONFIG_FLASH_SIZE <= 131072
35#define REGION_FLASH_SIZE REGION_128M
36#elif CONFIG_FLASH_SIZE <= 262144
37#define REGION_FLASH_SIZE REGION_256M
38#elif CONFIG_FLASH_SIZE <= 524288
39#define REGION_FLASH_SIZE REGION_512M
40#elif CONFIG_FLASH_SIZE <= 1048576
41#define REGION_FLASH_SIZE REGION_1G
42#elif CONFIG_FLASH_SIZE <= 2097152
43#define REGION_FLASH_SIZE REGION_2G
44#elif CONFIG_FLASH_SIZE <= 4194304
45#define REGION_FLASH_SIZE REGION_4G
46#else
47#error "Unsupported flash size configuration"
48#endif
49
50/* SRAM Region Definitions */
51#if CONFIG_SRAM_SIZE <= 16
52#define REGION_SRAM_SIZE REGION_16K
53#elif CONFIG_SRAM_SIZE <= 32
54#define REGION_SRAM_SIZE REGION_32K
55#elif CONFIG_SRAM_SIZE <= 64
56#define REGION_SRAM_SIZE REGION_64K
57#elif CONFIG_SRAM_SIZE <= 128
58#define REGION_SRAM_SIZE REGION_128K
59#elif CONFIG_SRAM_SIZE <= 256
60#define REGION_SRAM_SIZE REGION_256K
61#elif CONFIG_SRAM_SIZE <= 512
62#define REGION_SRAM_SIZE REGION_512K
63#elif CONFIG_SRAM_SIZE <= 1024
64#define REGION_SRAM_SIZE REGION_1M
65#elif CONFIG_SRAM_SIZE <= 2048
66#define REGION_SRAM_SIZE REGION_2M
67#elif CONFIG_SRAM_SIZE <= 4096
68#define REGION_SRAM_SIZE REGION_4M
69#elif CONFIG_SRAM_SIZE <= 8192
70#define REGION_SRAM_SIZE REGION_8M
71#elif CONFIG_SRAM_SIZE <= 16384
72#define REGION_SRAM_SIZE REGION_16M
73#elif CONFIG_SRAM_SIZE <= 32768
74#define REGION_SRAM_SIZE REGION_32M
75#elif CONFIG_SRAM_SIZE <= 65536
76#define REGION_SRAM_SIZE REGION_64M
77#elif CONFIG_SRAM_SIZE <= 131072
78#define REGION_SRAM_SIZE REGION_128M
79#elif CONFIG_SRAM_SIZE <= 262144
80#define REGION_SRAM_SIZE REGION_256M
81#elif CONFIG_SRAM_SIZE <= 524288
82#define REGION_SRAM_SIZE REGION_512M
83#elif CONFIG_SRAM_SIZE <= 1048576
84#define REGION_SRAM_SIZE REGION_1G
85#elif CONFIG_SRAM_SIZE <= 2097152
86#define REGION_SRAM_SIZE REGION_2G
87#elif CONFIG_SRAM_SIZE <= 4194304
88#define REGION_SRAM_SIZE REGION_4G
89#else
90#error "Unsupported sram size configuration"
91#endif
92
93#endif /* !ARMV8_M_BASELINE && !ARMV8_M_MAINLINE */
94
95#endif /* _ARM_CORTEX_M_MPU_MEM_CFG_H_ */