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 8-2 Default memory map
NoteThe processors that are based on Arm®v6‑M and Armv7‑M architectures have fixed memory maps. Having fixed memory maps makes porting software easier between different systems that are 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 that this semihosting operation returns depends on the debug environment.
The linker observes a set of rules to decide where in memory code and data are located:
Figure 8-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.