9.4 Using Custom Linker Scripts in MPLAB X IDE Projects
The standard default 32-bit linker scripts are general purpose and will satisfy the demands of most applications. However, an occasion may arise where a custom linker script is required.
Copy the default device-specific fragment of the linker script file (see
9.3 Default Linker Script) into your
application's project directory. This file will have a .ld
extension and should be added to your project. It should appear in the
project tree under “Linker Files.” Upon linking your project, the linker prints the name
and path of the linker script that is currently being used. Use this to confirm that your
script is being selected.
Customizations that you make to your new *.ld
file will be reflected in subsequent builds.
You may wish to retain unused sections in a custom linker script, since unused sections will not impact application memory usage. If a section must be removed for a custom script, C style comments can be used to disable it.