Section variables

nRF5 SDK v10.0.0

nRF51 SDK v10.0.0

Section variables. More...

Macros

#define NRF_PRAGMA (x)   _Pragma(#x)
Macro to delay macro expression of pragma. More...
#define NRF_SECTION_VARS_REGISTER_SECTION (section_name)
Macro to register section by name in code. More...
#define NRF_SECTION_VARS_START_SYMBOL (section_name)   section_name ## $$Base
Macro for accessing start of a named data section by symbol. More...
#define NRF_SECTION_VARS_END_SYMBOL (section_name)   section_name ## $$Limit
Macro for accessing end of a named data section by symbol. More...
#define NRF_SECTION_VARS_LENGTH (section_name)   ((uint32_t)& NRF_SECTION_VARS_END_SYMBOL (section_name) - (uint32_t)& NRF_SECTION_VARS_START_SYMBOL (section_name))
Macro for accessing Length of a named section. More...
#define NRF_SECTION_VARS_START_ADDR (section_name)   (uint32_t)& NRF_SECTION_VARS_START_SYMBOL (section_name)
Macro for accessing the start address of a named section. More...
#define NRF_SECTION_VARS_END_ADDR (section_name)   (uint32_t)& NRF_SECTION_VARS_END_SYMBOL (section_name)
#define NRF_SECTION_VARS_REGISTER_SYMBOLS (type_name, section_name)
Macro for declaring symbols for named sections. More...
#define NRF_SECTION_VARS_ADD (section_name, type_def)   static type_def __attribute__((section( #section_name ))) __attribute__((used))
Macro to add symbols to a named section. More...
#define NRF_SECTION_VARS_GET (i, type_name, section_name)   (type_name*)( NRF_SECTION_VARS_START_ADDR (section_name) + i * sizeof(type_name))
Macro to get symbol from named section. More...
#define NRF_SECTION_VARS_COUNT (type_name, section_name) NRF_SECTION_VARS_LENGTH (section_name) / sizeof(type_name)
Macro to get number of items in named section. More...

Detailed Description

Section variables.

Macro Definition Documentation

#define NRF_PRAGMA ( x ) _Pragma(#x)

Macro to delay macro expression of pragma.

#define NRF_SECTION_VARS_ADD ( section_name,
type_def
) static type_def __attribute__((section( #section_name ))) __attribute__((used))

Macro to add symbols to a named section.

The symbols are placed in a named section. All calls to this macro will result in symbols being placed in a contiguous manner in the named section. This macro ensures that the symbol is not removed because of optimization level.

Warning
There is no guarantee for ordering of placement. If ordering is required
The symbols added in the named section must be word aligned to ensure that compilers do not pad the section during symbol placement.
Parameters
[in] section_name Name of the section
[in] type_def Datatype of the symbol to place in the given section
#define NRF_SECTION_VARS_COUNT ( type_name,
section_name
) NRF_SECTION_VARS_LENGTH (section_name) / sizeof(type_name)

Macro to get number of items in named section.

Parameters
[in] type_name Type name of item in section
[in] section_name Name of the section
#define NRF_SECTION_VARS_END_SYMBOL ( section_name ) section_name ## $$Limit

Macro for accessing end of a named data section by symbol.

The symbol that this macro resolves to is used to access the section by end address.

Parameters
[in] section_name Name of the section
#define NRF_SECTION_VARS_GET ( i,
type_name,
section_name
) (type_name*)( NRF_SECTION_VARS_START_ADDR (section_name) + i * sizeof(type_name))

Macro to get symbol from named section.

Warning
The stored symbol can only be resolved using this macro if the type of the data is word aligned. The operation of acquiring the stored symbol relies on sizeof of the stored type, no padding can exist in the named section in between individual stored items or this macro will fail.
Parameters
[in] i Index of item in section
[in] type_name Type name of item in section
[in] section_name Name of the section
#define NRF_SECTION_VARS_LENGTH ( section_name ) ((uint32_t)& NRF_SECTION_VARS_END_SYMBOL (section_name) - (uint32_t)& NRF_SECTION_VARS_START_SYMBOL (section_name))

Macro for accessing Length of a named section.

This macro is used to get the size of a named section.

Parameters
[in] section_name Name of the section
#define NRF_SECTION_VARS_REGISTER_SECTION ( section_name )

Macro to register section by name in code.

Parameters
[in] section_name Name of the section to register
#define NRF_SECTION_VARS_REGISTER_SYMBOLS ( type_name,
section_name
)
Value:
extern type_name* NRF_SECTION_VARS_START_SYMBOL (section_name); \
extern void * NRF_SECTION_VARS_END_SYMBOL (section_name)

Macro for declaring symbols for named sections.

Note
These external declarations of section specific symbols are required for the linker in GCC and Keil (not IAR)
Parameters
[in] type_name Name of the type stored in the section
[in] section_name Name of the section
#define NRF_SECTION_VARS_START_ADDR ( section_name ) (uint32_t)& NRF_SECTION_VARS_START_SYMBOL (section_name)

Macro for accessing the start address of a named section.

param[in] section_name Name of the section to get the start address from

#define NRF_SECTION_VARS_START_SYMBOL ( section_name ) section_name ## $$Base

Macro for accessing start of a named data section by symbol.

The symbol that this macro resolves to is used to access the section by start address.

Parameters
[in] section_name Name of the section

Please send us your feedback about the documentation! For technical questions, visit the Nordic Developer Zone .