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.
In MPLAB X IDE, go to File > Project Properties > xc32-ld. Select Libraries for Option categories. Check the Do not link startup code option. 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.