Zephyr API Documentation 4.1.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
iterable_sections.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2020, Intel Corporation
3 * Copyright (C) 2023, Nordic Semiconductor ASA
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_
8#define INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_
9
15/* clang-format off */
16#define Z_LINK_ITERABLE(struct_type) \
17 _CONCAT(_##struct_type, _list_start) = .; \
18 KEEP(*(SORT_BY_NAME(._##struct_type.static.*))); \
19 _CONCAT(_##struct_type, _list_end) = .
20
21#define Z_LINK_ITERABLE_NUMERIC(struct_type) \
22 _CONCAT(_##struct_type, _list_start) = .; \
23 KEEP(*(SORT(._##struct_type.static.*_?_*))); \
24 KEEP(*(SORT(._##struct_type.static.*_??_*))); \
25 KEEP(*(SORT(._##struct_type.static.*_???_*))); \
26 KEEP(*(SORT(._##struct_type.static.*_????_*))); \
27 KEEP(*(SORT(._##struct_type.static.*_?????_*))); \
28 _CONCAT(_##struct_type, _list_end) = .
29
30#define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \
31 . = ALIGN(align); \
32 Z_LINK_ITERABLE(struct_type);
33
34#define Z_LINK_ITERABLE_GC_ALLOWED(struct_type) \
35 _CONCAT(_##struct_type, _list_start) = .; \
36 *(SORT_BY_NAME(._##struct_type.static.*)); \
37 _CONCAT(_##struct_type, _list_end) = .
38/* clang-format on */
39
40#define Z_LINK_ITERABLE_SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN
41
56#define ITERABLE_SECTION_ROM(struct_type, subalign) \
57 SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
58 { \
59 Z_LINK_ITERABLE(struct_type); \
60 } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
61
71#define ITERABLE_SECTION_ROM_NUMERIC(struct_type, subalign) \
72 SECTION_PROLOGUE(struct_type##_area, EMPTY, SUBALIGN(subalign)) \
73 { \
74 Z_LINK_ITERABLE_NUMERIC(struct_type); \
75 } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
76
89#define ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) \
90 SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
91 { \
92 Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \
93 } GROUP_LINK_IN(ROMABLE_REGION)
94
109#define ITERABLE_SECTION_RAM(struct_type, subalign) \
110 SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
111 { \
112 Z_LINK_ITERABLE(struct_type); \
113 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
114
124#define ITERABLE_SECTION_RAM_NUMERIC(struct_type, subalign) \
125 SECTION_PROLOGUE(struct_type##_area, EMPTY, SUBALIGN(subalign)) \
126 { \
127 Z_LINK_ITERABLE_NUMERIC(struct_type); \
128 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
129
142#define ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) \
143 SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
144 { \
145 Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \
146 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
147
150 /* end of struct_section_apis */
151
152#endif /* INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_ */