7.4 Building the Example

If this chapter's source code was saved in a plain text file, called timedLED.S, for example, it could be built using the command below. Note that the file name uses an upper case .S extension so that the file is preprocessed before any other processing.
pic-as -mcpu=16F18446 -Wl,-presetVec=0h -Wl,-pisrVec=04h -Wa,-a -Wl,-Map=timedLED.map timedLED.S

The psect containing the reset code has been linked to address 0 and in addition, the psect holding the interrupt routine was linked to the device's vector location, address 0x4. The command also includes the -Wl,-Map=timedLED.map option to generate a map file and the -Wa,-a option to generate an assembly list file, which will be called timedLED.lst.

If you are building in the MPLAB X IDE, add additional linker options (such as those specified using the driver option -Wl,linkerOption) to the Custom linker options field in the pic-as Linker > general category in the Project Properties dialog. When adding options to this field, do not include the leading -Wl,, as this prefix is added in by the IDE. Specify additional options to the assembler (such as the -Wa,assemblerOption) in the Additional options field in the pic-as Global Options category (the leading -Wa, must be specified). See Building the Example for screen captures showing where these additional options should be added.