You copied the Doc URL to your clipboard.

Methods of specifying an image memory map with the linker

An image can consist of any number of regions and output sections. Regions can have different load and execution addresses. To construct the memory map of an image, armlink must have information about:

  • how input sections are grouped into output sections and regions

  • where regions are to be located in the memory maps.

Depending on the complexity of the memory maps of the image, there are two ways to pass this information to armlink:

Using command-line options

The following options can be used for simple cases where an image has only one or two load regions and up to three execution regions:

  • --first

  • --last

  • --ro_base

  • --rw_base

  • --ropi

  • --rwpi

  • --split

  • --rosplit

  • --zi_base.

These options provide a simplified notation that gives the same settings as a scatter-loading description for a simple image.

Using a scatter file

A scatter file is a textual description of the memory layout and code and data placement. It is used for more complex cases where you require complete control over the grouping and placement of image components. To use a scatter file, specify --scatter=filename at the command-line.

Note

You cannot use --scatter with the other memory map related command-line options.

Table 2. Comparison of scatter file and equivalent command-line options
Scatter fileEquivalent command-line options
LR1 0x0000 0x20000
{
    ER1 0x0 0x2000
    {
        init.o (INIT, +FIRST)
        *(+RO)
    }
    RAM 0x400000
    { 
        *(+RW)
    }
    RAM 0x405000
    {
        *(+ZI)
    }
}


--ro_base=0x0

--first=init.o(init)


--rw_base=0x400000



--zi_base=0x405000

Was this page helpful? Yes No