These are the steps to link the customized startup code in XC32:
1
Copy the default startup code "crt0.S”, available under the folder “<Compiler-DIR>\pic32-libs\libpic32\startup”, to your project directory.
2
Customize this Startup code, by making the changes as required.
3
Add this modified startup code (crt0.S) to the MPLAB® X IDE Project under “Source Files”.
You may also change the name of your custom startup code to something like 'my_startup.S'.
4
Set the options to exclude linking of default Startup code.
Under MPLAB X IDE go to:
File ▶ Project Properties ▶ xc32-ld ▶ Option categories = Libraries ▶ Check the option 'Do not link startup code' ▶ Click 'Ok'
5
The code will now link with the customized startup code.
Note that the default startup code source, crt0.S, uses many device-specific macros that should be defined as appropriate for your target device.

