---
title: "Memory"
canonical_url: https://developer.repebble.com/pebbleos/docs/kernel/memory/
last_updated: 2026-10-21
sdk_version: 4.33.1
---
# Memory

Source: https://developer.repebble.com/pebbleos/docs/kernel/memory/

## Code in RAM

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.

## Layout

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](https://github.com/coredevices/pebbleos/commit/3a7b71785fd439666c4a8bc116f561140e8dec01). This page is maintained in the pebbleos repository: [docs/kernel/memory.md](https://github.com/coredevices/pebbleos/blob/3a7b71785fd439666c4a8bc116f561140e8dec01/docs/kernel/memory.md).
