7.2.1 Register Definition Files

The processor header files described in Device Header Files name all SFRs for each part, but they do not define the addresses of the SFRs. A separate set of device-specific linker script files, one per part, is distributed in the support/family/gld directory. These linker script files define the SFR addresses. To use one of these files, specify the linker command-line option:

-T pdevice.gld

where device corresponds to an abbreviated device number.

For example, assuming that there is a file named app106.c that contains an application for the PIC32AK1216GC41064 part, then it may be compiled and linked using the following command line:

xc32-gcc -mcpu=32AK1216GC41064 -o app106.out -T p32AK1216GC41064.gld app106.c

The -o command-line option names the output executable file, and the -T option gives the linker script name for the PIC32AK1216GC41064 part. If 32AK1216GC41064.gld is not found in the current directory, the linker searches in its known library paths. The default search path includes all locations of preinstalled libraries and linker scripts.

It is unlikely that you will need to customize a linker script but if you do, you should copy the appropriate linker script file (supplied with the compiler) into your project directory before any project-specific modifications are made.