-
The 32-Bit language tools consist of a compiler
(pic32-gcc.exe), an assembler (pic32-as.exe), a linker
(pic32-ld.exe), and an archiver/ librarian (pic32-ar.exe).
Additional tools distributed with this release include a
binary to Intel[intl] Hex converter (pic32-bin2hex.exe) and
miscellaneous binary utilities (pic32-strip.exe,
pic32-strings.exe, pic32-readelf.exe, etc). In addition, the
compiler utilizes a license manager (pic32-lm.exe) as part of
the time-limited evaluation
edition.
As described in the user's guides, all of the
language tools are sensitive to case on the command line,
including the case of file names. In particular, the C
compiler shell (pic30-gcc) requires that C source files be
named on the command-line with a lower-case .c extension. If
an upper-case .C filename extension is used, the compiler
assumes that the file is a C++ file, which is not supported.
Similarly, the compiler shell passes a file with an
upper-case .S filename extension through the C preprocessor
before passing it to the assembler, but it passes a file with
a lower-case .s extension directly to the assembler.
-
The MPLAB® C Compiler for
PIC32 MCUs tools are written and distributed under the
GNU General Public License (GPL) which means that its source
code is freely distributed and available to the public.
The source for the tools under the GNU GPL may
be downloaded separately from the Microchip WWW web page. You
may read the GNU GPL in the file named COPYING located the
docs subdirectory of your install directory. A general
discussion of principles underlying the GPL may be found at
www.gnu.org/copyleft.
Support code provided for the header files,
linker scripts, and runtime libraries are proprietary code
and not covered under the GPL. See the full
MPLAB® C Compiler for PIC32 MCUs
License Agreement for details.
-
The following PIC32MX devices are
supported:
New items in green. (No new devices for
v1.04)
| Part Number |
Part Number |
| PIC32MX320F032H |
PIC32MX320F064H |
| PIC32MX320F128H |
PIC32MX320F128L |
| PIC32MX340F128H |
PIC32MX340F128L |
| PIC32MX340F256H |
PIC32MX340F512H |
| PIC32MX360F256L |
PIC32MX360F512L |
| PIC32MX420F032H |
PIC32MX440F128H |
| PIC32MX440F128L |
PIC32MX440F256H |
| PIC32MX440F512H |
PIC32MX460F256L |
| PIC32MX460F512L |
PIC32MXGENERIC |
The PIC32MXGENERIC device is, as its name
implies, a non-specific target that can be used to represent
a generic core device.
-
If using MPLAB IDE, be sure to install MPLAB
IDE v8.10 or later before installing these tools.
To install the MPLAB® C
Compiler for PIC32 MCUs tools, perform the following
steps:
- Locate the setup program on the 'MPLAB®
C Compiler for PIC32 MCUs' CD ROM.
- Run the setup program.
- Follow the directions on the screen. To install the
evaluation edition, leave the license-key field blank when
prompted. To install the full edition, enter your full
license key.
- If the installation program indicates that it is
necessary, reboot your computer to complete the
installation.
- When the installation is complete, verify that the
executable directory has been correctly added to your PATH
(i.e., if you chose to install the tools in the default
directory, c:\Program Files\Microchip\MPLAB C32, then
ensure that c:\Program Files\Microchip\MPLAB C32\bin has
been added to your PATH).
From a Windows command prompt (cmd.exe), type:
c:\>PATH
-
The following documents pertain to the
MPLAB® C Compiler for PIC32 MCUs. They may be
installed as part of the full product or downloaded from
Microchip's
website:
- MPLAB® C32 C Compiler User's Guide
(DS51686)
- MPLAB® C32 C Compiler Libraries
(DS51685)
- PIC32 Peripheral Libraries for
MPLAB® C32 Compiler
Documentation on the GNU Assembler and Linker
is available on the GNU Binutils
website.
-
What's New
New Features in v1.04
- General DSP Library -- The DSP Library
supports a variety of signal processing functions that have
applicability in speech compression, echo cancellation,
noise cancellation, channel equalization, audio decoding,
and many other DSP and media applications. The library is
highly optimized for the PIC32 MCU instruction set. See the
MPLAB® C32 C Compiler Libraries
(DS51685) for documentation on the DSP Library
functions. In the near future, a "dsPIC DSC DSP Algorithm
Library" compatibility layer will be available. This
compatibility layer makes the PIC32 DSP Library backwards
compatible with the existing dsPIC DSC DSP Algorithm
Library.
-
Vector attribute accepts parenthesized list of
vector numbers -- The interrupt vector attribute
now accepts a parenthesized list of one or more interrupt
vector numbers. This means that you can now more easily
generate multiple dispatch functions that target a single
interrupt service routine as shown in the example below.
#include <p32xxxx.h>
#include <sys/attribs.h>
void
__ISR((_TIMER_1_VECTOR,_TIMER_2_VECTOR,_TIMER_3_VECTOR),ipl6)
TimerISR(void);
- Interrupt service routines forced to
nomips16 -- The compiler will now force functions
marked with the interrupt attribute to be nomips16. The
compiler will emit a warning if it overrides the mips16
attribute or command-line default. Previous compiler
releases stopped compilation with an error and required
users to manually add the nomips16 attribute. Note that you
should use the __ISR macro from the sys/attribs.h header
rather than manually specify the interrupt attribute.
- Trigonometric function refactorization
-- A few trigonometric functions have been refactored for a
smaller code-size footprint.
New Features in v1.03
- Optimized math library -- The
floating-point math library provided with the compiler has
been significantly optimized to take full advantage of the
PIC32 instruction set. The improved library provides the
greatest benefit for the more complex operations, offering
a greater than 5x performance improvement over the 1.02
library for many operations and an even more significant
improvement for some operations. In addition,
single-precision math library functions are now available,
giving users a choice between double- and single-precision
operations. See math.h for more information.
- Time-Limited Evaluation Edition -- The
new evaluation edition provides full functionality
for 60 days. After the evaluation period has
expired, the compiler becomes feature limited. See this section for further details.
- __C32_VERSION__ predefined
macro -- The C compiler defines the constant
__C32_VERSION__, giving a numeric value to the
version identifier. This macro can be used to construct
applications that take advantage of new compiler features
while still remaining backward compatible with older
versions. The value is based upon the major and minor
version numbers of the current release. For example,
release version 1.03 will have a __C32_VERSION__
definition of 103. This macro can be used, in conjunction
with standard preprocessor comparison statements, to
conditionally include/exclude various code constructs.
-
__ISR_SINGLE__ and
__ISR_SINGLE_AT_VECTOR__ convenience
macros -- The sys/attribs.h header file now
provides two new macros intended to simplify the use of
the single-vector interrupt mechanism. See the
sys/attribs.h header file for more information.
- The __ISR_SINGLE__ macro specifies a
function as an interrupt-service routine in
single-vector mode. This will place a jump at the
single-vector location to the interrupt handler.
- The __ISR_SINGLE_AT_VECTOR__ macro places
the entire single-vector interrupt handler at the
vector 0 location. The user is responsible for ensuring
that the vector spacing is set to accommodate the size
of the handler.
-
Migration
Issues
The following changes may affect migration from
older versions of the compiler.
Migrating to Version v1.04
- Device-support files
- Device specific IRQ macro
definitions -- The IRQ macro definitions, such
as _CORE_TIMER_IRQ, have moved from the
ppic32mx.h header file to the device-specific header
file (e.g. proc/p32mx460f512l.h). This change should
not affect most applications because they should
include the generic p32xxxx.h file.
Migrating to Version v1.03
- Compiler
- The UPLLEN and UPLLDIV configuration bits have been
renamed FUPLLEN and FUPLLDIV, respectively, for the
PIC32MX4xx USB devices. These new names match the names
shown in datasheet DS61143C.
- Peripheral Library
- Modified SYSTEMConfigXXX functions to use revised
flash speed of 30 MHz. If you are currently using a
SYSTEMConfigXXX function, your application will
automatically use the new flash-speed
specification.
- Examples
- Modified all plib_examples to use SYSTEMConfig()
function. This function allows users to selectively
configure certain parameters only.
Migrating to Version v1.02
-
Processor Header files
- Removed Extended Mode (XM bit) in DMA
controller
- Peripheral Library - See the PIC32 Peripheral Libraries for MPLAB C32
Compiler document for details
- DMA Extended mode is removed. The maximum transfer
length is now 256 bytes, even for memory copy and CRC
functions.
- Symbols DMA_OPEN_NORM and DMA_OPEN_EXT used in the
DmaChnOpen() call were removed. A new symbol,
DMA_OPEN_DEFAULT was added.
- A new function, DmaGetMaxTcferSize() was added, to
return the maximum supported size of a transfer,
variant dependent. Right now, only 256 bytes transfer
size supported.
- DmaChnSetExtTxfer() was removed, no longer
relevant.
- DMA_CTL_EXT_EN was removed from the low level
access routines
- SYSTEMConfig() function was added to enable
user-specified configuration for a given system
frequency.
-
Documentation
Updates
Compiler Updates
This section describes pending updates to the
MPLAB C Compiler for PIC32 documentation. These
changes will be incorporated into the next full revision of
the documents.
- __VERSION__ predefined macro
-- The __VERSION__ macro expands to a string
constant describing the compiler in use. Do not rely on its
contents having any particular form, but it should contain
at least the release number. Use the
__C32_VERSION__ macro for a numeric version
number.
- Interrupt-vector macros -- Each
processor-support header file (e.g.
\pic32mx\include\proc\p32mx360f512l.h) provides a macro for
each interrupt-vector number. When used in conjunction with
the __ISR() macro provided by the sys\attribs.h
header file, these macros help make an interrupt service
routine easier to write and maintain. Example: void
__ISR (_TIMER_1_VECTOR, ipl7) Timer1Handler
(void);
Linker Updates
This section describes pending updates to the
MPLAB C Linker for PIC32 documentation. These
changes will be incorporated into the next full revision of
the documents.
-
Relocating the Interrupt Vector Table --
In some cases the user may want to move the Interrupt
Vector Table (IVT) from the default location in the Boot
ROM (kseg1) to the Application Flash (kseg0). For
example, if more space is needed in the Boot ROM. To
relocate the IVT a minimum of two lines must be changes
in the part's procdefs.ld. First, the
location of ebase must be changed to point to
the area in Application Flash. Here are the lines that
specify the default ebase from the
procdefs.ld for the 32MX360F512L
PROVIDE(_vector_spacing = 0x00000001);
_ebase_address = 0x9FC01000;
To place the IVT at the highest possible address set
_ebase_address = (0x9D080000-64*(_vector_spacing <<
5)) & 0xFFFFF000; where 0x9D080000 is the
highest address in the 32MX360F512L part, 64 is the
number of interrupt vectors and (_vector_spacing
<< 5) converts the _vector_spacing value to
the actual number of bytes allocated by the PIC32. The
bit mask at the end, 0xFFFFF000, aligns
_ebase_address on a 4K address boundary, as
required. We can simplify the expression to
_ebase_address = (0x9D080000-(_vector_spacing
<< 11)) & 0xFFFFF000; For the 32MX360F512L
this gives
_ebase_address = 0x9D07F000;
The second line to change in the procdefs.ld
specifies the memory region for the exception vectors. The default
lines from procdefs.ld specifying the exception
memory region are
MEMORY
{
kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000
kseg0_boot_mem : ORIGIN = 0x9FC00490, LENGTH = 0x970
exception_mem : ORIGIN = 0x9FC01000, LENGTH = 0x1000
The value for the ORIGIN of the exception memory must be the
same as ebase, so the line gets changed to
exception_mem : ORIGIN = 0x9D07F000, LENGTH = 0x1000
The linker syntax requires that the value of ORIGIN be a
literal constant, so the appealing ORIGIN = _ebase_address produces
a syntax error. In short, to relocate the IVT from Boot ROM to App
Flash memory, the user must first set _ebase_address to
the properly aligned address, and then set the ORIGIN of the
exception_mem region to the literal value of
_ebase_address.
-
Placing Data at a fixed location --
Users may want to place strings such as version numbers
at a fixed location in memory. The following section
summarises a way to accomplish this goal. First the user
must declare a section to contain the constant data. For
example:
const char __attribute__((section(".hellostring"))) absstring[] =
"Hello, World!\n"; /* Place string in a user-named section. */
Once the section gets set up, the linker script must be
customized in two ways. First create a new memory region to contain
the new section:
MEMORY
{
kseg0_program_mem (rx) : ORIGIN = 0x9D000000, LENGTH = 0x80000-0x1000
/* ... */
/* Create the new region to be used */
myabspmdata (rx) : ORIGIN = 0x9D07F000, LENGTH = 0x1000
kseg0_boot_mem : ORIGIN = 0x9FC00490, LENGTH = 0x970
/* ... */
}
Note that the length of the kseg0_program_mem gets
decreased by the size of the new region. The
linker requires that the regions do not overlap. Secondly, the
SECTIONS must also be modifed to reflect the new
section.
SECTIONS
{
/* Create an output section called .outputmyabspmdata containing
the user-named section from the source code. Map the output
section to the memory region created above.
*/
.outputmyabspmdata : {
KEEP(*(.hellostring))
} > myabspmdata
.config_BFC02FF0 : {
KEEP(*(.config_BFC02FF0))
} > config3
/* ... */
}
These changes to the source and the linker script allows the
user to place data at a fixed location. Multiple pieces of data may
be placed in other sections.
-
The following issues have been resolved in this
release
Fixed in v1.04
- No significant fixed issues for this release
Fixed in v1.03
- BIN32-30:
- Assertion statements in the linker scripts now
correctly compare the size of an exception vector to the
vector spacing.
- C32-179:
- The gmtime() library function now links without error.
In previous releases, the linker would complain about an
undefined reference to 'offtime_r'
- C32-172:
- The config pragma now defaults the DEVCFG0 MSb to
zero.
- C32-171:
- The first call to getchar() now calls _mon_getc(). The
previous implementation treated the initial STDIN character
as an ungetc() pushed-back character.
- C32-164:
- The device-specific header files now use '__asm__'
rather than 'asm' when mapping each SFR struct to it's
symbol name. Previous versions of these files did not
compile when building with the compiler's -ansi
option.
- C32-147:
- The interrupt attribute now properly accepts an
uppercase IPLx value. Earlier compiler versions could
reject the uppercase IPLx with an internal error.
Fixed in v1.02
- C32-119:
- Removed pipeline interlock in ISR handling
- C32-141:
- Large malloc() calls no longer generate a
general exception vector instead of returning a NULL
pointer.
- C32-144:
- Interrupt macro now sets nomips16
- C32-145:
- Include C startup code source is now provided in the
standard distribution
- C32-151:
- IPL7 prologue code now sets incorrect bits in status
register
-
The current limitations are as follows.
Assembler
None reported.
Compiler
- C32-064:
- -Os -mips16 cannot correctly process a routine
with a large number of common subexpressions.
- C32-118:
- No available method to place code at General Exception
Vector 0xBFC00180.
-
Time-Limited Evaluation Edition
Feature Limitations -
Microchip provides a free time-limited evaluation
edition of the MPLAB C Compiler for PIC32 MCUs. The
evaluation edition of the compiler provides full
functionality for 60 days. After the evaluation
period has expired, the compiler becomes feature limited, and
optimization features associated with levels -O2, -O3, and
-Os are disabled. In addition, MIPS16 code generation is
disabled. The compiler continues to accept the -O1 and -O0
optimization levels indefinitely.
Installing the evaluation
edition - To install the time-limited evaluation
edition of the compiler, run the evaluation edition installer
and follow the on-screen instructions. If the installer asks
for a license key, leave the field blank and continue.
Upgrading to a full edition
license - For applications requiring additional code
efficiency, as well as full support via http://support.microchip.com,
users are encouraged to upgrade to a full-edition compiler
license. For further information on upgrading to a
full-edition license (Part Number: SW006015), visit
http://www.microchipdirect.com or contact your preferred
Microchip distributor.
Once you've obtained a full-edition license
key, run the Upgrader tool (pic32-upgrader\upgrader.exe) as a
Windows administrator. After you enter your license key and
press the Upgrade button, the license manager should then
report the license upgrade status.
-
Microchip provides online support via our home
page at:
http://www.microchip.com
Technical support is available through the web
site at:
http://support.microchip.com
A forum for discussion of Microchip products
and tools is available at:
http://forum.microchip.com
Microchip PIC32 documentation and product info
is available at:
http://www.microchip.com/pic32