toolchain: common: iterable sections: improve documentation

The macro STRUCT_SECTION_ITERABLE can only store items in ROM if a
const specifier is added to the struct declaration.

Also it does not create the iterable section itself, but adds an
element to the section.

This commit clarifies the documentation.

Signed-off-by: Martin Jäger <martin@libre.solar>
This commit is contained in:
Martin Jäger 2022-10-11 13:59:18 +02:00 committed by Carles Cufí
parent 8941aebc49
commit 57e0ea6f98

View file

@ -197,7 +197,7 @@
*/
/**
* @brief Defines a new iterable section.
* @brief Defines a new element for an iterable section.
*
* @details
* Convenience helper combining __in_section() and Z_DECL_ALIGN().
@ -206,13 +206,16 @@
*
* In the linker script, create output sections for these using
* ITERABLE_SECTION_ROM() or ITERABLE_SECTION_RAM().
*
* @note In order to store the element in ROM, a const specifier has to
* be added to the declaration: const STRUCT_SECTION_ITERABLE(...);
*/
#define STRUCT_SECTION_ITERABLE(struct_type, name) \
Z_DECL_ALIGN(struct struct_type) name \
__in_section(_##struct_type, static, name) __used __noasan
/**
* @brief Defines an alternate data type iterable section.
* @brief Defines a new element of alternate data type for an iterable section.
*
* @details
* Special variant of STRUCT_SECTION_ITERABLE(), for placing alternate