Specifications

CAVR-4
90
Overriding default library modules
AVR® IAR C/C++ Compiler
Reference Guide
Static variables are initialized except for __no_init and __eeprom declared
variables; this includes clearing zero-initialized memory and copying the ROM
image of the RAM memory of the remaining initialized variables
The main function is called, which starts the application.
Note that the system startup code contains code for more steps than described here. The
other steps are applicable to the DLIB runtime environment.
SYSTEM TERMINATION
An application can terminate normally in two different ways:
Return from the main function
Call the exit function.
Because the ISO/ANSI C standard states that the two methods should be equivalent, the
cstartup code calls the exit function if main returns. The parameter passed to the
exit function is the return value of main. The default exit function is written in
assembler.
When the application is built in debug mode, C-SPY stops when it reaches the special
code label ?C_EXIT.
An application can also exit by calling the
abort function. The default function just
calls __exit in order to halt the system, without performing any type of cleanup.
Overriding default library modules
The IAR CLIB Library contains modules which you probably need to override with
your own customized modules, for example for character-based I/O, without rebuilding
the entire library. For information about how to override default library modules, see
Overriding library modules, page 61 in the chapter The DLIB runtime environment.
Customizing system initialization
For information about how to customize system initialization, see Customizing system
initialization, page 66.
Implementation of cstartup
For information about cstartup implementation, see Implementation of system startup
code, page 81 in the chapter The DLIB runtime environment.