Startup Code

In order to initialize variables in data memory, the linker creates a data initialization template. This template must be processed at startup, before the application proper takes control. For C programs, this function is performed by the startup modules inlibpic30-coff.a (either crt0.o or crt1.o) or libpic30-elf.a (either crt0.eo or crt1.eo). Assembly language programs can utilize these modules directly by linking with the desired startup module file. The source code for the startup modules is provided in corresponding .s files.

The primary startup module (crt0) initializes all variables (variables without initializers are set to zero as required by the ANSI standard) except for variables in the persistent data section. The alternate startup module (crt1) performs no data initialization.

For more information on start-up code, see the “MPLAB® XC16 Assembler, Linker and Utilities User’s Guide” (DS52106) and for C applications, the “MPLAB® XC16 C Compiler User’s Guide” (DS00052071).