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.


Some processors, such as Cortex-M7, can boot from a different address in some configurations.
Non-ConfidentialPDF file icon PDF versionARM DUI0474M
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.