Keil™, An ARM® Company

RealView Linker and Utilities Guide

Specifying memory map information for the image

2.2.6. Specifying memory map information for the image

Use the following options to specify memory maps:

‑‑[no_]autoat

Controls the automatic assignment of __at sections to execution regions. __at sections are sections that must be placed at a specific address. See Using __at sections to place sections at a specific address for more information.

If enabled, the linker automatically selects an execution region for each __at section. If a suitable execution region does not exist, the linker creates a load region and an execution region to contain the __at section.

If disabled, the standard scatter-loading section selection rules apply. See Input section description for more information.

The default is ‑‑autoat.

‑‑predefine=”string

Enables commands to be passed to the pre-processor specified on the first line of the scatter file. You can also use the synonym:‑‑pd=”string”.

More than one ‑‑predefine option can be used on the command-line. Use this option with ‑‑scatter. Example 2.1 shows how the scatter file looks before pre-processing.

Example 2.1. Scatter file before pre-processing

Scatter file:
#! armcc -E
lr1 BASE
{
    er1 BASE
    {
        *(+RO)
    }
    er2 BASE2
    {
        *(+RW+ZI)
    }
}

Use armlink with the command-line options:

‑‑predefine="-DBASE=0x8000" ‑‑predefine="-DBASE2=0x1000000" --scatter file

This passes the command-line options: -DBASE=0x8000 -DBASE2=0x1000000 to the compiler to pre-process the scatter file.

Example 2.2 shows how the scatter file looks after pre-processing:

Example 2.2. Scatter file after pre-processing

lr1 0x8000
{
    er1 0x8000
    {
        *(+RO)
    }
    er2 0x1000000
    {
        *(+RW+ZI)
    }
}
‑‑ro‑base address

Sets both the load and execution addresses of the region containing the RO output section at address. address must be word-aligned. If this option is not specified, and no scatter-load file is specified, the default RO base address is 0x8000.

‑‑ropi

Makes the load and execution region containing the RO output section position-independent. If this option is not used, the region is marked as absolute. Usually each read-only input section must be read-only position-independent (ROPI). If this option is selected, the linker:

  • checks that relocations between sections are valid

  • ensures that any code generated by armlink itself, such as interworking veneers, is read-only position-independent.

Note

The linker gives a downgradeable error if --ropi is used without --rwpi or --rw-base.

‑‑rosplit

Splits the default RO load region into two RO output sections, one for RO-CODE and one for RO-DATA.

‑‑rw‑base address

Sets the execution addresses of the region containing the RW output section at address. address must be word-aligned.

‑‑rwpi

Makes the load and execution region containing the RW and ZI output section position-independent. If this option is not used the region is marked as absolute. This option requires a value for ‑‑rw‑base. If ‑‑rw‑base is not specified, ‑‑rw‑base 0 is assumed. Usually each writable input section must be read-write position-independent (RWPI).

If this option is selected, the linker:

  • checks that the PI attribute is set on input sections to any read-write execution regions

  • checks that relocations between sections are valid

  • generates entries relative to the static base in the table Region$$Table.

    This is used when regions are copied, decompressed, or initialized.

‑‑scatter file

Creates the image memory map using the scatter-loading description contained in file. The description provides grouping and placement details of the various regions and sections in the image. See Chapter 5 Using Scatter-loading Description Files.

The ‑‑scatter option cannot be used with any of the memory map options ‑‑partial,‑‑ro‑base, ‑‑rw‑base, ‑‑ropi, ‑‑rwpi, ‑‑rosplit, or ‑‑split, and with ‑‑reloc, and ‑‑startup.

‑‑split

Splits the default load region, that contains the RO and RW output sections, into the following load regions:

  • One region containing the RO output section. The default load address is 0x8000, but a different address can be specified with the ‑‑ro‑base option.

  • One region containing the RW and ZI output sections. The load address is specified with the ‑‑rw‑base option. This option requires a value for ‑‑rw‑base. If ‑‑rw‑base is not specified, ‑‑rw‑base 0 is assumed.

Both regions are root regions. See Specifying the image structure for more information.

Copyright © 2007 ARM Limited. All rights reserved.ARM DUI 0377A