User and program memory refers to all the memory that is required for your compiled
executable to run. By convention, this includes memories for storing instructions,
read-only data, read-write data, program stack, and program heap. These sections can be
stored in any addressable memory in your system. By default the compiler generates code
and data starting from the address listed in the table in Reserved Memory and occupying contiguous memory locations. This is the
most common memory layout for programs. You can modify the starting location of your
program by defining (in the linker) the symbol
START_ADDR for Arm.
In special cases, you might want to partition the various sections of your ELF file across different memories. This is done using the linker command language (refer to Linker Scripts for details). The following are some situations in which you might want to change the memory map of your executable:
- When partitioning large code segments across multiple smaller memories
- Remapping frequently executed sections to fast memories
- Mapping read-only segments to non-volatile flash memories
No restrictions apply to how you can partition your executable. The partitioning can be done at the output section level, or even at the individual function and data level. The resulting ELF can be non-contiguous, that is, there can be “holes” in the memory map. Ensure that you do not use documented reserved locations.
Alternatively, if you are an advanced user and want to modify the default binary data provided by the tools for the reserved memory locations, you can do so. In this case, you must replace the default startup files and the memory mappings provided by the linker.