Keil Logo

Technical Support

On-Line Manuals

Linker User Guide

Preface Overview of the Linker Linking Models Supported by armlink Image Structure and Generation The structure of an ARM ELF image Views of the image at each link stage Input sections, output sections, regions, and prog Load view and execution view of an image Methods of specifying an image memory map with the Image entry points Simple images Types of simple image Type 1 image structure, one load region and contig Type 2 image structure, one load region and non-co Type 3 image structure, multiple load regions and Section placement with the linker Default section placement Section placement with the FIRST and LAST attribut Section alignment with the linker Linker support for creating demand-paged files Linker reordering of execution regions containing Linker-generated veneers What is a veneer? Veneer sharing Veneer types Generation of position independent to absolute ven Reuse of veneers when scatter-loading Command-line options used to control the generatio Weak references and definitions How the linker performs library searching, selecti How the linker searches for the ARM standard libra Specifying user libraries when linking How the linker resolves references The strict family of linker options Linker Optimization Features Getting Image Details Accessing and Managing Symbols with armlink Scatter-loading Features Scatter File Syntax Linker Command-line Options Linker Steering File Command Reference Via File Syntax

Methods of specifying an image memory map with the linker

3.1.4 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.

When constructing 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:
Command-line options for simple memory map descriptions
You can use the following options 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.
  • --xo_base.
  • --zi_base.
These options provide a simplified notation that gives the same settings as a scatter-loading description for a simple image. However, no limit checking for regions is available when using these options.

Note

--xo_base cannot be used with --ropi or --rwpi.
Scatter file for complex memory map descriptions
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 3-2 Comparison of scatter file and equivalent command-line options

Scatter file Equivalent command-line options
LR1 0x0000 0x20000
{
 
    ER_RO 0x0 0x2000
    {
--ro_base=0x0
        init.o (INIT, +FIRST)
        *(+RO)
    }
--first=init.o(init)
    ER_RW 0x400000
    { 
        *(+RW)
    }
--rw_base=0x400000
    ER_ZI 0x405000
    {
        *(+ZI)
    }
}
--zi_base=0x405000
LR_XO 0x8000 0x4000
{
 
    ER_XO 0x8000
    {
        *(XO)
    }
}
--xo_base=0x8000

Note

If XO sections are present, a separate load and execution region is created only when you specify --xo_base. If you do not specify --xo_base, then the ER_XO region is placed in the LR1 region at the address specified by --ro_base. The ER_RO region is then placed immediately after the ER_XO region.
Non-ConfidentialPDF file icon PDF versionARM DUI0377H
Copyright © 2007, 2008, 2011, 2012, 2014-2016 ARM. All rights reserved. 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.