macro_rules! init_sections_with_prefixes {
($($section_name:ident($beg:ident,$end:ident,$src:ident)$(,)?)+) => { ... };
}
Expand description
Defines pre-init function initializing linker section memory.
This macro accepts linker section names and symbol prefixes as arguments. If your section
symbols are prefixed with __s
, __e
and __si
, look at init_sections
.
If the symbols in the linker script are named __scustom_data
, __ecustom_data
and __sicustom_data
,
as depicted in an example below, the macro call should be
init_sections_with_prefixes!(custom_data(__s, __e, __si))
MEMORY
{
FLASH : ORIGIN = 0x08000000, LENGTH = 32K
RAM : ORIGIN = 0x20000000, LENGTH = 16K
DATA : ORIGIN = 0x20004000, LENGTH = 16K
}
SECTIONS
{
.custom_data : ALIGN(4)
{
. = ALIGN(4);
__scustom_data = .;
*(.custom_data .custom_data.*);
. = ALIGN(4);
__ecustom_data = .;
} > DATA AT>FLASH
__sicustom_data = LOADADDR(.custom_data);
} INSERT BEFORE .uninit;
Multiple section names could be passed as
init_sections_with_prefixes!(section_a(__s, __e __si), section_b(__s, __e, __si));
init_sections_with_prefixes!(section_a(__s,__e,__si),);
init_sections_with_prefixes!(
section_a(__s, __e, __si)
section_b(__s, __e, __si,)
section_c(__s __e __si)
);