3.5.18 How Do I Customize the C Runtime Startup Code?

Some applications may require an application-specific version of the C runtime startup code. For instance, you may want to modify the startup code for an application loaded by a bootloader.

To customize the startup code for your application:

  1. Start with the default startup code, a copy of which is located in 
<install-directory>/pic32c/lib/proc/<device>/startup_<device>.c 
You may also choose to get this file from the Device Family Pack (DFP).
Make a copy of this .c file, rename it, and add it to your project.
  2. Change your MPLAB X project to exclude the default startup code by passing the -mno-device-startup-code option to the xc32-gcc driver at link time. This option is available as “Do not link device startup code” in the MPLAB X project properties under Options for xc32-ld in the Libraries category. When you build your project, the MPLAB X will build your new application-specific copy of the startup code rather than linking in the default code.
    Figure 3-1. Startup Code Properties Setting