Default memory map
In an image where you have not described the memory map, the linker places code and data according to a default memory map.
Figure 7-2 Default memory map
NoteThe processors based on Armv6‑M and Armv7‑M architectures have fixed memory maps. This makes porting software easier between different systems based on these processors.
The default memory map is described as follows:
The image is linked to load and run at address
0x8000. All Read Only (RO) sections are placed first, followed by Read-Write (RW) sections, then zero-initialized (ZI) sections.
The heap follows directly on from the top of ZI, so the exact location is decided at link time.
The stack base location is provided by a semihosting operation during application startup. The value returned by this semihosting operation depends on the debug environment.
The linker observes a set of rules to decide where in memory code and data are located:
Figure 7-3 Linker placement rules
Generally, the linker sorts the input sections by attribute (RO, RW, ZI), by name, and then by position in the input list.
To fully control the placement of code and data you must use the scatter-loading mechanism.