2.2.5. Application startup

In most embedded systems, an initialization sequence executes to set up the system before the main task is executed.

Figure 2.5 shows the default initialization sequence.

Figure 2.5. Default initialization sequence

At a high level, the initialization sequence can be divided into three functional blocks. __main branches directly to __scatterload. __scatterload is responsible for setting the runtime image memory map, whereas __rt_entry (runtime entry) is responsible for initializing the C library.

__scatterload carries out code and data copying, decompression of RW data if necessary, and zeroing of ZI data.

__scatterload branches to __rt_entry. This sets up the application stack and heap, initializes library functions and their static data, and calls any constructors of globally declared objects (C++ only).

__rt_entry then branches to main(), the entry to your application. When the main application has finished executing, __rt_entry shuts down the library, then hands control back to the debugger.

The function label main() has a special significance. The presence of a main() function forces the linker to link in the initialization code in __main and __rt_entry. Without a function labeled main() the initialization sequence is not linked in, and as a result, some standard C library functionality is not supported.

Copyright © 2002-2006 ARM Limited. All rights reserved.ARM DUI 0203G