EMBEDDED SYSTEMS & MICROCONTROLLERS · PAGE 26
The Microcontroller Memory Map
One address space, several regions.
A memory map shows which address ranges hold flash, SRAM, peripheral registers and special areas. The CPU uses the same load and store instructions for all of them.
At startup, code copies initial values for global variables from flash to SRAM and zeroes the rest. The stack grows from one end of SRAM while the heap, if used, grows from the other.
If they meet, the program crashes in confusing ways, which is why small chips avoid dynamic allocation.