5.6.3 xc-dsc-gcc (DSC C Compiler)

Although the MPLAB XC-DSC C Compiler works with MPLAB X IDE, it must be acquired separately. The full version may be purchased, or a student (limited-feature) version may be downloaded for free. See the Microchip website (MPLAB® XC Compilers) page for details.

A subset of command-line options may be specified in MPLAB X IDE. Select a category and then set up compiler options. For additional options, see the 6.6 Driver Option Descriptions.

See also 5.6.6 Options Page Features.

Table 5-4. General Category
Option Description Command Line
Generate debugging info Check to create an ELF file with information to allow debugging of code in MPLAB X IDE.

Uncheck for production code.

-g
Isolate each function in a section Check to place each function into its own section in the output file. The name of the function determines the section’s name in the output file.
Note: When you specify this option, the assembler and linker may create larger object and executable files and will also be slower.

Uncheck to place multiple functions in a section.

-ffunction-sections
Place data into its own section Place each data item into its own section in the output file.

The name of the data item determines the name of the section. When you specify this option, the assembler and linker may create larger object and executable files and will also be slower.

-fdata-sections
Use 64-bit double Use long double instead of double type equivalent to float. Mixing this option across modules can have unexpected results if modules share double data either directly through argument passage or indirectly through shared buffer space. -fno-short-double
Fill upper value for data in flash Fill upper flash memory with the value specified. -mfillupper=value
Name the text section Place text (program code) in a section named name rather than the default .text section. -mtext=name
Table 5-5. Memory Model Category
Option Description Command Line
Code model Select a code (program memory/ROM) model.

- default

- large (>32 K words)

- small (<32 K words)

-msmall-code

-mlarge-code

-msmall-code

Data model Select a data (data memory/RAM) model.

- default

- large (device dependent1)

- small (device dependent1)

device dependant2

-mlarge-data

-msmall-scalar

Scalar model Select a scalar model.

- default

- large (device dependent1)

- small (device dependent1)

-msmall-scalar

-mlarge-scalar

-msmall-scalar

Location of constant model Select a memory location for constants.

- default

- Data

- Code

-mconst-in-code

-mconst-in-data

-mconst-in-code

Place all code in auxiliary flash Place all code from the current translation unit into auxiliary Flash. This option is only available on devices that have auxiliary Flash. -mauxflash
Put constants into auxiliary flash When combined with -mconst-in-code, put constants into auxiliary Flash. -mconst-in-auxflash
Allow arrays larger than 32K Allow arrays that are larger than 32K, regardless of memory model. -menable-large-arrays
Aggregate data model Use aggregate data model. -mlarge-aggregate
Note:
  1. For most devices 6K of RAM is the near data space, but for some devices it is 4K of RAM.
  2. For devices that have all of their data memory in the near space, the memory model is "small data" "smallscalar" so that all memory will be allocated in the near space.

    For all other devices the default memory model is "large data" "small scalar". This will have the effect ofallowing the tool chain to place aggregate objects, such as arrays and structure, into the far memory space. This can be over-ridden by explicitly selecting "small data" in the compiler options.

Table 5-6. Optimization Category
Option Description Command Line
Optimization Level Select an optimization level. Equivalent to -On option, where n is an option. See 6.6.6 Options for Controlling Optimization.

Your compiler license may support only some optimizations. See 19 Optimizations

-On
Unroll loops Check to perform the optimization of loop unrolling. This is only done for loops whose number of iterations can be determined at compile time or run time.

Uncheck to not unroll loops.

-funroll-loops
Omit frame pointer Check to not keep the Frame Pointer in a register for functions that don’t need one.

Uncheck to keep the Frame Pointer.

-fomit-frame-pointer
Unlimited procedural abstraction Enable the procedure abstraction optimization. There is no limit on the nesting level. -mpa
Procedural abstraction Enable the procedure abstraction optimization up to level n.
Equivalent to -mpa=n option, where n equals:
  • 0 - Optimization is disabled.
  • 1 - The first level of abstraction is allowed; that is, instruction sequences in the source code may be abstracted into a subroutine.
  • 2 or greater - A second level of abstraction is allowed; that is, instructions that were put into a subroutine in the first level may be abstracted into a subroutine one level deeper. This pattern continues for larger values of n. The net effect is to limit the subroutine call nesting depth to a maximum of n..
-mpa=n
Table 5-7. Preprocessing and Messages Category
Option Description Command Line
Include C dirs Add the directory dir to the head of the list of directories to be searched for header files.

For more information, see 5.6.7 Additional Search Paths and Directories.

-I"dir"
Define C macros Define macro macro with the string 1 as its definition. -Dmacro
ANSI-std C support Check to support all (and only) ANSI C programs.

Uncheck to support ANSI and non-ANSI programs.

-ansi
Use CCI syntax Check if your code is written per the Common C Interface (CCI) syntax (see 24 Common C Interface).

Uncheck if you are not.

-mcci
Use IAR syntax Check if your code is written per the Embedded Compiler Compatibility Mode syntax for IAR (see 23 Embedded Compiler Compatibility Mode).

Uncheck if you are not.

-mext=IAR
Errata This option enables specific errata work-arounds identified by ID.

Valid values for ID change from time to time and may not be required for a particular variant. The ID all will enable all currently supported errata work-arounds. The ID list will display the currently supported errata identifiers along with a brief description of the errata.

-merrata=id
Smart IO forwarding level This option attempts to statically analyze format strings passed to printf, scanf and the ‘f’ and ‘v’ variations of these functions. Uses of nonfloating point format arguments will be converted to use an integer-only variation of the library functions. Equivalent to -msmart-io=n option where n equals:
  • 0 - disables this option.
  • 1 - only convert the literal values it can prove.
  • 2 - causes the compiler to be optimistic and convert function calls with variable or unknown format arguments.
-msmart-io=n
Smart IO format strings Specifies what the format arguments are when the compiler is unable to determine them.
Make warnings into errors Check to halt compilation based on warnings as well as errors.

Uncheck to halt compilation based on errors only.

-Werror
Additional warnings Check to enable all warnings.

Uncheck to disable warnings.

-Wall
Strict ANSI warnings Check to issue all warnings demanded by strict ANSI C.

Uncheck to issue all warnings.

-pedantic
Disable ISR warn Disable warning for inappropriate use of ISR function names. By default the compiler will produce a warning if the interrupt is not attached to a recognized interrupt vector name. This option will disable that feature. -mno-isr-warn
Enable SFR warnings Enable warnings related to SFRs. -msfr-warn=on|off