Zephyr API Documentation 4.0.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#define Z_LINK_ITERABLE(struct_type) \
16 _CONCAT(_##struct_type, _list_start) = .; \
17 KEEP(*(SORT_BY_NAME(._##struct_type.static.*))); \
18 _CONCAT(_##struct_type, _list_end) = .
19
20#define Z_LINK_ITERABLE_NUMERIC(struct_type) \
21 _CONCAT(_##struct_type, _list_start) = .; \
22 KEEP(*(SORT(._##struct_type.static.*_?_*))); \
23 KEEP(*(SORT(._##struct_type.static.*_??_*))); \
24 _CONCAT(_##struct_type, _list_end) = .
25
26#define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \
27 . = ALIGN(align); \
28 Z_LINK_ITERABLE(struct_type);
29
30#define Z_LINK_ITERABLE_GC_ALLOWED(struct_type) \
31 _CONCAT(_##struct_type, _list_start) = .; \
32 *(SORT_BY_NAME(._##struct_type.static.*)); \
33 _CONCAT(_##struct_type, _list_end) = .
34
35#define Z_LINK_ITERABLE_SUBALIGN CONFIG_LINKER_ITERABLE_SUBALIGN
36
51#define ITERABLE_SECTION_ROM(struct_type, subalign) \
52 SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
53 { \
54 Z_LINK_ITERABLE(struct_type); \
55 } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
56
66#define ITERABLE_SECTION_ROM_NUMERIC(struct_type, subalign) \
67 SECTION_PROLOGUE(struct_type##_area, EMPTY, SUBALIGN(subalign)) \
68 { \
69 Z_LINK_ITERABLE_NUMERIC(struct_type); \
70 } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
71
84#define ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) \
85 SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
86 { \
87 Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \
88 } GROUP_LINK_IN(ROMABLE_REGION)
89
104#define ITERABLE_SECTION_RAM(struct_type, subalign) \
105 SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
106 { \
107 Z_LINK_ITERABLE(struct_type); \
108 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
109
119#define ITERABLE_SECTION_RAM_NUMERIC(struct_type, subalign) \
120 SECTION_PROLOGUE(struct_type##_area, EMPTY, SUBALIGN(subalign)) \
121 { \
122 Z_LINK_ITERABLE_NUMERIC(struct_type); \
123 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
124
137#define ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) \
138 SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
139 { \
140 Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \
141 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
142
145 /* end of struct_section_apis */
146
147#endif /* INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_ */