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

Image entry points

3.1.5 Image entry points

An entry point in an image is the location that is loaded into the PC. It is the location where program execution starts. Although there can be more than one entry point in an image, you can specify only one when linking.

Not every ELF file has to have an entry point. Multiple entry points in a single ELF file are not permitted.


For embedded Cortex-M programs, the program starts at whatever value is loaded into the PC from the Reset vector. Typically, the Reset vector points to the CMSIS Reset_Handler function.

Types of entry point

There are two distinct types of entry point:
Initial entry point
The initial entry point for an image is a single value that is stored in the ELF header file. For programs loaded into RAM by an operating system or boot loader, the loader starts the image execution by transferring control to the initial entry point in the image.
An image can have only one initial entry point. The initial entry point can be, but is not required to be, one of the entry points set by the ENTRY directive.
Entry points set by the ENTRY directive
You can select one of many possible entry points for an image. An image can have only one entry point.
You create entry points in objects with the ENTRY directive in an assembler file. In embedded systems, typical use of this directive is to mark code that is entered through the processor exception vectors, such as RESET, IRQ, and FIQ.
The directive marks the output code section with an ENTRY keyword that instructs the linker not to remove the section when it performs unused section elimination.
For C and C++ programs, the __main() function in the C library is also an entry point.
If an embedded image is to be used by a loader, it must have a single initial entry point specified in the header. Use the --entry command-line option to select the entry point.

The initial entry point for an image

There can be only one initial entry point for an image, otherwise linker warning L6305W is output.

The initial entry point must meet the following conditions:
  • The image entry point must always lie within an execution region.
  • The execution region must not overlay another execution region, and must be a root execution region. That is, where the load address is the same as the execution address.
If you do not use the --entry option to specify the initial entry point then:
  • If the input objects contain only one entry point set by the ENTRY directive, the linker uses that entry point as the initial entry point for the image.
  • The linker generates an image that does not contain an initial entry point when either:
    • More than one entry point has been specified by using the ENTRY directive.
    • No entry point has been specified by using the ENTRY directive.
For embedded applications with ROM at zero use --entry 0x0, or optionally 0xFFFF0000 for processors that are using high vectors.
Related concepts
Related reference
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.