9.2 Building the Example

If the entire example source code for this chapter was saved in a plain text file, called incPort.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=16F570 -Wl,-presetVec=0h -Wa,-a -Wl,-Map=incPort.map incPort.S

The psect containing the reset code has been linked to address 0. The command also includes the options to generate a map file (incPort.map). The option, -Wa,-a, generates an assembly list file (incPort.lst), so you can explore the generated code.

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.