Download Xc16 Compiler

0 views
Skip to first unread message

Marilou Schuemann

unread,
Jul 22, 2024, 7:17:31 AM7/22/24
to vertfuzare

When I compile my project and look at the assembly, it seems that the compiler was, in fact, able to completely remove the function in assembly and only leave the inline code where it was called in the ISR.

download xc16 compiler


Download Zip ===> https://tlniurl.com/2zCN2K



Honestly, I'm OK with all three points for hobby projects, though I try to use 8- or 32-bitters, where open source compilers are available. Less known fact is that source codes of XC16 are available and free to download, probably mostly to satisfy GNU license requirements. Better than -O1 compiler options are fine for squeezing last bits of optimization efforts, though - that's why the paid version exists. Though the sources are available, in professional circles not everybody will spent their expensive time building the compiler (that is far from being trivial exercise) with nobody to ask questions, so they buy directly the full version plus support from Microchip...

...or something. In fact, I'm able to use optimizations higher than -O1 on free version. Compiler complains I have no valid license, but the code builds and runs just fine, with apparent results of compiler optimization efforts. That's what i did on LLG, where I built the code with -O3 and code execution is indeed faster than with -O1. That is where story could end, but I went further.

I downloaded soruces for XC16 1.33 from here. The archive contains almost 10.000 files in 5200 directories, so I unziped it on temporary location. In directory \v1.33.src\src\XC_GCC\gcc\gcc\config are all targets, including the ones for XC16 /PIC30/ - because originally the compiler was meant for dsPIC30 DSPs, PIC24 and dsPIC33 being derivatives of dsPIC30) - as well as PIC32 /PIC32/.

It's apparent that with options the compiler tries a bit harder. At Os (where code size is main factor) it gets 20B lower, at O3 (where speed is at premium, code size is secondary) it indeed runs a bit faster.

So, what is described here is option to get full optimization level of XC16 compiler without need to recompile the sources, what is far from being simple task. On the other hand, the gains from full options are not particularly huge, but it doesn't hurt anyway.

I don't think there is anything illegal involved here. The binaries of compiler nor license checker aren't modified in any way, I'm just using command line option that is free version of XC16 distributed with.

All in all, even with 16-bitters from Microchip, one isn't completely lost in corporate greed. Though they are trying to earn as much money as they can, it's still possible to get "canned solution" that you just use with no further fiddling as well as compiler with sources available - to learn and improve.

