Specifications
CAVR-4
66
Customizing system initialization
AVR® IAR C/C++ Compiler
Reference Guide
C-SPY interface to system termination
If your project is linked with the XLINK options With runtime control modules or
With I/O emulation modules, the normal
__exit and abort functions are replaced
with special ones. C-SPY will then recognize when those functions are called and can
take appropriate actions to simulate program termination. For more information, see
C-SPY Debugger runtime interface, page 76.
Customizing system initialization
It is likely that you need to customize the code for system initialization. For example,
your application might need to initialize memory-mapped special function registers
(SFRs), or omit the default initialization of data segments performed by
cstartup.
You can do this by providing a customized version of the routine
__low_level_init,
which is called from cmain before the data segments are initialized. Modifying the file
cstartup directly should be avoided.
The code for handling system startup is located in the source files
cstartup.s90 and
low_level_init.c, located in the avr\src directory.
Note: Normally, there is no need for customizing either of the files
cmain.s90 or
cexit.s90.
If you intend to rebuild the library, the source files are available in the template library
project, see Building and using a customized library, page 62.
Note: Regardless of whether you modify the routine
__low_level_init or the file
cstartup.s90, you do not have to rebuild the library.
__LOW_LEVEL_INIT
Some applications may need to initialize I/O registers, omit the default initialization of
data segments performed by the system startup code, or set up for use of external
memory.
You can do this by providing a customized version of the routine
__low_level_init,
which is called from the system startup code before the data segments are initialized.
The value returned by
__low_level_init determines whether or not data segments
should be initialized by the system startup code. If the function returns
0, the data
segments will not be initialized.
Note: The file
intrinsics.h must be included by low_level_init.c to assure
correct behavior of the __low_level_init routine.