Release Notes for MPLAB® C Compiler for PIC32 MCUs

v1.11(A)
May 2010

Table of Contents

  1. Overview
  2. GNU General Public License
  3. Devices Supported
  4. Installation
  5. Compiler Documentation
  6. What's New
  7. Migration Issues
  8. Documentation Updates
  9. Fixed Issues
  10. Limitations and Known Issues
  11. Feature-Limited Editions and License Upgrades
  12. Customer Support


  1. Overview

    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 MPLAB C Compiler for PIC32 MCUs Standard 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 (pic32-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.

  2. GNU General Public License

    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.

  3. Devices Supported

    The following PIC32MX devices are supported:

    Part Number Part Number
    PIC32MX320F032H
    PIC32MX320F064H
    PIC32MX320F128H
    .
    .
    PIC32MX320F128L
    PIC32MX340F128H
    PIC32MX340F256H
    PIC32MX340F512H
    PIC32MX340F128L
    .
    .
    .
    .
    PIC32MX360F256L
    PIC32MX360F512L
    PIC32MX420F032H .
    PIC32MX440F128H
    PIC32MX440F256H
    PIC32MX440F512H
    PIC32MX440F128L
    .
    .
    .
    .
    PIC32MX460F256L
    PIC32MX460F512L
    PIC32MX534F064H PIC32MX534F064L
    PIC32MX564F064H
    PIC32MX564F128H
    PIC32MX564F064L
    PIC32MX564F128L
    PIC32MX575F256H
    PIC32MX575F512H
    PIC32MX575F256L
    PIC32MX575F512L
    PIC32MX664F064H
    PIC32MX664F128H
    PIC32MX664F064L
    PIC32MX664F128L
    PIC32MX675F256H
    PIC32MX675F512H
    PIC32MX675F256L
    PIC32MX675F512L
    PIC32MX695F512H PIC32MX695F512L
    PIC32MX764F128H PIC32MX764F128L
    PIC32MX775F256H
    PIC32MX775F512H
    PIC32MX775F256L
    PIC32MX775F512L
    PIC32MX795F512H PIC32MX795F512L

    The PIC32MXGENERIC device is, as its name implies, a non-specific target that can be used to represent a generic core device.

  4. Installation

    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:

    1. Locate the setup program on the 'MPLAB C Compiler for PIC32 MCUs' CD ROM.
    2. Run the setup program.
    3. Follow the directions on the screen. To install the standard evaluation edition, leave the license-key field blank when prompted. To install the full standard edition, enter your full license key.
    4. If the installation program indicates that it is necessary, reboot your computer to complete the installation.
    5. 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. On some systems, the default path is c:\Program Files\Microchip\MPLAB C32 Suite.).

      From a Windows command prompt (cmd.exe), type: c:\>PATH

    To upgrade to a full standard-edition license from a lite or standard -evaluation edition license, follow the steps described in this section.

  5. Compiler Documentation

    The following documents pertain to the MPLAB C Compiler for PIC32 MCUs. They may be installed in the compiler's doc subdirectory, but you should check Microchip's website for the latest revisions.

    Additional documentation on the GNU Assembler and Linker is available on the GNU Binutils v2.19 website.

  6. What's New

    New Features in v1.11

    • Builtin functions for CP0 register access -- This release introduces a few new compiler builtin functions that simplify access to the PIC32 coprocessor 0 (CP0) registers. Combine these new builtin functions with macros defined in the cp0defs.h and p32xxxx.h header files for easy access to the various CP0 registers.

      In earlier compiler releases, the p32xxxx.h header file defined _mfc0/_mtc0 preprocessor macros that utilized extended inline assembly to generate the mfco and mtc0 instructions. These _mfc0 and _mtc0 macros are updated to utilize the new builtin funtions instead of inline assembly.

      NOTE: To access these CP0 registers, the compiler must generate assembly instructions (mfc0 & mtc0) that are supported in only the mips32 ISA mode. Therefore, when calling one of these functions from a mips16 function, the compiler must generate extra code to switch from mips16 mode back to the base mips32 mode before executing the instruction and then back to mips16 mode after executing the instruction.

      Read More...

    • Upgrade to binutils v2.19 -- The MPLAB Assembler, Linker, and Utilities for PIC32 MCUs are now based on GNU Binutils v2.19. This platform upgrade includes a few new features and bug fixes.

      • Assembler
        • Macros with a variable number of arguments are now supported. See the Binutils documentation for more information.
        • A redefinition of a macro now results in an error.
        • The assembler sources are now released under version 3 of the GNU General Public License.
      • Linker
        • Added a new linker command-line switch, --sort-section name|alignment, to sort sections by section name or maximum alignment.
        • Added SORT_BY_NAME and SORT_BY_ALIGNMENT to the linker script language to permit sorting sections by section name or section maximum alignment.
        • New switch: --print-gc-sections to list any sections removed by garabge collection.
        • Addded a new command-line option '--default-script=FILE' or '-dT FILE' which specifies a replacement for the built-in, default linker script.
        • Linker scripts support a new INSERT command that makes it easier to augment the default script.
        • Linker-script input-section filespecs may now specify a file within an archive by writing "archive:file".
        • The --sort-common switch now has an optional argument which specifies the direction of sorting.
        • The Linker sources are now released under version 3 of the GNU General Public License.
      • Binary Utilities
        • pic32-readelf can now display address ranges from .debug_range sections. This happens automatically when a DW_AT_range attribute is encountered. The command line switch --debug-dump=Ranges (or -wR) can also be used to display the contents of the .debug_range section.
        • pic32-objcopy recognizes two new options, --strip-unneeded-symbol and --strip-unneeded-symbols, namely for use together with the wildcard matching the original --strip-symbol/--strip-symbols provided, but retaining any symbols matching but needed by relocations.
        • Added -g/--section-groups to pic32-readelf to display section groups.
        • Added --globalize-symbol <name> and --globalize-symbols <filename> switches to pic32-objcopy to convert local symbols into global symbols.
        • Added -t/--section-details to pic32-readelf to display section details
        • Added -W/--dwarf to pic32-objdump to display the contents of the DWARF debug sections.
        • Added -wL switch to dump decoded contents of .debug_line.
        • Added -F switch to pic32-objdump to include file offsets in the disassembly.
        • Added -c switch to pic32-readelf to allow string dumps of archive symbol index.
        • Added -p switch to pic32-readelf to allow string dumps of sections.
        • The Binutils sources are now released under version 3 of the GNU General Public License.
    • RIPL Interrupt Priority Level specifier -- The v1.10 release introduced new Interrupt Priority Level specifiers. It also introduced a new default IPL behavior when the IPL specifier was omitted from the interrupt attribute. (See New Features in v1.10 below for more information.)

      The v1.11 release introduces an explicit specifier (RIPL) for this default behavior. You may use this RIPL specifier in either the interrupt pragma or the interrupt attribute to tell the compiler to use the runtime Requested Interrupt Priority Level from the CAUSE register as the new IPL.

      • Example 1:

        #pragma interrupt Timer1IntHandler RIPL vector 4

      • Example 2:

        void __attribute__((interrupt(RIPL), vector(1))) myISR (void)) { /* code */ }

    New Features in v1.10

    New Features in v1.05

  7. New Features in v1.04

    New Features in v1.03

  8. Migration Issues

    The following changes may affect migration from older versions of the compiler.

    Migrating to Version v1.11

    • Linker
      • Allocation of orphan sections -- Orphan sections are sections present in the input files which are not explicitly placed into the output file by the linker script. The linker will still copy these sections into the output file, but it has to guess as to where they should be placed. The linker uses a simple heuristic to do this. It attempts to place orphan sections after non-orphan sections of the same attribute, such as code vs data, loadable vs non-loadable, etc. If there is not enough room to do this then it places at the end of the file.

        If an orphaned section's name is representable as a C identifier then the linker will automatically PROVIDE two symbols: __start_SECNAME and __end_SECNAME, where SECNAME is the name of the section. These indicate the start address and end address of the orphaned section respectively. Note: most section names are not representable as C identifiers because they contain a `.' character.

        Note: In previous releases, the linker allocated orphan sections at a high address, after all other sections had been allocated. This is no longer the case and applications should not rely on orphan sections being uninitialized.

    • Default Linker Script
      • New .persist section -- The default linker script now provides a .persist section between the .stack section and the .ramfunc section. This section is not initialized or zeroed on startup. If your project used a custom section for this purpose, you can now utilize this new .persist section that is specifically mapped outside of the .bss and .data sections.

        Example:
        unsigned int __attribute__((section(".persist"))) flag;

    Migrating to Version v1.10

    Migrating to Version v1.05

    Migrating to Version v1.04

    Migrating to Version v1.03

    Migrating to Version v1.02

  9. Documentation Updates

    Library documentation updates

    This section describes pending updates to the MPLAB® 32-Bit Language Tools Libraries documentation. These changes will be incorporated into the next full revision of the documents.

    Compiler documentation 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.

  10. Fixed Issues

    The following issues have been resolved in this release

    Fixed in v1.11(A)

    BIN32-62:
    The default linker script now discards the unnecessary ".rel.dyn" output section. Previously, this section could cause the linker and pic32-bin2hex utility to generate an invalid hex file. When importing this invalid hex file, MPLAB IDE v8.xx would display an error indicating "The parameter is incorrect."

    Fixed in v1.11

    C32-318:
    IPLnSOFT interrupts nested in IPLnSRS interrupts now preserve the stack pointer across register sets. Previously, nested interrupts with shadow register set 1 assigned to a lower priority ISR (e.g. IPL1SRS) could cause stack pointer corruption. The most common symptom of stack corruption is a general exception after returning from the ISR. Thanks to A. Chen for reporting this issue via http://support.microchip.com
    C32-314:
    The default general-exception context-saving code now allocates sufficient stack space for the number of general registers that it saves. The previous default code did not allocate sufficient space and resulted in stack corruption following a general exception. This made recovering from a general exception impossible when using the default context-saving code.
    C32-312:
    The compiler no longer generates an extraneous instruction a function epilogue for non-interrupt function where no additional stack space needs to be deallocated. The v1.10 release incorrectly generated a useless addiu sp,sp,0 instruction. Thanks to Slawek Piotrowski for reporting this issue on the Microchip web forum.
    C32-300:
    The compiler now maintains an 8-byte alignment for the stack pointer for all functions including interrupt service routines. In prior compiler releases, when a function taking a variable number of arguments was called from an interrupt service routine and an 8-byte variable was passed as an argument, the generated code could cause a general exception. Thanks to Leon van Snippenberg of AVIX for reporting this issue.
    C32-298:
    A constant infinite loop within an IPLxAUTO interrupt service routine no longer causes an internal compiler error.
    C32-297:
    The CP0 access macros in cp0defs.h no longer cause an exception when used in a mips16 function. These access macros now use the new CP0 builtin functions described in the New Features in v1.11 section above.
    C32-292:
    The compiler now properly ignores the -mips16 and higher-level optimization options when they are passed together to a compiler operating with a limited-functionality license such as a lite-mode license or an expired standard evaluation license. Previous releases emitted a correct warning followed by an incorrect error.
    BIN32-44:
    The pic32-size utility now reports the size of COMMON section correctly as part of the bss section usage.

    Fixed in v1.10

    Fixed in v1.05

    Fixed in v1.04

    Fixed in v1.03

    Fixed in v1.02

  11. Limitations and Known Issues

    The current limitations are as follows.

    Compiler

    No significant issues reported.

    Assembler

    No significant issues reported.

    Linker

    BIN32-58
    The linker may emit an unfriendly error message when it encounters a case where it cannot switch ISA modes between mips16 and mips32 in a function call. The error message is "jump to stub routine which is not jal". This condition can occur when a mips32 function's final statement is a call to a mips16 function and compiler optimizations are enabled.

    Example:
    extern void bar (void);
    void foo (void);
    void foo (void)
    {
        bar();
    }

    The file containing bar() was compiled with -mips16 and the file containing foo() was compiled with -O2 but not -mips16. This means that the call to bar() must change ISA modes. Also, the call to bar() is the last statement in the foo() function.

    Possible workarounds include

    1. Use the mips16/nomips16 function attribute to make the caller function and the callee function the same ISA mode. Usually, this means applying the __attribute__((mips16)) or __attribute__((nomips16)) to the caller function to make it match the callee. This eliminates the need for a mode switch when calling the function.

      The example above becomes:
      extern void bar (void);
      void __attribute__((mips16)) foo (void);
      void __attribute__((mips16)) foo (void)
      {
          bar();
      }

    2. If your particular instance of this problem is caused by the tail sibling-call optimization, use the -fno-optimize-sibling-calls option when compiling the caller function. In MPLAB IDE v8.xx, you can add this option to your project's alternate settings. This will prevent the compiler converting your 'jal' call into a 'j' branch, which cannot change ISA modes.
    A future release of the linker will emit a more friendly and useful error message.

    Libraries and Device-Support Files

    C32-319
    GenericTypeDefs.h defines common data types (such as BYTE, BOOL, UINT16, etc.) that may conflict with definitions in non-Microchip code when using Microchip libraries. When conflicts occur, it will cause compilation errors in the Microchip-provided libraries or in the non-Microchip libraries (depending on which library first defines the data type).

    Possible workaround:
    Remove conflicting definitions from non-Microchip code.

    Documentation

    MPLAB C Compiler for PIC32 MCUs User's Guide (DS1686B)

    Section 5.6 Function Calling Convention - This section states that "The Stack Pointer is always aligned on a 4-byte boundary." This statement is incorrect. The Stack Pointer is always aligned on an 8-byte boundary.
  12. Feature-Limited Editions and License Upgrades

    Time-Limited Standard Evaluation Edition

    Feature Limitations - Microchip provides a free time-limited Standard Evaluation edition of the MPLAB C Compiler for PIC32 MCUs. The standard 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 standard evaluation edition - To install the time-limited standard evaluation edition of the compiler, run the standard 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 standard-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 standard-edition compiler license. For further information on upgrading to a full standard-edition license (Part Number: SW006015), visit http://www.microchipdirect.com or contact your preferred Microchip distributor.

    Once you've obtained a standard-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.

    Lite Edition

    Feature Limitations - Microchip provides a free Lite edition of the MPLAB C Compiler for PIC32 MCUs intended for use in projects where code efficiency is not critical. This edition of the compiler does not support optimization features associated with levels -O2, -O3, and -Os. In addition, this edition does not support MIPS16 code generation.

    Upgrading to the standard edition or standard evaluation edition - To take advantage of the advanced optimization and MIPS16 code generation features, you can upgrade to a standard edition or a 60-day standard evaluation edition. To upgrade to a full or 60-day standard evaluation edition, uninstall the lite edition using the normal Windows Add/Remove Programs feature. Next, install the standard edition or the standard evaluation edition by running the appropriate installer and following the on-screen instructions.

  13. Customer Support

    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

    MPLAB® C Compiler for PIC32 MCUs updates and information are available at:
    http://www.microchip.com/c32