Learning path

Full curriculum

Full curriculum

Unit content

Embedded memory maps and linker scripts

A microcontroller address space can contain several kinds of memory and hardware at fixed address ranges: nonvolatile program memory, RAM and memory-mapped peripheral registers.

A linked firmware image is divided into sections with different purposes. Typical examples are executable code, read-only constants, initialized writable data and zero-initialized data.

A linker script describes where these sections should be placed in the target memory map. It can also define symbols marking boundaries used by startup code, stacks or other low-level routines.

For example, code and initial data values may live in flash while writable variables must reside in RAM after startup.

The linker can reject an image when a section no longer fits into the memory region assigned to it. This makes target memory capacity part of the build rather than a failure discovered only at runtime.

Embedded linking therefore connects language-level objects to physical target addresses and memory technologies.