SoCs that need code to run while flash is unavailable select
CONFIG_RAMFUNC, which adds a .ramfunc output section loaded from flash
and copied to RAM at boot. Code gets there in one of three ways:
a function marked PBL_SECTION_RAM, or a constant marked
PBL_SECTION_RAM_RODATA (pbl/kernel/section.h);
whole source files, with pbl_library_ramfunc(file.c ...) next to the
library’s pbl_library_sources();
input section patterns registered against the ramfunc linker hook, for
vendor code annotated its own way.
Without CONFIG_RAMFUNC all three are no-ops and the code stays in flash.
The linker scripts document the memory map. kernel/pebbleos.ld explains
the sections, their load and run addresses, and the kernel’s data, stack and
heap; kernel/linker/memory.ld how SRAM is divided between the kernel, the
app and the worker; and, on ARM, kernel/arch/arm/linker/regions.ld the
alignment the MPU imposes on those regions.
Generated from PebbleOS 3a7b71785. This page is maintained in the pebbleos repository: docs/kernel/memory.md.