chipKIT® Development Platform

Inspired by Arduino™

No XC32++ discussion

Created Thu, 11 Apr 2013 14:42:49 +0000 by george4657


Thu, 11 Apr 2013 14:42:49 +0000

I am a new owner of max32 and I did a search for microchips new XC32++ compiler on this forum and came up with no hits. You can not use a lot of libraries in mplab because they are c++. Has anybody here used the new compiler with chipkit and tried to use some of the mpide libraries or is there some reason you can't use them? I really miss the debug functions in mplab and I like to look at the assembler code as well.

Thanks George


Thu, 11 Apr 2013 19:16:19 +0000

XC32++ is gcc. MPIDE uses gcc.

The two are essentially identical, but they have different library structures. But the actual compilers themselves are pretty much interchangeable.

You won't have much luck using MPIDE or Arduino libraries in MPLAB with XC32++ as they rely on more than just the compiler. They rely on the "Wiring" core that is the internal API of the MPIDE and Arduino system. Things like the functions for pinMode(), digitalWrite(), analogRead(), etc, along with the facilities that map pin numbers to physical pins and ports, and to the internal peripherals.

Yes, using the Wiring core from within MPLAB is a possibility, as it's just C++ code, but setting up a project to use it would be kind of tricky and a bit of a chore.


Thu, 11 Apr 2013 20:18:14 +0000

Note however, that you can compile a sketch using MPIDE, and then debug the resulting ELF file from within MPLAB X. Keith has a tutorial elsewhere on this forum on how to do that.



Thu, 18 Apr 2013 23:58:40 +0000

I am also looking at this in a new light. Arduino has the standard hardware and standardized libraries basically written in C++ with HAL encapsulated into the wiring libraries which are specific to each board/chip.

But the code for the wiring libraries are available and written for the PIC32MX. So in theory... Bring in the HAL Wiring libraries into the XC32++ Project , fixup as needed and then the Arduino libraries should work as long as they are not writing directly to the hardware. This would be awesome for the PIC world. Most of the flexibility of the arduino world with debugger or bootloader.

So what am i missing?

Can I target the chipkit as programmer/debugger from MBPLABX, or would I have to target say a MicroStickII?


Sat, 20 Apr 2013 16:16:43 +0000

You cannot program the chipKIT directly from MPLAB-X. You will need a programmer, like a pickit 3. or an ICD.

Then you just create your project as per the chip on your board (PIC32MX795F512L for example) and program it as a normal PIC.


Sun, 21 Apr 2013 16:42:39 +0000

Ok, So I get that I can simply use the chipkit as a prototyping board and get more I/O pins dues to the use of surface mount chip. The MicroStickII would give me fewer pins but the ability to match the chip with the project features needed.

The thing I really want is framework libraries, access to the hardware and a debugger.

The Arduino libraries are probably the most complete with the only real challenger being the .NETMF.

I am fine using higher level environment for application glue code but want to be able to delegate anything meaningful to the hardware.

So for the price of a debugger/programmer ($25+) I get to utilize off the shelf debugged libraries for a ton of sensors, shields etc. Sounds great especially if that were to include the USB communication libraries.

The two target compilers would be the one the Chipkit comes with and XC32++. XC32++ integrates out of the box but I am pretty sure won't compile library source without work. If the compiler that came with the ChipKit IDE can be used in MPLABX then that would be one less obstacle.(If someone knows how I would truly appreciate a link).

Also I am pretty sure there will be something that needs doing or someone else would have done this already or I have overlooked a huge issue.

I think the C++ compilers are great for the embedded world so long as we use them conservatively.

Also while doing all this I found a debugger and VS Plugging from Micro Vision for Arduinos which gives me most of what I want as long as I am fine with Arduino based hardware.

Off to replace my ICD2 as no longer supported past the MPLABX beta. Regards Allan


Sun, 21 Apr 2013 18:31:16 +0000

If the compiler that came with the ChipKit IDE can be used in MPLABX then that would be one less obstacle.(If someone knows how I would truly appreciate a link).

you can point the mplabx to the mpide compiler, it works fine. however... the headers are all different, so code written for mplabx default compiler using eg:

#include <p32xxxx.h>
#include <plib.h>

wont work, since all the header includes are different, macros etc.

mpide comes with C++ (pic32-g++ v4.5.1) mplabx xc32 v1.20 comes with C++ (xc32-g++ v4.5.2)

your just talking different headers and such.


Mon, 22 Apr 2013 04:38:52 +0000

Ok, so will give geting a file to compile under the Chipkit C++ compiler. First attempt. Located the tool chain, added to MPLABX (comes in as C32 Compiler). Created new project. Added c++ Main. Build, fails :-)

CLEAN SUCCESSFUL (total time: 50ms) Cannot run program "C:\Program" (in directory "C:\Users\Allan\MPLABXProjects\ArduinoPic.X"): CreateProcess error=2, The system cannot find the file specified

Kinda looks like it doesn't like it is having problems with the spaces in "Program Files", which is kind of funny as the new C32 tool chain isn't there, but old one is. May just uninstall MPLABX and or original C32 compiler unless anyone has some suggestions.

Thanks All Allan


Mon, 22 Apr 2013 15:23:14 +0000

When you load a new compiler to MPLABX you will get the error "Cannot run program" Restart MPLABX and this error will go away. You will have new errors. It looks like we will need a custom make file and/or setting path names to locate files. I wonder if this even legal in MPLABX as I never read their restrictions on use of this program.



Mon, 23 Sep 2013 02:29:10 +0000

Ok, so after a bit of a hiatus I am back looking at embedded boards again. I keep coming back to the pics 16bit and now 32bit. I see that there is now a reference BreadBoard for chipkit using a SDIP package. I think I will spend some time building out the HAL in the MPLABX compiler. Maybe I will setup a github project to see if others are interested in this idea.

I just can't seem to get past living without a source level debugger.

That and the fact my pickit3 turned up this week :-)


Tue, 28 Jan 2014 05:47:19 +0000

Thought I would share a bit of good news on something I have been working on.

I took the source for Chipkit Arduino and ported to XC32++ (really more of got it to build). Ran the thing not expecting too much to work. A few things didn't. Mostly a few compiler inline assembly pieces around the 32bit timer. Long and short of it is I seem to have the ability to run on a ChipKit UNO using MPLABX running Arduino compatible libraries. The delay stuff was the biggest issue (there also seems to be an off by one count in there if I recall for millis). Serial works which was what I was really not expecting. Digital pin stuff also seems to be working and I have an 1602 LCD working with the example Hello World.

But best of all.... I can now debug line by line.

I will now start playing with the peripherals such as i2c, interrupts, PWM, DAC, FM Transceivers, etc.

This will make Pic32 projects so much more productive!

Debugger plus community libraries for Arduino, I am in hog heaven.

Now this was really quite easy, what I don't understand why nobody else has done it before? The project does look very C++ but it still simply calls out to setup() and loop().

Regards Allan in Vancouver

Jacob Christ

Tue, 11 Feb 2014 06:50:32 +0000

Which version of the core is this working with? The impression I get from your other posts is that this maybe using the latest Arduino 1.5 code? If so this is amazing.