forked from zephyrproject-rtos/zephyr
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
iterable_sections: move to specific header
Until now iterable sections APIs have been part of the toolchain (common) headers. They are not strictly related to a toolchain, they just rely on linker providing support for sections. Most files relied on indirect includes to access the API, now, it is included as needed. Signed-off-by: Gerard Marull-Paretas <[email protected]>
- Loading branch information
1 parent
4975c94
commit dacb3db
Showing
133 changed files
with
599 additions
and
430 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ | |
|
||
#include <stdint.h> | ||
|
||
#include <zephyr/sys/iterable_sections.h> | ||
#include <zephyr/sys/slist.h> | ||
|
||
/** | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
include/zephyr/linker/common-rom/common-rom-kernel-devices.ld
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
/* | ||
* Copyright (C) 2020, Intel Corporation | ||
* Copyright (C) 2023, Nordic Semiconductor ASA | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#ifndef INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_ | ||
#define INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_ | ||
|
||
/** | ||
* @addtogroup iterable_section_apis | ||
* @{ | ||
*/ | ||
|
||
#define Z_LINK_ITERABLE(struct_type) \ | ||
_CONCAT(_##struct_type, _list_start) = .; \ | ||
KEEP(*(SORT_BY_NAME(._##struct_type.static.*))); \ | ||
_CONCAT(_##struct_type, _list_end) = . | ||
|
||
#define Z_LINK_ITERABLE_NUMERIC(struct_type) \ | ||
_CONCAT(_##struct_type, _list_start) = .; \ | ||
KEEP(*(SORT(._##struct_type.static.*_?_*))); \ | ||
KEEP(*(SORT(._##struct_type.static.*_??_*))); \ | ||
_CONCAT(_##struct_type, _list_end) = . | ||
|
||
#define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \ | ||
. = ALIGN(align); \ | ||
Z_LINK_ITERABLE(struct_type); | ||
|
||
#define Z_LINK_ITERABLE_GC_ALLOWED(struct_type) \ | ||
_CONCAT(_##struct_type, _list_start) = .; \ | ||
*(SORT_BY_NAME(._##struct_type.static.*)); \ | ||
_CONCAT(_##struct_type, _list_end) = . | ||
|
||
/** | ||
* @brief Define a read-only iterable section output. | ||
* | ||
* @details | ||
* Define an output section which will set up an iterable area | ||
* of equally-sized data structures. For use with STRUCT_SECTION_ITERABLE(). | ||
* Input sections will be sorted by name, per ld's SORT_BY_NAME. | ||
* | ||
* This macro should be used for read-only data. | ||
* | ||
* Note that this keeps the symbols in the image even though | ||
* they are not being directly referenced. Use this when symbols | ||
* are indirectly referenced by iterating through the section. | ||
*/ | ||
#define ITERABLE_SECTION_ROM(struct_type, subalign) \ | ||
SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \ | ||
{ \ | ||
Z_LINK_ITERABLE(struct_type); \ | ||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | ||
|
||
/** | ||
* @brief Define a read-only iterable section output, sorted numerically. | ||
* | ||
* This version of ITERABLE_SECTION_ROM() sorts the entries numerically, that | ||
* is, `SECNAME_10` will come after `SECNAME_2`. `_` separator is required, and | ||
* up to 2 numeric digits are handled (0-99). | ||
* | ||
* @see ITERABLE_SECTION_ROM() | ||
*/ | ||
#define ITERABLE_SECTION_ROM_NUMERIC(struct_type, subalign) \ | ||
SECTION_PROLOGUE(struct_type##_area, EMPTY, SUBALIGN(subalign)) \ | ||
{ \ | ||
Z_LINK_ITERABLE_NUMERIC(struct_type); \ | ||
} GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | ||
|
||
/** | ||
* @brief Define a garbage collectable read-only iterable section output. | ||
* | ||
* @details | ||
* Define an output section which will set up an iterable area | ||
* of equally-sized data structures. For use with STRUCT_SECTION_ITERABLE(). | ||
* Input sections will be sorted by name, per ld's SORT_BY_NAME. | ||
* | ||
* This macro should be used for read-only data. | ||
* | ||
* Note that the symbols within the section can be garbage collected. | ||
*/ | ||
#define ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) \ | ||
SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \ | ||
{ \ | ||
Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \ | ||
} GROUP_LINK_IN(ROMABLE_REGION) | ||
|
||
/** | ||
* @brief Define a read-write iterable section output. | ||
* | ||
* @details | ||
* Define an output section which will set up an iterable area | ||
* of equally-sized data structures. For use with STRUCT_SECTION_ITERABLE(). | ||
* Input sections will be sorted by name, per ld's SORT_BY_NAME. | ||
* | ||
* This macro should be used for read-write data that is modified at runtime. | ||
* | ||
* Note that this keeps the symbols in the image even though | ||
* they are not being directly referenced. Use this when symbols | ||
* are indirectly referenced by iterating through the section. | ||
*/ | ||
#define ITERABLE_SECTION_RAM(struct_type, subalign) \ | ||
SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \ | ||
{ \ | ||
Z_LINK_ITERABLE(struct_type); \ | ||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | ||
|
||
/** | ||
* @brief Define a read-write iterable section output, sorted numerically. | ||
* | ||
* This version of ITERABLE_SECTION_RAM() sorts the entries numerically, that | ||
* is, `SECNAME10` will come after `SECNAME2`. Up to 2 numeric digits are | ||
* handled (0-99). | ||
* | ||
* @see ITERABLE_SECTION_RAM() | ||
*/ | ||
#define ITERABLE_SECTION_RAM_NUMERIC(struct_type, subalign) \ | ||
SECTION_PROLOGUE(struct_type##_area, EMPTY, SUBALIGN(subalign)) \ | ||
{ \ | ||
Z_LINK_ITERABLE_NUMERIC(struct_type); \ | ||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | ||
|
||
/** | ||
* @brief Define a garbage collectable read-write iterable section output. | ||
* | ||
* @details | ||
* Define an output section which will set up an iterable area | ||
* of equally-sized data structures. For use with STRUCT_SECTION_ITERABLE(). | ||
* Input sections will be sorted by name, per ld's SORT_BY_NAME. | ||
* | ||
* This macro should be used for read-write data that is modified at runtime. | ||
* | ||
* Note that the symbols within the section can be garbage collected. | ||
*/ | ||
#define ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) \ | ||
SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \ | ||
{ \ | ||
Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \ | ||
} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) | ||
|
||
/** | ||
* @} | ||
*/ /* end of struct_section_apis */ | ||
|
||
#endif /* INCLUDE_ZEPHYR_LINKER_ITERABLE_SECTIONS_H_ */ |
Oops, something went wrong.