Keil™, An ARM® Company

RealView Linker and Utilities Guide

Region-related symbols

4.2.1. Region-related symbols

Region-related symbols are generated when the linker creates an image. Table 4.1 shows the symbols that the linker generates for every execution region present in the image.

Table 4.1. Region-related linker symbols

SymbolDescription
Load$$region_name$$BaseLoad address of the region
Image$$region_name$$BaseExecution address of the region
Image$$region_name$$LengthExecution region length in bytes (multiple of 4) excluding ZI length
Image$$region_name$$LimitAddress of the byte beyond the end of the non ZI part of the execution region
Image$$region_name$$RO$$BaseExecution address of the RO output section in this region
Image$$region_name$$RO$$LengthLength of the RO output section in bytes (multiple of 4)
Image$$region_name$$RO$$LimitAddress of the byte beyond the end of the RO output section in the execution region
Image$$region_name$$RW$$BaseExecution address of the RW output section in this region
Image$$region_name$$RW$$LengthLength of the RW output section in bytes (multiple of 4)
Image$$region_name$$RW$$LimitAddress of the byte beyond the end of the RW output section in the execution region
Image$$region_name$$ZI$$BaseExecution address of the ZI output section in this region
Image$$region_name$$ZI$$LengthLength of the ZI output section in bytes (multiple of 4)
Image$$region_name$$ZI$$LimitAddress of the byte beyond the end of the ZI output section in the execution region

If you are not using scatter-loading, the linker uses region_name values of:

  • ER_RO, for read-only execution regions

  • ER_RW, for read-write execution regions

  • ER_ZI, for zero-initialized execution regions.

Note

  • The ZI output sections of an image are not created statically, but are automatically created dynamically at runtime. Therefore, there is no load address symbol for ZI output sections.

  • It is recommended that you use region-related symbols in preference to section-related symbols.

Using scatter-loading description files

If you are using scatter-loading, the description file names all the execution regions in the image, and provides their load and execution addresses.

If the description file defines both stack and heap, the linker also generates special stack and heap symbols.

See Chapter 5 Using Scatter-loading Description Files for more information.

Placing the stack and heap above the ZI region

One common use of region-related symbols is to place a heap directly above the ZI region. Example 4.1 shows how to create a retargeted version of __user_initial_stackheap() in assembly language. The example assumes that you are using the default one region memory model from the ARM C libraries. See __user_initial_stackheap() in the Libraries Guide for more information.

Example 4.1. Placing the stack and heap above the ZI region

    EXPORT __user_initial_stackheap
    IMPORT ||Image$$region_name$$ZI$$Limit||
__user_initial_stackheap
    LDR r0, =||Image$$region_name$$ZI$$Limit||
    MOV pc, lr
Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0377A