14.01.2015 Views

RealView Compilation Tools Developer Guide - ARM Information ...

RealView Compilation Tools Developer Guide - ARM Information ...

RealView Compilation Tools Developer Guide - ARM Information ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Embedded Software Development<br />

2.2.5 Application startup<br />

In most embedded systems, an initialization sequence executes to set up the system<br />

before the main task is executed.<br />

Figure 2-5 shows the default initialization sequence.<br />

Image<br />

entry point<br />

__main<br />

C Library<br />

USER CODE<br />

.<br />

__scatterload<br />

copy/decompress RW data<br />

copy non-root code<br />

zero uninitialized data<br />

.<br />

.<br />

.<br />

__rt_entry<br />

set up application stack<br />

and heap<br />

initialize library functions<br />

call top-level<br />

constructors (C++)<br />

Exit from application<br />

.<br />

main()<br />

causes the linker to<br />

link in library<br />

initialization code<br />

Figure 2-5 Default initialization sequence<br />

At a high level, the initialization sequence can be divided into three functional blocks.<br />

__main branches directly to __scatterload. __scatterload is responsible for setting the<br />

runtime image memory map, whereas __rt_entry (runtime entry) is responsible for<br />

initializing the C library.<br />

__scatterload carries out code and data copying, decompression of RW data if<br />

necessary, and zeroing of ZI data.<br />

__scatterload branches to __rt_entry. This sets up the application stack and heap,<br />

initializes library functions and their static data, and calls any constructors of globally<br />

declared objects (C++ only).<br />

2-10 Copyright © 2002-2007 <strong>ARM</strong> Limited. All rights reserved. <strong>ARM</strong> DUI 0203H<br />

Non-Confidential

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!