Jump to content
  • 0

Debug an Arduino-compiled sketch under MPLAB-X?


jfrenzel

Question

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

https://reference.digilentinc.com/learn/software/tutorials/digilent-core-install/start

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

 

sources.jpg

good-bp.jpg

broken-bp.jpg

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

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.

Success!

Debug Arduino sketch using MPLAB-X.pdf

Link to comment
Share on other sites

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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...