</>EmbeddedInterview

What does a map file tell you?

MediumDebugging, Testing & Tools

Short answer: The linker map file (-Wl,-Map=app.map) shows where everything ended up in memory: the memory regions and how full they are, the address and size of every section (.text, .rodata, .data, .bss, stacks, heap), which object files and library members contributed to each section, the address of every symbol, which sections were discarded by --gc-sections, and why library objects were pulled in. It is the primary tool for understanding and reducing flash and RAM usage and for mapping crash addresses to functions.

What to look for

Question Where in the map
How much flash/RAM is used? memory configuration and the end addresses of sections (or arm-none-eabi-size)
What is using all the flash? sizes per input section/object under .text and .rodata
Why is printf/float code present? "archive member included to satisfy reference by file (symbol)" lines at the top
Where is a variable or function? symbol addresses (for watchpoints, crash analysis)
Is a buffer in the right RAM (DTCM, non-cacheable, backup SRAM)? output section placement
Initialised data cost .data takes space in both flash (initial values) and RAM

Helpful tools: arm-none-eabi-nm --size-sort -S -C app.elf | tail -30 (largest symbols), bloaty, puncover (per-function code and stack size in a web view), Amap / MapViewer GUIs, and size -A for per-section totals.

Interview example: "Flash grew by 20 KB after a small change; the map file showed _dtoa_r and floating-point emulation pulled in by a %f in one debug message. Removing it (or using a fixed-point print) recovered the space."