Keil™, An ARM® Company

RealView Linker and Utilities Guide

Image entry points

3.1.4. Image entry points

An entry point in an image is a location where program execution can start. 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

These are entry points that are set in the assembly language sources with the ENTRY directive. In embedded systems, this directive is typically used to mark code that is entered through the processor exception vectors, such as RESET, IRQ, and FIQ.

You can specify multiple entry points in an image with the ENTRY directive. 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.

See the Assembler Guide for more information on the ENTRY directive.

If an embedded image is to be used by a loader, it must have a single initial entry point specified in the header. See Specifying an initial entry point for more information.

Specifying an initial entry point

You can specify an initial entry point with the ‑‑entry linker option. You can specify the ‑‑entry option only once. See the description in armlink command syntax for more information.

For embedded applications with ROM at zero use ‑‑entry 0x0, or optionally 0xFFFF0000 for processors that have high vectors.

The initial entry point must meet the following conditions:

  • the image entry point must always lie within an execution region

  • the execution region must be non‑overlay, and must be a root execution region (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.

    In both these situations, the linker issues a warning.

    Specify a unique entry point with ‑‑entry to fix this warning.

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