11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

System startup and termination●●depending on the return value of __low_level_init. For more details, seeInitialized data, page 37Static <strong>C++</strong> objects are constructedThe main function is called, which starts the application.SYSTEM TERMINATIONThere are four ways your embedded application can terminate in a controlled way:Figure 3: System termination phaseAn application can terminate normally in two different ways:●Return from the main function● Call the exit function.As the ISO/ANSI C standard states that the two methods should be equivalent, thesystem startup code calls the exit function if main returns. The parameter passed to theexit function is the return value of main.The default exit function is written in C. It calls a small assembler function _exit thatwill perform the following operations:●●●●Call functions registered to be executed when the application ends. This includes<strong>C++</strong> destructors for static and global variables, and functions registered with thestandard C function atexitClose all open filesCall __exitWhen __exit is reached, stop the system.58<strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong>Reference Guide

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

Saved successfully!

Ooh no, something went wrong!