22.3 Default Linker Script

For PIC32MX Devices Only:

If no linker script or alternative Device Family Pack (DFP) is specified on the command line, the linker will use an internal version known as the built-in default linker script. The default linker script has section mapping that is appropriate for all PIC32 MCUs. It uses an INCLUDE directive to include the device-specific memory regions.

The default linker script is appropriate for most PIC32 MCU applications. Only applications with specific memory-allocation needs will require an application-specific linker script. The default linker script can be examined by invoking the linker with the --verbose option:
xc32-ld --verbose

In a normal tool-suite installation, a copy of the default linker script is located at /pic32m/lib/ldscripts/pic32m.x. Note that this file is only a copy of the default linker script. The script that the linker uses is internal to the linker.

The device-specific portion of the linker script is located in xc32/<device>/procdefs.ld, where <device> is the device value specified to the -mprocessor compilation-driver (xc32-gcc) option.

For PIC32MZ and Later Devices:

The linker script for PIC32MZ devices are contained within a single file (for example, xc32/<device>/p32MZ2064DAG176.ld). Like before, the xc32-gcc compilation driver will pass the device-specific linker script to the linker when building with -mprocessor option.

The default linker script contains the following categories of information:

Note: All addresses specified in the linker scripts should be specified as virtual addresses, not physical addresses.