2.4 Default memory
In an image where you have not described the memory map, the linker places code and data according to a default memory map.
Figure 2-2 Default memory map
The 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
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 2-3 Linker placement rules
Generally, the linker sorts the input sections by attribute,
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.