MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
MPLAB C Compiler for PIC24 MCUs and dsPIC DSCs ... - Microchip
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
16-Bit C <strong>Compiler</strong> User’s Guide<br />
3.7 PREDEFINED MACRO NAMES<br />
The compiler predefines several macros which can be tested by conditional directives<br />
in source code.<br />
The following preprocessing symbols are defined by the compiler being used.<br />
<strong>Compiler</strong> Symbol Defined with -ansi comm<strong>and</strong>-line option?<br />
16-Bit <strong>Compiler</strong> C30 No<br />
__C30 Yes<br />
__C30__ Yes<br />
ELF-specific C30ELF No<br />
__C30ELF Yes<br />
__C30ELF__ Yes<br />
COFF-specific C30COFF No<br />
__C30COFF Yes<br />
__C30COFF__ Yes<br />
The following symbols define the target family.<br />
Symbol Defined with -ansi comm<strong>and</strong>-line option?<br />
__<strong>dsPIC</strong>30F__ Yes<br />
__<strong>dsPIC</strong>33F__ Yes<br />
__<strong>PIC24</strong>F__ Yes<br />
__<strong>PIC24</strong>H__ Yes<br />
In addition, the compiler defines a symbol based on the target device set with -mcpu=.<br />
For example, -mcpu=30F6014, which defines the symbol __<strong>dsPIC</strong>30F6014__.<br />
The compiler will define the constant __C30_VERSION__, giving a numeric value to<br />
the version identifier. This can be used to take advantage of new compiler features<br />
while still remaining backward compatible with older versions.<br />
The value is based upon the major <strong>and</strong> minor version numbers of the current release.<br />
For example, release version 2.00 will have a __C30_VERSION__ definition of 200.<br />
This macro can be used, in conjunction with st<strong>and</strong>ard preprocessor comparison statements,<br />
to conditionally include/exclude various code constructs.<br />
The current definition of __C30_VERSION__ can be discovered by adding<br />
--version to the comm<strong>and</strong> line, or by inspecting the README.html file that came<br />
with the release.<br />
Constants that have been deprecated may be found in Appendix E. “Deprecated<br />
Features”.<br />
3.8 COMPILING A SINGLE FILE ON THE COMMAND LINE<br />
This section demonstrates how to compile <strong>and</strong> link a single file. For the purpose of this<br />
discussion, it is assumed the compiler is installed on your c: drive in the st<strong>and</strong>ard<br />
directory location. There<strong>for</strong>e, the following will apply:<br />
• c:\Program Files\<strong>Microchip</strong>\<strong>MPLAB</strong> C30\include - Include directory <strong>for</strong><br />
ANSI C header file. This directory is where the compiler stores the st<strong>and</strong>ard C<br />
library system header files. The PIC30_C_INCLUDE_PATH environment variable<br />
can point to that directory. (From the DOS comm<strong>and</strong> prompt, type set to check<br />
this.)<br />
• c:\Program Files\<strong>Microchip</strong>\<strong>MPLAB</strong> C30\support\<strong>dsPIC</strong>30F\h -<br />
Include directory <strong>for</strong> <strong>dsPIC</strong>® DSC device-specific header files. This directory is<br />
where the compiler stores the <strong>dsPIC</strong> DSC device-specific header files.<br />
DS51284H-page 60 © 2008 <strong>Microchip</strong> Technology Inc.