Zephyr Project API 4.0.0
A Scalable Open Source RTOS
|
Iterable Sections APIs. More...
Macros | |
#define | ITERABLE_SECTION_ROM(struct_type, subalign) |
Define a read-only iterable section output. | |
#define | ITERABLE_SECTION_ROM_NUMERIC(struct_type, subalign) |
Define a read-only iterable section output, sorted numerically. | |
#define | ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) |
Define a garbage collectable read-only iterable section output. | |
#define | ITERABLE_SECTION_RAM(struct_type, subalign) |
Define a read-write iterable section output. | |
#define | ITERABLE_SECTION_RAM_NUMERIC(struct_type, subalign) |
Define a read-write iterable section output, sorted numerically. | |
#define | ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) |
Define a garbage collectable read-write iterable section output. | |
#define | TYPE_SECTION_ITERABLE(type, varname, secname, section_postfix) |
Defines a new element for an iterable section for a generic type. | |
#define | TYPE_SECTION_START(secname) _CONCAT(_##secname, _list_start) |
iterable section start symbol for a generic type | |
#define | TYPE_SECTION_END(secname) _CONCAT(_##secname, _list_end) |
iterable section end symbol for a generic type | |
#define | TYPE_SECTION_START_EXTERN(type, secname) extern type TYPE_SECTION_START(secname)[] |
iterable section extern for start symbol for a generic type | |
#define | TYPE_SECTION_END_EXTERN(type, secname) extern type TYPE_SECTION_END(secname)[] |
iterable section extern for end symbol for a generic type | |
#define | TYPE_SECTION_FOREACH(type, secname, iterator) |
Iterate over a specified iterable section for a generic type. | |
#define | TYPE_SECTION_GET(type, secname, i, dst) |
Get element from section for a generic type. | |
#define | TYPE_SECTION_COUNT(type, secname, dst) |
Count elements in a section for a generic type. | |
#define | STRUCT_SECTION_START(struct_type) TYPE_SECTION_START(struct_type) |
iterable section start symbol for a struct type | |
#define | STRUCT_SECTION_START_EXTERN(struct_type) TYPE_SECTION_START_EXTERN(struct struct_type, struct_type) |
iterable section extern for start symbol for a struct | |
#define | STRUCT_SECTION_END(struct_type) TYPE_SECTION_END(struct_type) |
iterable section end symbol for a struct type | |
#define | STRUCT_SECTION_END_EXTERN(struct_type) TYPE_SECTION_END_EXTERN(struct struct_type, struct_type) |
iterable section extern for end symbol for a struct | |
#define | STRUCT_SECTION_ITERABLE_ALTERNATE(secname, struct_type, varname) TYPE_SECTION_ITERABLE(struct struct_type, varname, secname, varname) |
Defines a new element of alternate data type for an iterable section. | |
#define | STRUCT_SECTION_ITERABLE_ARRAY_ALTERNATE(secname, struct_type, varname, size) |
Defines an array of elements of alternate data type for an iterable section. | |
#define | STRUCT_SECTION_ITERABLE(struct_type, varname) STRUCT_SECTION_ITERABLE_ALTERNATE(struct_type, struct_type, varname) |
Defines a new element for an iterable section. | |
#define | STRUCT_SECTION_ITERABLE_ARRAY(struct_type, varname, size) |
Defines an array of elements for an iterable section. | |
#define | STRUCT_SECTION_ITERABLE_NAMED(struct_type, name, varname) TYPE_SECTION_ITERABLE(struct struct_type, varname, struct_type, name) |
Defines a new element for an iterable section with a custom name. | |
#define | STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE(struct_type, secname, name, varname) TYPE_SECTION_ITERABLE(struct struct_type, varname, secname, name) |
Defines a new element for an iterable section with a custom name, placed in a custom section. | |
#define | STRUCT_SECTION_FOREACH_ALTERNATE(secname, struct_type, iterator) TYPE_SECTION_FOREACH(struct struct_type, secname, iterator) |
Iterate over a specified iterable section (alternate). | |
#define | STRUCT_SECTION_FOREACH(struct_type, iterator) STRUCT_SECTION_FOREACH_ALTERNATE(struct_type, struct_type, iterator) |
Iterate over a specified iterable section. | |
#define | STRUCT_SECTION_GET(struct_type, i, dst) TYPE_SECTION_GET(struct struct_type, struct_type, i, dst) |
Get element from section. | |
#define | STRUCT_SECTION_COUNT(struct_type, dst) TYPE_SECTION_COUNT(struct struct_type, struct_type, dst); |
Count elements in a section. | |
Iterable Sections APIs.
#define ITERABLE_SECTION_RAM | ( | struct_type, | |
subalign | |||
) |
#include <include/zephyr/linker/iterable_sections.h>
Define a read-write iterable section output.
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_GC_ALLOWED | ( | struct_type, | |
subalign | |||
) |
#include <include/zephyr/linker/iterable_sections.h>
Define a garbage collectable read-write iterable section output.
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_NUMERIC | ( | struct_type, | |
subalign | |||
) |
#include <include/zephyr/linker/iterable_sections.h>
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).
#define ITERABLE_SECTION_ROM | ( | struct_type, | |
subalign | |||
) |
#include <include/zephyr/linker/iterable_sections.h>
Define a read-only iterable section output.
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_GC_ALLOWED | ( | struct_type, | |
subalign | |||
) |
#include <include/zephyr/linker/iterable_sections.h>
Define a garbage collectable read-only iterable section output.
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_NUMERIC | ( | struct_type, | |
subalign | |||
) |
#include <include/zephyr/linker/iterable_sections.h>
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).
#define STRUCT_SECTION_COUNT | ( | struct_type, | |
dst | |||
) | TYPE_SECTION_COUNT(struct struct_type, struct_type, dst); |
#include <include/zephyr/sys/iterable_sections.h>
Count elements in a section.
[in] | struct_type | Struct type |
[out] | dst | Pointer to location where result is written. |
#define STRUCT_SECTION_END | ( | struct_type | ) | TYPE_SECTION_END(struct_type) |
#include <include/zephyr/sys/iterable_sections.h>
iterable section end symbol for a struct type
[in] | struct_type | data type of section |
#define STRUCT_SECTION_END_EXTERN | ( | struct_type | ) | TYPE_SECTION_END_EXTERN(struct struct_type, struct_type) |
#include <include/zephyr/sys/iterable_sections.h>
iterable section extern for end symbol for a struct
Helper macro to give extern for end of iterable section.
[in] | struct_type | data type of section |
#define STRUCT_SECTION_FOREACH | ( | struct_type, | |
iterator | |||
) | STRUCT_SECTION_FOREACH_ALTERNATE(struct_type, struct_type, iterator) |
#include <include/zephyr/sys/iterable_sections.h>
Iterate over a specified iterable section.
Iterator for structure instances gathered by STRUCT_SECTION_ITERABLE(). The linker must provide a _<struct_type>_list_start symbol and a _<struct_type>_list_end symbol to mark the start and the end of the list of struct objects to iterate over. This is normally done using ITERABLE_SECTION_ROM() or ITERABLE_SECTION_RAM() in the linker script.
#define STRUCT_SECTION_FOREACH_ALTERNATE | ( | secname, | |
struct_type, | |||
iterator | |||
) | TYPE_SECTION_FOREACH(struct struct_type, secname, iterator) |
#include <include/zephyr/sys/iterable_sections.h>
Iterate over a specified iterable section (alternate).
Iterator for structure instances gathered by STRUCT_SECTION_ITERABLE(). The linker must provide a _<SECNAME>_list_start symbol and a _<SECNAME>_list_end symbol to mark the start and the end of the list of struct objects to iterate over. This is normally done using ITERABLE_SECTION_ROM() or ITERABLE_SECTION_RAM() in the linker script.
#define STRUCT_SECTION_GET | ( | struct_type, | |
i, | |||
dst | |||
) | TYPE_SECTION_GET(struct struct_type, struct_type, i, dst) |
#include <include/zephyr/sys/iterable_sections.h>
Get element from section.
[in] | struct_type | Struct type. |
[in] | i | Index. |
[out] | dst | Pointer to location where pointer to element is written. |
#define STRUCT_SECTION_ITERABLE | ( | struct_type, | |
varname | |||
) | STRUCT_SECTION_ITERABLE_ALTERNATE(struct_type, struct_type, varname) |
#include <include/zephyr/sys/iterable_sections.h>
Defines a new element for an iterable section.
Convenience helper combining __in_section() and Z_DECL_ALIGN(). The section name is the struct type prepended with an underscore. The subsection is "static" and the subsubsection is the variable name.
In the linker script, create output sections for these using ITERABLE_SECTION_ROM() or ITERABLE_SECTION_RAM().
#define STRUCT_SECTION_ITERABLE_ALTERNATE | ( | secname, | |
struct_type, | |||
varname | |||
) | TYPE_SECTION_ITERABLE(struct struct_type, varname, secname, varname) |
#include <include/zephyr/sys/iterable_sections.h>
Defines a new element of alternate data type for an iterable section.
Special variant of STRUCT_SECTION_ITERABLE(), for placing alternate data types within the iterable section of a specific data type. The data type sizes and semantics must be equivalent!
#define STRUCT_SECTION_ITERABLE_ARRAY | ( | struct_type, | |
varname, | |||
size | |||
) |
#include <include/zephyr/sys/iterable_sections.h>
Defines an array of elements for an iterable section.
#define STRUCT_SECTION_ITERABLE_ARRAY_ALTERNATE | ( | secname, | |
struct_type, | |||
varname, | |||
size | |||
) |
#include <include/zephyr/sys/iterable_sections.h>
Defines an array of elements of alternate data type for an iterable section.
#define STRUCT_SECTION_ITERABLE_NAMED | ( | struct_type, | |
name, | |||
varname | |||
) | TYPE_SECTION_ITERABLE(struct struct_type, varname, struct_type, name) |
#include <include/zephyr/sys/iterable_sections.h>
Defines a new element for an iterable section with a custom name.
The name can be used to customize how iterable section entries are sorted.
#define STRUCT_SECTION_ITERABLE_NAMED_ALTERNATE | ( | struct_type, | |
secname, | |||
name, | |||
varname | |||
) | TYPE_SECTION_ITERABLE(struct struct_type, varname, secname, name) |
#include <include/zephyr/sys/iterable_sections.h>
Defines a new element for an iterable section with a custom name, placed in a custom section.
The name can be used to customize how iterable section entries are sorted.
#define STRUCT_SECTION_START | ( | struct_type | ) | TYPE_SECTION_START(struct_type) |
#include <include/zephyr/sys/iterable_sections.h>
iterable section start symbol for a struct type
[in] | struct_type | data type of section |
#define STRUCT_SECTION_START_EXTERN | ( | struct_type | ) | TYPE_SECTION_START_EXTERN(struct struct_type, struct_type) |
#include <include/zephyr/sys/iterable_sections.h>
iterable section extern for start symbol for a struct
Helper macro to give extern for start of iterable section.
[in] | struct_type | data type of section |
#define TYPE_SECTION_COUNT | ( | type, | |
secname, | |||
dst | |||
) |
#include <include/zephyr/sys/iterable_sections.h>
Count elements in a section for a generic type.
[in] | type | type of element |
[in] | secname | name of output section |
[out] | dst | Pointer to location where result is written. |
#define TYPE_SECTION_END | ( | secname | ) | _CONCAT(_##secname, _list_end) |
#include <include/zephyr/sys/iterable_sections.h>
iterable section end symbol for a generic type
will return '_<SECNAME>_list_end'.
[in] | secname | type name of iterable section. For 'struct foobar' this would be TYPE_SECTION_START(foobar) |
#define TYPE_SECTION_END_EXTERN | ( | type, | |
secname | |||
) | extern type TYPE_SECTION_END(secname)[] |
#include <include/zephyr/sys/iterable_sections.h>
iterable section extern for end symbol for a generic type
Helper macro to give extern for end of iterable section. The macro typically will be called TYPE_SECTION_END_EXTERN(struct foobar, foobar). This allows the macro to hand different types as well as cases where the type and section name may differ.
[in] | type | data type of section |
[in] | secname | name of output section |
#define TYPE_SECTION_FOREACH | ( | type, | |
secname, | |||
iterator | |||
) |
#include <include/zephyr/sys/iterable_sections.h>
Iterate over a specified iterable section for a generic type.
Iterator for structure instances gathered by TYPE_SECTION_ITERABLE(). The linker must provide a _<SECNAME>_list_start symbol and a _<SECNAME>_list_end symbol to mark the start and the end of the list of struct objects to iterate over. This is normally done using ITERABLE_SECTION_ROM() or ITERABLE_SECTION_RAM() in the linker script.
#define TYPE_SECTION_GET | ( | type, | |
secname, | |||
i, | |||
dst | |||
) |
#include <include/zephyr/sys/iterable_sections.h>
Get element from section for a generic type.
[in] | type | type of element |
[in] | secname | name of output section |
[in] | i | Index. |
[out] | dst | Pointer to location where pointer to element is written. |
#define TYPE_SECTION_ITERABLE | ( | type, | |
varname, | |||
secname, | |||
section_postfix | |||
) |
#include <include/zephyr/sys/iterable_sections.h>
Defines a new element for an iterable section for a generic type.
Convenience helper combining __in_section() and Z_DECL_ALIGN(). The section name will be '.[SECNAME].static.[SECTION_POSTFIX]'
In the linker script, create output sections for these using ITERABLE_SECTION_ROM() or ITERABLE_SECTION_RAM().
[in] | type | data type of variable |
[in] | varname | name of variable to place in section |
[in] | secname | type name of iterable section. |
[in] | section_postfix | postfix to use in section name |
#define TYPE_SECTION_START | ( | secname | ) | _CONCAT(_##secname, _list_start) |
#include <include/zephyr/sys/iterable_sections.h>
iterable section start symbol for a generic type
will return '_[OUT_TYPE]_list_start'.
[in] | secname | type name of iterable section. For 'struct foobar' this would be TYPE_SECTION_START(foobar) |
#define TYPE_SECTION_START_EXTERN | ( | type, | |
secname | |||
) | extern type TYPE_SECTION_START(secname)[] |
#include <include/zephyr/sys/iterable_sections.h>
iterable section extern for start symbol for a generic type
Helper macro to give extern for start of iterable section. The macro typically will be called TYPE_SECTION_START_EXTERN(struct foobar, foobar). This allows the macro to hand different types as well as cases where the type and section name may differ.
[in] | type | data type of section |
[in] | secname | name of output section |