The 16-bit language tools consist of a compiler (xc16-gcc.exe), an assembler (xc16-as.exe), a linker (xc16-ld.exe), and an archiver/ librarian (xc16-ar.exe). Additional tools distributed with this release include a binary to Intel Hex converter (xc16-bin2hex.exe) and a command-line simulator (sim30.exe).

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 (xc16-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.

If this release of the Microchip MPLAB XC16 C compiler is a functional safety compiler, this compiler requires a functional safety license in order to operate. Once activated, all optimization levels and compiler features are available.

The MPLAB XC C compiler and the licensing software they utilize are available for a variety of operating systems, including 64-bit versions of the following: Professional editions of Microsoft Windows 10; Ubuntu 18.04; and MacOS 10.15.1 Catalina.

If you are running a network license server, only computers with operating systems supported by the compilers may be used to host the license server. As of xclm version 2.0, the network license server can be installed on a Microsoft Windows Server platform, but the license server does not need to run on a server version of the operating system.

Microchip Unified Standard C Library -- All Microchip MPLAB XC Compilers now share a Microchip Unified Standard C Library. This change makes the library implementation uniform across all architectures supported by the MPLAB XC compilers. The library is a Microchip customized version of the MUSL LibC.
Information on the standard functions in this library can be found in the Microchip Unified Standard Library Reference Guide.

This release contains a new header file, builtins.h. This file contains prototypes for all Microchip defined builtins and is included automatically when xc.h is included. Note that this header file travels with the compiler and will not be updated with DFPs.

Not all prototypes are strictly standard conforming as not all builtin prototypes can be. To omit the the nonconforming prototypes for MISRA compatibility, define __XC_STRICT_MISRA on the compiler command line.

Added new functionality in compiler that helps user program inactive slave section of PRAM on dual core devices that have this feature. Users can use the function _program_inactive_slave(slave_number, verify, image); to program the inactive slave panel with the image. The function performs similar to _program_slave() but works only on the inactive panel.

Added a ported version of objcopy to the release. XC16 version is called xc16-objcopy. This version of objcopy only recognizes XC16 object code. Any other type of object code is not recognized by this objcopy.

This release introduces MPLAB Code Coverage support introduced in this version. Passing the option -mcodecov=near or -mcodecov=far option to the compiler causes it to instrument the generated assembly-instruction blocks with information that the MPLAB X IDE can then use to perform a code-coverage analysis. Visit for more information on this feature. This feature requires MPLAB X IDE v5.25 or later.

Flash routines provided with the compiler will display a message informing users that the routines are deprecated. Using any device other than from the DSPIC30F and PIC24H family should migrate to Microchip Code Configurator flash module for flash support. Please visit

A new attribute priority has been introduced in to the compiler. This attribute will notify the linker to execute marked functions after all initializations, at that priority level, have occurred. For further information please refer the User's Guide.

This release contains fixes for some major reported issues and part-support file updates. Additionally the compiler version that a part support is released with is now commented in the support files. This will facilitate future part-support only releases.

For devices with DSP instructions, the compiler can generate DSP instruction under higher levels of optimization (-O2,-Os and -O3). For example this very simple implementation of a dot product will generate DSP instructions:

This release contains a new 'relaxed compliance' fast floatingpoint math library. It may be accessed by specifying -relaxed-math as an option to the compiler and linker.

  • As with the current default and fast math libraries, this library correctly rounds all values created according to the IEEE nearest or even mode.

The XC License Manager (xclm) now supports roaming of floating network licenses. Aimed at mobile users, this feature allows a floating license to go off network for a short period of time. Using this feature, you can disconnect from the network and still use your MPLAB XC compiler. See the doc folder of the XCLM install for more on this feature.
MPLAB X IDE v1.40 includes a Licenses window (Tools>Licenses) to visually manage roaming.

XC16 v2.00 has a new library to support C99 standard. Older legacy and no-legacy libraries are no longer supported and bundled with this compiler. Math libraries which could be specified with -fast-math and -relaxed-math are not supported. The options -legacy-libc, -no-legacy-libc, -fast-math and -relaxed-math are removed. Users of these options will get a warning message: is deprecated and the compiler will continue compiling with the available default library.

XC16 v1.70 now allows the arguments to #pragma config to be seen by the pre-processor and macro expanded when using the compiler option -mexpand-pragma-config. This could mean that a previously working #pragma config may fail with the updated compiler because the value has been replaced by a macro value. This may result in a message similar to:

Dual Core device linker scripts now use a new symbol __SECONDARY_CODE_LENGTH in device startup routines. Please update your device support files either with the latest DFP or by using the v1.70 internal compiler part support files.

Scheduling occurs at two discrete points during optimization transformations and can be disabled using the command line options: -fno-schedule-insns -fno-schedule-insns2 which can be applied on a file-by-file basis, or globally for a project, in the "additional options" text box in the compiler options page.

To support fixed point arithmetic, the default startup routine now initializes the CORCON register and the compiler relies on this and the ability to modify the DSP configuration bits in CORCON. The startup routine is fixed and will initialize this register regardless of whether or not fixed point is used in the application.

The compiler will save and restore CORCON in functions where the compiler would modify CORCON. This can occur if fixed point operations are used. To inform the compiler of any function which sets CORCON, please use the save(CORCON) attribute in the definition of that function. The compiler will then save and restore CORCON around all calls to the specified function(s).

xclm Location - MPLAB XC16 v1.00 installed the xclm executable into a separate directory. Starting in MPLAB XC16 v1.10, the xclm executable is now located in the compiler's bin directory (e.g. /bin). To query the available licenses or to activate a license, use the newer copy of the xclm executable. The older location is no longer used and, if you aren't using it for an older MPLAB XC compiler, you may remove the older copy.

760c119bf3
Reply all
Reply to author
Forward
0 new messages