I've got an Arduino Duemilanove and am programming it in C with AVR Studio. Is there any way to get a source level debugger to work with this setup?
-
\$\begingroup\$ While you may have valid reasons for wanting source level debug, I would recommend not to become reliant on it. Most microcontrollers do not support interactive debugging and relying on it may restrict your choices in future. JTAG debugging is slow, so will usually interfere with real-time tasks. Where possible, use LEDs and UARTs for debug. Write portable code so that the bulk of the logic can be debugged on a PC. \$\endgroup\$Toby Jaffey– Toby Jaffey10/16/2011 20:13:16Commented Oct 16, 2011 at 20:13
-
\$\begingroup\$ That is good advice Joby. I tend to treat source level debug as a nice to have, not an essential. I develop already like you say, keep it portable, debug most of the PC. Sometimes it's good to be able to just set a breakpoint and examine and change the variables there without having to add debug prints, recompile, redownload etc. \$\endgroup\$fred basset– fred basset10/16/2011 20:19:10Commented Oct 16, 2011 at 20:19
-
\$\begingroup\$ I hope this isn't off topic but AVR Studio is Visual Studio. The Arduino Plugin for Visual Studio Pro has a unique Arduino Debugger. It's free at the moment and doesn't require any additional hardware to work so it's easy to try it out. \$\endgroup\$Visual Micro– Visual Micro10/21/2012 01:09:37Commented Oct 21, 2012 at 1:09
2 Answers
Yes, some AVRs provide JTAG which can be used with AVR-GDB to do source level debug.
-
\$\begingroup\$ Thanks, so you definitely need an AVR chip with a JTAG interface to get src level debug? \$\endgroup\$fred basset– fred basset10/16/2011 19:29:09Commented Oct 16, 2011 at 19:29
-
\$\begingroup\$ I believe so, yes. \$\endgroup\$Toby Jaffey– Toby Jaffey10/16/2011 19:38:08Commented Oct 16, 2011 at 19:38
-
\$\begingroup\$ Do you know if any of the standard Ardunio boards have a JTAG port? \$\endgroup\$fred basset– fred basset10/16/2011 19:40:22Commented Oct 16, 2011 at 19:40
-
\$\begingroup\$ The microcontroller on the arduino.cc/en/Main/ArduinoBoardMega claims to support JTAG \$\endgroup\$Toby Jaffey– Toby Jaffey10/16/2011 20:04:37Commented Oct 16, 2011 at 20:04
Get a hardware debugger for atmel to use with your Due. AVROne is the current one. I bought a JTAGICE3 a ways back after the price drops and just got it working with an UNO and boy is it nice to get back to source debugging and hardware breakpoints. debugWIRE is plenty fast for upload and control. I debugged a port of some IR Receive interrupt driven code in minutes. I have a blog entry coming on setting it up. If you are building under AS you hare 1/2 way there.
Other choices in almost free hardware debugging where you get the hardware debug support with the development board have proliferated for a while. Just setup an STM8S Discovery and its great. Other great options are the TI selections, and ARMS, etc.
-
1\$\begingroup\$ Not a Due, but a Duemilanove. \$\endgroup\$Ignacio Vazquez-Abrams– Ignacio Vazquez-Abrams12/10/2014 06:35:12Commented Dec 10, 2014 at 6:35
-
\$\begingroup\$ Bad time to abbreviate. Duemilanove should work as well as my UNO R3. The board needs one prep, discussed all over the web. You cut the RESET_EN trace to allegedly allow debugWIRE control over reset. The Duemilanove has what appears to be the same trace. However, I just looked at the schematic for both boards and it really doesn't make sense as there is trace illustrated running around the jumper anyway. Must be a schematic mistake. I installed a jumper so I could go back and forth between the Arduino IDE and debugWIRE. \$\endgroup\$Doug– Doug12/10/2014 14:19:32Commented Dec 10, 2014 at 14:19