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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

TABLE 3-10: MACHINE-INDEPENDENT OPTIMIZATION OPTIONS<br />

Option Definition<br />

-fkeep-inline-functions Even if all calls to a given function are integrated, <strong>and</strong> the<br />

function is declared static, output a separate run time<br />

callable version of the function. This switch does not<br />

affect extern inline functions.<br />

-fkeep-static-consts Emit variables declared static const when optimization<br />

isn’t turned on, even if the variables aren’t referenced.<br />

The compiler enables this option by default. If you want to<br />

<strong>for</strong>ce the compiler to check if the variable was referenced,<br />

regardless of whether or not optimization is turned on,<br />

use the -fno-keep-static-consts option.<br />

-fno-function-cse Do not put function addresses in registers; make each<br />

instruction that calls a constant function contain the<br />

function’s address explicitly.<br />

This option results in less efficient code, but some<br />

strange hacks that alter the assembler output may be<br />

confused by the optimizations per<strong>for</strong>med when this option<br />

is not used.<br />

-fno-inline Do not pay attention to the inline keyword. Normally<br />

this option is used to keep the compiler from exp<strong>and</strong>ing<br />

any functions inline. If optimization is not enabled, no<br />

functions can be exp<strong>and</strong>ed inline.<br />

-fomit-frame-pointer Do not keep the Frame Pointer in a register <strong>for</strong> functions<br />

that don’t need one. This avoids the instructions to save,<br />

set up <strong>and</strong> restore Frame Pointers; it also makes an extra<br />

register available in many functions.<br />

-foptimize-sibling-calls Optimize sibling <strong>and</strong> tail recursive calls.<br />

3.5.7 Options <strong>for</strong> Controlling the Preprocessor<br />

The following options control the compiler preprocessor.<br />

TABLE 3-11: PREPROCESSOR OPTIONS<br />

Option Definition<br />

-Aquestion (answer) Assert the answer answer <strong>for</strong> question question, in case it is<br />

tested with a preprocessing conditional such as #if<br />

#question(answer). -A- disables the st<strong>and</strong>ard assertions<br />

that normally describe the target machine.<br />

For example, the function prototype <strong>for</strong> main might be declared<br />

as follows:<br />

#if #environ(freest<strong>and</strong>ing)<br />

int main(void);<br />

#else<br />

int main(int argc, char *argv[]);<br />

#endif<br />

A -A comm<strong>and</strong>-line option could then be used to select<br />

between the two prototypes. For example, to select the first of<br />

the two, the following comm<strong>and</strong>-line option could be used:<br />

-Aenviron(freest<strong>and</strong>ing)<br />

-A -predicate =answer Cancel an assertion with the predicate predicate <strong>and</strong> answer<br />

answer.<br />

-A predicate =answer Make an assertion with the predicate predicate <strong>and</strong> answer<br />

answer. This <strong>for</strong>m is preferred to the older <strong>for</strong>m<br />

-A predicate(answer), which is still supported, because it<br />

does not use shell special characters.<br />

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

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

Saved successfully!

Ooh no, something went wrong!