PebbleOS
Loading...
Searching...
No Matches
Macros
Code and data placement

Placement of code and data in special sections. More...

Macros

#define PBL_SECTION_RAM
 Run the function from RAM; also prevents inlining it into flash code.
 
#define PBL_SECTION_RAM_RODATA
 Place the constant in RAM, for tables used by PBL_SECTION_RAM functions.
 
#define PBL_UNSORTED_SECTION(name)   PBL_SECTION_IMPL(#name) PBL_NO_SANITIZE_ADDRESS
 Gather the object in a named section, without a linker script.
 
#define PBL_UNSORTED_SECTION_START(name)   __asm("__start_" #name)
 Name a declaration after the start of a PBL_UNSORTED_SECTION.
 
#define PBL_UNSORTED_SECTION_END(name)   __asm("__stop_" #name)
 Name a declaration after the end of a PBL_UNSORTED_SECTION.
 

Detailed Description

Placement of code and data in special sections.

SoCs that need code to run while flash is unavailable select CONFIG_RAMFUNC, which adds a .ramfunc section loaded from flash and copied to RAM at boot. Without it these markers are no-ops and everything stays in flash.

static const uint8_t s_table[] PBL_SECTION_RAM_RODATA = {1, 2, 4, 8};
PBL_SECTION_RAM void prv_enter_sleep(void) {
// flash is off here
}
#define PBL_SECTION_RAM_RODATA
Place the constant in RAM, for tables used by PBL_SECTION_RAM functions.
Definition section.h:42
#define PBL_SECTION_RAM
Run the function from RAM; also prevents inlining it into flash code.
Definition section.h:41

Macro Definition Documentation

◆ PBL_SECTION_RAM

#define PBL_SECTION_RAM

Run the function from RAM; also prevents inlining it into flash code.

◆ PBL_SECTION_RAM_RODATA

#define PBL_SECTION_RAM_RODATA

Place the constant in RAM, for tables used by PBL_SECTION_RAM functions.

◆ PBL_UNSORTED_SECTION

#define PBL_UNSORTED_SECTION (   name)    PBL_SECTION_IMPL(#name) PBL_NO_SANITIZE_ADDRESS

Gather the object in a named section, without a linker script.

For builds linked without the firmware linker script (PBL_NO_LINKER_SCRIPT), where PBL_SECTION is a no-op: the linker collects such a section on its own, in no particular order, and names its bounds PBL_UNSORTED_SECTION_START() and PBL_UNSORTED_SECTION_END(). The objects must be PBL_USED.

extern const struct foo foo_start[] PBL_UNSORTED_SECTION_START(foos);
extern const struct foo foo_end[] PBL_UNSORTED_SECTION_END(foos);
static const struct foo s_foo PBL_USED PBL_UNSORTED_SECTION(foos) = {...};
#define PBL_USED
Keep the symbol even if it appears unreferenced.
Definition compiler.h:95
#define PBL_UNSORTED_SECTION_END(name)
Name a declaration after the end of a PBL_UNSORTED_SECTION.
Definition section.h:81
#define PBL_UNSORTED_SECTION_START(name)
Name a declaration after the start of a PBL_UNSORTED_SECTION.
Definition section.h:80
#define PBL_UNSORTED_SECTION(name)
Gather the object in a named section, without a linker script.
Definition section.h:79
Parameters
nameSection name, a C identifier of at most 14 characters (Mach-O allows 16).

◆ PBL_UNSORTED_SECTION_END

#define PBL_UNSORTED_SECTION_END (   name)    __asm("__stop_" #name)

Name a declaration after the end of a PBL_UNSORTED_SECTION.

◆ PBL_UNSORTED_SECTION_START

#define PBL_UNSORTED_SECTION_START (   name)    __asm("__start_" #name)

Name a declaration after the start of a PBL_UNSORTED_SECTION.