Jump to main content
MPLAB® XC32 C/C++ Compiler User's Guide for PIC32M MCUs
Search
Notice to Development Tools Customers
1
Preface
1.1
Conventions Used in This Guide
1.2
Recommended Reading
2
Compiler Overview
2.1
Device Description
2.2
Compiler Description and Documentation
2.3
Compiler and Other Development Tools
3
How To's
3.1
Installing and Activating the Compiler
3.2
Invoking the Compiler
3.3
Writing Source Code
3.4
Getting My Application To Do What I Want
3.5
Understanding the Compilation Process
3.6
Fixing Code That Does Not Work
4
XC32 Toolchain and MPLAB X IDE
4.1
MPLAB X IDE and Tools Installation
4.2
MPLAB X IDE Setup
4.3
MPLAB X IDE Projects
4.4
Project Setup
4.5
Project Example
5
Command-line Driver
5.1
Invoking The Compiler
5.2
The C Compilation Sequence
5.3
The C++ Compilation Sequences
5.4
Runtime Files
5.5
Compiler Output
5.6
Compiler Messages
5.7
Driver Option Descriptions
6
ANSI C Standard Issues
6.1
Divergence Fom the ANSI C Standard
6.2
Extensions to the ANSI C Standard
6.3
Implementation-Defined Behavior
7
Device-Related Features
7.1
Device Support
7.2
Device Header Files
7.3
Configuration Bit Access
7.4
ID Locations
7.5
Using SFRs From C Code
8
Code Coverage
9
Supported Data Types and Variables
9.1
Identifiers
9.2
Data Representation
9.3
Integer Data Types
9.4
Floating-Point Data Types
9.5
Structures and Unions
9.6
Pointer Types
9.7
Complex Data Types
9.8
Constant Types and Formats
9.9
Standard Type Qualifiers
9.10
Compiler-Specific Qualifiers
9.11
Variable Attributes
10
Memory Allocation and Access
10.1
Address Spaces
10.2
Variables in Data Memory
10.3
Auto Variable Allocation and Access
10.4
Variables in Program Memory
10.5
Variable in Registers
10.6
Application-Defined Memory Regions
10.7
Dynamic Memory Allocation
10.8
Memory Models
11
Floating-point Support
12
Fixed-Point Arithmetic Support
12.1
Enabling Fixed-Point Arithmetic Support
12.2
Data Types
12.3
Fixed-point Library Functions
12.4
Integer Representations
12.5
SIMD Variables
12.6
Accessing Elements in SIMD Variables
12.7
Array Alignment and Data Layout
12.8
Operations on Fixed-Point Variables
12.9
Operations on SIMD Variables
12.10
DSP Built-In Functions
12.11
DSP Control Register
12.12
Using Accumulators
12.13
Mixed-Mode Operations
12.14
Auto-Vectorization to SIMD
12.15
FIR Filter Example Project
12.16
Unsupported Features
13
Operators and Statements
13.1
Integral Promotion
13.2
Type References
13.3
Labels as Values
13.4
Conditional Operator Operands
13.5
Case Ranges
14
Register Usage
14.1
Register Usage
14.2
Register Conventions
15
Stack
15.1
Software Stack
15.2
Call Frame
15.3
Stack Guidance
16
Functions
16.1
Writing Functions
16.2
Function Attributes and Specifiers
16.3
Allocation of Function Code
16.4
Changing the Default Function Allocation
16.5
Function Size Limits
16.6
Function Parameters
16.7
Function Return Values
16.8
Calling Functions
16.9
Inline Functions
17
Interrupts
17.1
Interrupt Operation
17.2
Writing an Interrupt Service Routine
17.3
Associating a Handler Function with an Exception Vector
17.4
Exception Handlers
17.5
Context Switching
17.6
Latency
17.7
Nesting Interrupts
17.8
Enabling/Disabling Interrupts
17.9
ISR Considerations
18
Main, Runtime Start-up and Reset
18.1
The Main Function
18.2
Runtime Start-Up Code
19
Library Routines
19.1
Smart IO Routines
19.2
Using Library Routines
20
Mixing C/C++ and Assembly Language
20.1
Mixing Assembly Language and C Variables and Functions
20.2
Using Inline Assembly Language
20.3
Predefined Macros
21
Optimizations
21.1
Optimization Feature Summary
22
Preprocessing
22.1
C/C++ Language Comments
22.2
Preprocessor Directives
22.3
Pragma Directives
22.4
Predefined Macros
23
Linking Programs
23.1
Replacing Library Symbols
23.2
Linker-Defined Symbols
23.3
Default Linker Script
24
Embedded Compiler Compatibility Mode
24.1
Compiling in Compatibility Mode
24.2
Syntax Compatibility
24.3
Data Type
24.4
Operator
24.5
Extended Keywords
24.6
Intrinsic Functions
24.7
Pragmas
25
Common C Interface
25.1
Background - The Desire for Portable Code
25.2
Using the CCI
25.3
C Language Standard Refinement
25.4
C Language Standard Extensions
25.5
Compiler Features
26
C Implementation-Defined Behavior
26.1
Overview
26.2
Translation
26.3
Environment
26.4
Identifiers
26.5
Characters
26.6
Integers
26.7
Floating-Point
26.8
Arrays and Pointers
26.9
Hints
26.10
Structures, Unions, Enumerations, and Bit Fields
26.11
Qualifiers
26.12
Declarators
26.13
Statements
26.14
Pre-Processing Directives
26.15
Library Functions
26.16
Architecture
27
C++ Implementation-Defined Behavior
28
Deprecated Features
28.1
Variables in Specified Registers
28.2
Defining Global Register Variables
28.3
Specifying Registers for Local Variables
29
Built-In Functions
29.1
Built-In Function Descriptions
30
Built-In DSP Functions
31
PIC32 DSP Library
31.1
Overview
31.2
Fixed-Point Types
31.3
Saturation, Scaling, and Overflow
31.4
Array Alignment and Length Restrictions
31.5
Vector Math Functions
31.6
Filtering Functions
31.7
Frequency Domain Transform Functions
31.8
Video Processing Functions
32
PIC32 Debug-Support Library
32.1
Overview
32.2
Configuring Debug Input/Output for the Target And Tool
32.3
PIC32 Debugging Support Header
33
DSP Wrapper Functions
33.1
Overview
33.2
PIC32 DSP Wrapper Functions List
33.3
Differences Between Wrapper Functions and dsPIC® DSP Library
34
ASCII Character Set
35
Document Revision History
The Microchip Website
Product Change Notification Service
Customer Support
Product Identification System
Microchip Devices Code Protection Feature
Legal Notice
Trademarks
Quality Management System
Worldwide Sales and Service