3.3.7.2 What Do I Need Other Than Instructions in an Assembly Source File?

Assembly code typically needs assembler directives as well as the instructions themselves. The operation of all the directives is described in the “MPLAB® XC32 Assembler, Linker and Utilities User’s Guide” (DS50002186). Two common directives are discussed below.

All assembly code must be placed in a section, using the .section directive, so it can be manipulated as a whole by the linker and placed in memory. See the “Linker Processing” chapter of the “MPLAB® XC32 Assembler, Linker and Utilities User’s Guide” (DS50002186) for more information.

Another commonly used directive is .global which is used to make symbols accessible across multiple source files. Find more on this directive in the aforementioned user’s guide.