MPLAB® XC16 C Compiler User Guide

2021-11-16
●Device Description
■The MPLAB XC16 C compiler fully supports all Microchip 16-bit devices:
▲The dsPIC® family of digital signal controllers combines the high performance required in digital signal processor (DSP) applications with standard microcontroller (MCU) features needed for embedded applications.
▲The PIC24 family of MCUs are identical to the dsPIC DSCs with the exception that they do not have the digital signal controller module or that subset of instructions. They are a subset, and are high-performance MCUs intended for applications that do not require the power of the DSC capabilities.
●Compiler Description and Documentation
■The MPLAB XC16 C compiler is a full-featured, optimizing compiler that translates standard ANSI C programs into16-bit device assembly language source. The compiler also supports many command-line options and language extensions that allow full access to the 16-bit device hardware capabilities and affords fine control of the compiler code generator.
■The compiler is a port of the GNU Compiler Collection (GCC) compiler from the Free Software Foundation.
■The compiler is available for several popular operating systems, including 32 and 64-bit Windows® OS, Linux® OS and Mac® OS X®.
■The compiler can be licensed as Free or PRO. The Free license has the minimum optimizations whereas the PRO license has the maximum (for details see 20. Optimizations).The basic compiler operation, supported devices and available memory are identical across all modes.
■This key features of the compiler are discussed in the following sections.
▲ANSI C Standard
◆The compiler is a fully validated compiler that conforms to the ANSI C standard as defined by the ANSI specification(ANSI x3.159-1989) and described in Kernighan and Ritchie’s The C Programming Language (second edition). The ANSI standard includes extensions to the original C definition that are now standard features of the language.These extensions enhance portability and offer increased capability. In addition, language extensions for dsPIC DSC embedded-control applications are included.
▲Optimization
◆The compiler uses a set of sophisticated optimization passes that employ many advanced techniques for generating efficient, compact code from C source. The optimization passes include high-level optimizations that are applicable to any C code, as well as 16-bit device-specific optimizations that take advantage of the particular features of the device architecture.For more on optimizations, see section 20. Optimizations
▲ANSI Standard Library Support
◆The compiler is distributed with a complete ANSI C standard library. All library functions have been validated, and conform to the ANSI C library standard. The library includes functions for string manipulation, dynamic memory allocation, data conversion, timekeeping and math functions (trigonometric, exponential and hyperbolic).The standard I/O functions for file handling are also included, and as distributed, they support full access to the host file system using the command-line simulator. The fully functional source code for the low-level file I/O functions is provided in the compiler distribution and may be used as a starting point for applications that require this capability.
▲Flexible Memory Models
◆The compiler supports both large and small code and data models. The small code model takes advantage of more efficient forms of call and branch instructions, while the small data model supports the use of compact instructions for accessing data in SFR space.
◆The compiler supports two models for accessing constant data. The “constants in data” model uses data memory,which is initialized by the run-time library. The “constants in code” model uses program memory, which is accessed through the Program Space Visibility (PSV) window.
▲Attributes and Qualifiers
◆The compiler keyword __attribute__ allows you to specify special attributes of variables, structure fields or
functions. This keyword is followed by an attribute specification inside double parentheses, as in:
int last_mode __attribute__ ((persistent));
◆In other compilers, qualifiers are used to create qualified types:
persistent int last_mode;
◆The MPLAB XC16 C Compiler does have some non-standard qualifiers described in 10.9 Compiler-Specific Type
Qualifiers
◆Generally speaking, qualifiers indicate how an object should be accessed, whereas attributes indicate where objects are to be located. Attributes also have many other purposes.
▲Compiler Driver
◆The compiler includes a powerful command-line driver program. Using the driver program, application programs can be compiled, assembled and linked in a single step.
▲Documentation
◆The compiler is supported under both the MPLAB® X IDE and MPLAB IDE v8.xx and above. In this document, only the MPLAB X IDE is discussed.
◆Features that are unique to specific devices and therefore specific compilers, are noted with a “DD” icon next to the section and text that identifies the specific devices to which the information applies (see the 1. Preface) .

MICROCHIP

MPLAB® XC16 C

More

Part#

Compiler

More

More

User's Guide

More

More

Please see the document for details

More

More

English Chinese Chinese and English Japanese

February 2021

Revision M

DS-50002071L

2.6 MB

  • +1 Like
  • Add to Favorites

Recommend

All reproduced articles on this site are for the purpose of conveying more information and clearly indicate the source. If media or individuals who do not want to be reproduced can contact us, which will be deleted.

Contact Us

Email: