8.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 p30fxxxx.gld

where xxxx corresponds to the device part number.

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

xc16-gcc -mcpu=30f2010 -o app2010.out -T p30f2010.gld app2010.c

The -o command-line option names the output executable file, and the -T option gives the linker script name for the dsPIC30F2010 part. If p30f2010.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.

You should copy the appropriate linker script file (supplied with the compiler) into your project directory before any project-specific modifications are made.