4.4.3 xc32-gcc (32-bit C Compiler)
Although the MPLAB XC32 C/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 (www.microchip.com) 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 MPLAB X IDE User’s Guide (DS50002027), also available on the Microchip website.
See also 4.4.8 Options Page Features.
Option | Description | Command Line |
---|---|---|
Enable unaligned access | Enables (or disables) reading and writing of 16- and 32-bit values from addresses that are not 16- or 32-bit aligned. By default, unaligned access is disabled for all pre-ARMv6 and all ARMv6-M architectures and enabled for all other architectures. If unaligned access is not enabled then words in packed data structures are accessed one byte at a time. | -m[no-]unaligned-access |
Have symbols in production build | Adds debugging information to the generated ELF file. | -g |
Isolate each function in a section | This option is often used with the linker's --gc-sections option to remove unreferenced functions (see the MPLAB® XC32 Assembler, Linker and Utilities User's Guide).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 be slower executing. Uncheck to place multiple functions in a section. | -ffunction-sections |
Place data into its own section | This option is often used with the linker's --gc-section s option to remove unreferenced statically-allocated variables (see the MPLAB® XC32 Assembler, Linker and Utilities User's Guide).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 |
Enable toplevel reordering | Allow reordering of top-level functions, variables, and asm statements, such that they might not be output in the same order in which they appear in source files. When this feature is disabled, using the -fno-toplevel-reorder option, unreferenced static variables will not be removed. Use this options with optimization level 1 or greater. | -f[no-]toplevel-reorder |
Use indirect calls | Enable full-range calls, which are typically required when calling a function in another memory region. | -mlong-calls |
Note that some of the compiler options specified by fields in Project Property Categories other than Optimization can affect the size and execution speed of your project. Consider using the Compiler Advisor, accessible via the MPLAB X IDE
menu item, to compare the size of your project when built with different combination of compiler options.Option | Description | Command Line |
---|---|---|
Optimization Level | Select an optimization level. Your compiler edition may support only some optimizations. Equivalent to -On option, where n is an option below:
| -O0 -O1 -O2 -O3 -Os |
Unroll loops | This option often increases execution speed at the expense of larger code size. 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 |
Pre-optimization instruction scheduling | Attempts to reorder instructions to eliminate instruction stalls. Select "Default for
optimization level" for this feature to be controlled purely by the
| -f[no-]schedule-insns |
Post-optimization instruction scheduling | Attempts to reorder instructions to eliminate instruction
stalls. Select "Default for optimization level" for this feature to be
controlled purely by the -O level selection. | -f[no-]schedule-insns2 |
Use Common Tentative Definition | Controls the placement of global variables defined without an initializer, known as tentative definitions in the C standard. Tentative definitions are distinct from declarations of a variable with the extern keyword, which do not allocate storage.When the feature is enabled, using the Disabling the feature, using the | -f[no-]common . |
Option | Description | Command Line |
---|---|---|
Preprocessor macros | Project-specific preprocessor macro defines passed via the compiler's –D option. | -Dmacro[=defn] |
Include directories | Search these directories for project-specific include files. | -Ipath |
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 |
Enable address warning attribute | Emit a warning for all uses of the
address attribute. This option is for
engineering-support use only. |
-Waddress-attribute-use |
support-ansi | Check to issue all warnings demanded by strict ANSI C. Uncheck to issue all warnings. | |
strict-ansi | Issue all the warnings demanded by strict ISO C and ISO C++; reject all programs that use forbidden extensions and some other programs that do not follow ISO C and ISO C++. | -pedantic |