Go to the location where you downloaded the installer. Unzip the downloaded file and run the installer:
xc32-vX.XX-windows-installer.exe.
Depending on your Windows security settings, you may get a window asking if you are sure you want to run this program.
Your computer's login and password need to be entered if you have enabled that protection for new installations. If you don't have a password enabled you can just click on OK to continue.
If you need to work with Microchip Support staff directly, you can submit a technical support case. Keep in mind that many questions can be answered through our self-help resources, so this may not be your speediest option.
I was previously compiling my C and C++ PIC32 mcu project in Microchip's MPLAB X IDE v6.15 with a paid Pro XC32 compiler license. My license has expired and no amount of buying a new one will fix it, so meanwhile I'd like to compile with the free license.
Are you looking for code optimizations? Our free MPLAB XC C Compiler comes with the majority of the optimizations you need to reduce your code size and increase its efficiency. If you're unsure which optimizations are best for your design, our free MPLAB XC Compiler Advisor can help you find the best optimizations for your project. Specifically, the free compiler contains these optimizations:
Note that at one point I also tried deleting my license file at /opt/microchip/xclm/license/microchip-1.lic, but I got the same result. (Though maybe I needed to close and reopen the project, not just the IDE?)
For the "Your MAC Address" box, enter the "Host id" as shown in the output of xclm -hostinfo. On Linux and Mac, run that in the terminal. On Windows, run that in the Command Prompt (cmd.exe) or in the Git Bash terminal. This xclm XC32 Compiler License Manager command-line tool was installed for you when you installed the XC32 compiler above.
Ensure you have downloaded and installed the MPLAB X IDE and an XC32 compiler. Once you have extracted the compiler down to a .run file, such as xc32-v4.35-full-install-linux-x64-installer.run, the installation command in Linux looks like this:
During the install, you'll see this window where you get to choose the "Free" license option. In my experience (perhaps just with their older XC32 compilers, since I'm using an older version actually), this selection does absolutely nothing and means absolutely nothing:
where xclm is the XC32 License Manager executable that is now installed on your system since you ran the XC32 compiler installer above. which xclm shows that it is located in /opt/microchip/xc32/v4.35/bin/xclm, for instance.
Microchip's license server will make a custom free license for you, so long as it is working. I has been down for several weeks at the end of 2023/beginning of 2024, hence my question here. I don't know if this =step2 link worked during that time.
Running this .sh license installer will fail if you haven't installed an XC32 compiler yet. The license installer looks for the existence of the /opt/microchip/xclm/license dir to see if you have the compiler installed, and fails if that directory doesn't exist.
The name of the license file doesn't really matter, so you can rename them to help you keep track of your licenses. Ex: here I have added _free and _pro to the end of my default license file names so I can remember which is which: all inside the /opt/microchip/xclm/license dir:
You can have multiple licenses installed at once, but if a pro license exists, the IDE will try to use the latest pro license even if it is expired. So, to force your free license to be used instead, move all pro licenses out of the license directory.
If multiple pro licenses are installed, the latest one will be used, so there is no need to delete old pro licenses as you renew and install new pro licenses. For more on this, see my answer here: How to renew your paid Microchip XC32 Compiler Pro license when it has expired or is about to expire.
Note: I don't know if this part is strictly required here, but I've found that in git checkouts the MPLAB X IDE and the configuration files frequently get out of sync, as the IDE only reads the project config files at certain times, and it uses and writes back old/stale/wrong data if you don't do this. So, it's not a bad idea to do this after any git checkout which modifies the project configuration file, or whenever making big settings changes such as to license files.
Run prjMakefilesGenerator MyProject.X to regenerate the build files. I have prjMakefilesGenerator as a symlink (in my PATH) pointing to /opt/microchip/mplabx/v6.15/mplab_platform/bin/prjMakefilesGenerator.sh. If you don't, run it explicitly instead:
Once you've manually deleted the above files once and committed this change to git, and you have created the .gitignore file with the contents above, you can forcefully remove all ignored files next time with my git-rm_ignored_files.sh script from my eRCaGuy_dotfiles repo. It calls git clean -Xdn and git clean -Xdf which do this.
In the build output window at the bottom-right of the IDE, you'll see CLEAN SUCCESSFUL (total time: 51ms) in green at the top of the build output. Several seconds (or dozens of seconds for large projects) later, you'll see this at the bottom of the build output, with the BUILD SUCCESSFUL (total time: 9s) part in green:
This free license file appears to work on any version of the XC32 compiler, including very old versions such as XC32 v1.42, as well as the newest versions such as v4.35, which is currently the latest.
The free license works perfectly fine, for both C and C++, even with optimization level -O1 set for both of them. Using higher optimization levels than that will still build successfully, but will produce a warning that "Optimization level > 1" is ignored and not supported by the free license version of the compiler. See my test results below. Therefore, for full support of optimization levels > -O1, you'll need to buy a pro license or compile a license-free version of the XC32 compiler from source yourself.
I tested all optimization levels with the free compiler, using XC32 version 1.42 (I know, very old), setting the optimization level in both the xc32-gcc and xc32-g++ settings at the same time. See screenshots in the question for these settings. Get my size_mcu script to run on the .elf firmware files from my eRCaGuy_dotfiles repo.
Notice that in the size results below, the "Data Used" is exactly identical to the O1 results above, but the "Program Used" is slightly larger. Also, comparing the O1 and O2 hex files using meld shows that they differ significantly. So, I don't know what the compiler is doing here, but it's definitely not O2, and is not quite the same thing as O1!
-O3 - ignores the option and builds successfully at approximately the O1 level. It produces the same warning as the -O2 option above, and its size results differ slightly from both the -O1 and -O2 options above.
-Os - ignores the option and builds successfully at approximately the O1 level, but a tiny bit smaller in program space. It produces the same warning as the -O2 and -O3 options above, and its size results differ slightly from both the -O1 and -O2 options above.
I've found Microchip's IDE, software, configurations, compiler, licenses, support libraries and packages, and GUI configuration tools for microcontroller peripherals to be more irritating, difficult to use, and buggy than ST's comparable tools. Part of that is probably because Microchip's MPLAB X IDE is based on Netbeans instead of Eclipse.
Microchip's MPLAB X IDE is cross-platform (Windows, Mac, and Linux), and Netbeans-based. It feels a bit outdated. Their compiler is GCC-based, but locked out with paid licenses which have been integrated into the GPL source code (which is 100% legal and fine in that regard, but irritating). Their license fees are onerous and their license server flaky, costing me days of paid development time. I have built the full XC32 compiler suite royalty-free from source on both Windows and Linux, but have not integrated it for use yet. Feel free to compile it yourself and join the effort to have a royalty-free open source XC32 compiler for PIC32 mcus. Here's my repo: _XC32_Compiler. See the open issues.
ST's STM32CubeIDE is also cross-platform (Windows, Mac, Linux), and is Eclipse-based, which is better I think. Last I checked, all of ST's software and compiler tools are also royalty-free (no cost) and open source, which is great. No license server problems and lost development time when they are down, and no extra costs.
Having said all that, Arduino is amazing, and I love the simplicity and power of Atmel AVR chips. And, Microchip now makes them all. :) When it comes to PIC32 vs STM32, however, I'm currently leaning towards STM32, but I still have much to learn about both.
Combined with the MPLAB XC compiler, you can speed up your project development process. Download the compiler suitable for your project from the following link:
-us/tools-resources/develop/mplab-xc-compilers
Note 1: MPLAB is an Integrated Development Environment, consisting on a collection of different tools that work together, some of the tools invoking other tools. For that reason, during install, do not change the installation directories, unless you know what you are doing
Note 2: Linux install script creates a symbolic link in /usr/bin pointing to the executable file. By default, the installation directory is:/opt/microchip/mplabx/vM.mm/mplab_platform/bin/mplab_idewhere M is the version major and mm the version minor.
b1e95dc632