Microchip Technology SW006022-2N Data Sheet
MPLAB
®
XC16 C Compiler User’s Guide
DS52071B-page 188
2012 Microchip Technology Inc.
3.
The data initialization template is read, causing all uninitialized objects to be
cleared, and all initialized objects to be initialized with values read from program
memory. The data initialization template is created by the linker.
cleared, and all initialized objects to be initialized with values read from program
memory. The data initialization template is created by the linker.
4.
If the application has defined user_init functions (see
Section 10.2.2 “Function Attributes”), these are invoked. The order of
execution depends on link order.
Section 10.2.2 “Function Attributes”), these are invoked. The order of
execution depends on link order.
5.
The function main() is called with no parameters.
6.
If main() returns, the processor will reset.
The alternate startup module (crt1.o) is linked when the -Wl, --no-data-init
option is specified. It performs the same operations, except for step (3), which is
omitted. The alternate startup module is smaller than the primary module, and can be
selected to conserve program memory if data initialization is not required.
option is specified. It performs the same operations, except for step (3), which is
omitted. The alternate startup module is smaller than the primary module, and can be
selected to conserve program memory if data initialization is not required.
Source code (in dsPIC DSC assembly language) for both modules is provided in the
<xc16 install directory>\src
<xc16 install directory>\src
directory. The startup modules may be modified
if necessary. For example, if an application requires main to be called with parameters,
a conditional assembly directive may be changed to provide this support.
a conditional assembly directive may be changed to provide this support.
Note:
Persistent data is never cleared or initialized.