07.04.2013 Views

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

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>MPLAB</strong> ® C COMPILER FOR<br />

<strong>PIC24</strong> <strong>MCUs</strong> AND <strong>dsPIC</strong> ® <strong>DSCs</strong><br />

USER’S GUIDE<br />

Chapter 3. Using the <strong>Compiler</strong> on the Comm<strong>and</strong> Line<br />

3.1 INTRODUCTION<br />

3.2 HIGHLIGHTS<br />

3.3 OVERVIEW<br />

This chapter discusses using the <strong>MPLAB</strong> C <strong>Compiler</strong> <strong>for</strong> <strong>PIC24</strong> <strong>MCUs</strong> <strong>and</strong> <strong>dsPIC</strong> ®<br />

<strong>DSCs</strong> (<strong>for</strong>merly <strong>MPLAB</strong> C30) on the comm<strong>and</strong> line. For in<strong>for</strong>mation on using the compiler<br />

with <strong>MPLAB</strong> IDE, please refer to the “16-bit Language Tools Getting Started”<br />

(DS70094).<br />

Items discussed in this chapter are:<br />

• Overview<br />

• File Naming Conventions<br />

• Options<br />

• Environment Variables<br />

• Predefined Macro Names<br />

• Compiling a Single File on the Comm<strong>and</strong> Line<br />

• Compiling Multiple Files on the Comm<strong>and</strong> Line<br />

• Notable Symbols<br />

The compilation driver program (pic30-gcc) compiles, assembles <strong>and</strong> links C <strong>and</strong><br />

assembly language modules <strong>and</strong> library archives. Most of the compiler comm<strong>and</strong>-line<br />

options are common to all implementations of the GCC toolset. A few are specific to<br />

the compiler.<br />

The basic <strong>for</strong>m of the compiler comm<strong>and</strong> line is:<br />

pic30-gcc [options] files<br />

Note: This executable name applies <strong>for</strong> all 16-bit compilers, i.e., <strong>MPLAB</strong> C <strong>Compiler</strong><br />

<strong>for</strong> <strong>PIC24</strong> <strong>MCUs</strong> <strong>and</strong> <strong>dsPIC</strong> ® <strong>DSCs</strong>, <strong>MPLAB</strong> C <strong>Compiler</strong> <strong>for</strong> <strong>dsPIC</strong> ®<br />

<strong>DSCs</strong>, <strong>and</strong> <strong>MPLAB</strong> C <strong>Compiler</strong> <strong>for</strong> <strong>PIC24</strong> <strong>MCUs</strong>.<br />

The available options are described in Section 3.5 “Options”.<br />

Note: Comm<strong>and</strong> line options <strong>and</strong> file name extensions are case-sensitive.<br />

For example, to compile, assemble <strong>and</strong> link the C source file hello.c, creating the<br />

absolute executable hello.exe.<br />

pic30-gcc -o hello.exe hello.c<br />

© 2008 <strong>Microchip</strong> Technology Inc. DS51284H-page 33

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!