• 0

Debug an Arduino-compiled sketch under MPLAB-X?


I have an Arduino sketch that runs beautifully on a Wi-FIRE Rev C board using the chipkit wifire(Rev C) board that was installed as part of the Digilent core linked on this page


NOT the chipKIT core identified on chipkit.net page.

I created an ELF file of the sketch by building it under Arduino 1.8.2 (NOT MPIDE) with compiler optimization set to zero so that all of my source lines would be preserved, and the -g option. I then fired up MPLAB-X (v 3.61), imported the ELF file and added the the chipKIT bootloader image under the project "Loadables" sources.

I can then run the program fine under Debug and even set breakpoints within main.cpp, but I can't set any breakpoints within my sketch code (DSPI_Demo.ino.cpp. Before hitting the "Debug" button in MPLAB-X the BP is fine, but afterwards it is broken. The attached images show some of my sources and the BP behavior. Any thoughts





Edited by jfrenzel
Attached images

Share this post

Link to post
Share on other sites

3 answers to this question

Recommended Posts

  • 0

I repeated the whole flow after creating a D:\ardo folder and two subfolders D:\ardo\build and D:\ardo\mplab. I then changed my Arduino preferences.txt file to set the Arduino build directory and followed the steps on the attached PDF. (Namely, import the ELF and add the Wi-FIRE bootloader under "Loadables" project folder.) I was then able to set breakpoints, single-step etc.


Debug Arduino sketch using MPLAB-X.pdf

Share this post

Link to post
Share on other sites
  • 0

It appears that the problem was spaces in the path to the MPLAB-X project directory.

I think I solved the problem by copying the entire Arduino build tree from the Temp folder under a user's AppData tree (Windows 7) to a short path with no spaces or caps. (The joy of legacy Unix code under Windoze?)

I'll repeat the whole painful process after the weekend and post the final outcome. I did once have a student try to convince me that spaces in a build path weren't really a problem, but I have never trusted it. Just call me old school.

Stay tuned ...

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now