Zephyr API Documentation
3.6.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
devicetree_regions.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021, Commonwealth Scientific and Industrial Research
3
* Organisation (CSIRO) ABN 41 687 119 230.
4
*
5
* SPDX-License-Identifier: Apache-2.0
6
*
7
* Generate memory regions from devicetree nodes.
8
*/
9
10
#ifndef ZEPHYR_INCLUDE_LINKER_DEVICETREE_REGIONS_H_
11
#define ZEPHYR_INCLUDE_LINKER_DEVICETREE_REGIONS_H_
12
13
#include <
zephyr/devicetree.h
>
14
#include <
zephyr/sys/util.h
>
15
#include <
zephyr/toolchain.h
>
16
48
#define LINKER_DT_NODE_REGION_NAME_TOKEN(node_id) \
49
DT_STRING_TOKEN(node_id, zephyr_memory_region)
50
82
#define LINKER_DT_NODE_REGION_NAME(node_id) \
83
STRINGIFY(LINKER_DT_NODE_REGION_NAME_TOKEN(node_id))
84
87
#define _DT_COMPATIBLE zephyr_memory_region
88
89
#define _DT_SECTION_PREFIX(node_id) UTIL_CAT(__, LINKER_DT_NODE_REGION_NAME_TOKEN(node_id))
90
#define _DT_SECTION_START(node_id) UTIL_CAT(_DT_SECTION_PREFIX(node_id), _start)
91
#define _DT_SECTION_END(node_id) UTIL_CAT(_DT_SECTION_PREFIX(node_id), _end)
92
#define _DT_SECTION_SIZE(node_id) UTIL_CAT(_DT_SECTION_PREFIX(node_id), _size)
93
#define _DT_SECTION_LOAD(node_id) UTIL_CAT(_DT_SECTION_PREFIX(node_id), _load_start)
94
117
#define _REGION_DECLARE(node_id) \
118
LINKER_DT_NODE_REGION_NAME_TOKEN(node_id) : \
119
ORIGIN = DT_REG_ADDR(node_id), \
120
LENGTH = DT_REG_SIZE(node_id)
121
152
#define _SECTION_DECLARE(node_id) \
153
LINKER_DT_NODE_REGION_NAME_TOKEN(node_id) (NOLOAD) : \
154
{ \
155
_DT_SECTION_START(node_id) = .; \
156
KEEP(*(LINKER_DT_NODE_REGION_NAME_TOKEN(node_id))) \
157
KEEP(*(LINKER_DT_NODE_REGION_NAME_TOKEN(node_id).*)) \
158
_DT_SECTION_END(node_id) = .; \
159
} > LINKER_DT_NODE_REGION_NAME_TOKEN(node_id) \
160
_DT_SECTION_SIZE(node_id) = _DT_SECTION_END(node_id) - _DT_SECTION_START(node_id); \
161
_DT_SECTION_LOAD(node_id) = LOADADDR(LINKER_DT_NODE_REGION_NAME_TOKEN(node_id));
162
173
#define LINKER_DT_REGIONS() \
174
DT_FOREACH_STATUS_OKAY(_DT_COMPATIBLE, _REGION_DECLARE)
175
180
#define LINKER_DT_SECTIONS() \
181
DT_FOREACH_STATUS_OKAY(_DT_COMPATIBLE, _SECTION_DECLARE)
182
183
#endif
/* ZEPHYR_INCLUDE_LINKER_DEVICETREE_REGIONS_H_ */
devicetree.h
Devicetree main header.
toolchain.h
Macros to abstract toolchain specific capabilities.
util.h
Misc utilities.
zephyr
linker
devicetree_regions.h
Generated on Thu Jul 4 2024 12:22:47 for Zephyr API Documentation by
1.9.6