MPLAB X gotchas

I’ve been hammering away on an embedded project using a PIC32MZ, using microchips official MPLAB-X ide.

It’s interesting because it’s netbeans with some embedded enhancements and some genuinely useful additions. But using it with 32 bit microcontrollers, it tends to perform quite awfully. Here is a running list of things I have ran into and want to warn others and my future self to not get burned by them again!

NOTE: These are likely specific to XC32 and PIC32 targets.

  1. Modifying a project (adding/removing lots of files, etc) structure seems to not correctly regenerate the makefile -> bogus errors until you restart MPLAB X and do a clean build. Painful
  2. If you have several projects open and debug back and forth between them, the IDE will eventually stop uploading the latest binary of a project to device. I couldnt believe it, so i changed my startup log and sure enough I had wasted 10s of build cycles uploading an outdated binary -> restart MPLAB X between project switches. Ideally, only have one project open.
  3. Placing breakpoints or changing code sometimes ends up with breakpoints at line -1. If you break at top of line, check breakpoints window for these phantom bp
  4. Memory and program usage bars sometimes do not update, or increase on rebuilds with no changes. Restart, clean and build seems to get more correct values.
  5. add existing items from folders... sometimes skips over sub directories. always check it after adding items to project
  6. The IDE will not detect C99 reliably, resulting in millions of squigglies

Other noteworthy crashes, bugs, etc include

  1. you cannot click memory addresses directly from variables to browse to them in data / execution memory for some awful reason. Copy doesnt work in variable section, but you can copy from the tooltip that pops up.. then manually look it up in target memory views.
  2. I/O view crashes the entire IDE instantly on OSX. it works on windows and linux but is dog slow on PIC32 devices. Like everything else its several seconds for any operation. And this is on their expensive ICD4 debugger..
  3. Increasing java memory flag -JXmx for the IDE in (<install>\mplab_platform\etc\mplab_ide.conf) can improve performance but the default is pretty good, seems to scan how much RAM you have. I tried setting it very high on a machine with 32GB of ram, i gave it 12GB and it made MPLAB-X slideshow. 4-8 seems ideal on 32GB ram

On a side note, interestingly, using MPLABX with smaller PIC products like PIC18, PIC24, PIC16 the ide runs DRAMATICALLY faster and is quite good, so maybe there is hope yet.

July 19, 2019

Previous:Github activity