Memory Sections
Where Variables Live After Compilation
.data
Flash -> copied to RAM at startup
Contains: Initialized global/static variables
int counter = 42;
Initial value stored in flash, copied to SRAM by data_cpy
.bss
RAM — zeroed at startup
Contains: Uninitialized global/static variables
int counter;
NOT stored in binary (saves space!) — memset to 0 at boot
.rodata
Flash — read only
Contains: Constants and string literals
const int MAX = 100;
Lives in flash permanently — cannot be modified at runtime
.data
RAM
Writable
Initialized globals
.bss
RAM
Writable
Uninitialized globals (zeroed)
.rodata
Flash
Read-only
Constants & strings