Zephyr API Documentation  3.7.0
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#else
41#error "Unsupported flash size configuration"
42#endif
43
44/* SRAM Region Definitions */
45#if CONFIG_SRAM_SIZE <= 16
46#define REGION_SRAM_SIZE REGION_16K
47#elif CONFIG_SRAM_SIZE <= 32
48#define REGION_SRAM_SIZE REGION_32K
49#elif CONFIG_SRAM_SIZE <= 64
50#define REGION_SRAM_SIZE REGION_64K
51#elif CONFIG_SRAM_SIZE <= 128
52#define REGION_SRAM_SIZE REGION_128K
53#elif CONFIG_SRAM_SIZE <= 256
54#define REGION_SRAM_SIZE REGION_256K
55#elif CONFIG_SRAM_SIZE <= 512
56#define REGION_SRAM_SIZE REGION_512K
57#elif CONFIG_SRAM_SIZE <= 1024
58#define REGION_SRAM_SIZE REGION_1M
59#elif CONFIG_SRAM_SIZE <= 2048
60#define REGION_SRAM_SIZE REGION_2M
61#elif CONFIG_SRAM_SIZE <= 4096
62#define REGION_SRAM_SIZE REGION_4M
63#elif CONFIG_SRAM_SIZE <= 8192
64#define REGION_SRAM_SIZE REGION_8M
65#elif CONFIG_SRAM_SIZE <= 16384
66#define REGION_SRAM_SIZE REGION_16M
67#elif CONFIG_SRAM_SIZE == 32768
68#define REGION_SRAM_SIZE REGION_32M
69#elif CONFIG_SRAM_SIZE == 65536
70#define REGION_SRAM_SIZE REGION_64M
71#else
72#error "Unsupported sram size configuration"
73#endif
74
75#endif /* !ARMV8_M_BASELINE && !ARMV8_M_MAINLINE */
76
77#endif /* _ARM_CORTEX_M_MPU_MEM_CFG_H_ */