AVR/Arduino Hardware Debugger on the Cheap

Go To Last Post
12 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I’ve developed an Arduino sketch that runs on one Arduino and allows it to control and debug another Arduino, or an AVR-Series micro-controller such as an ATTiny85.  With some limitations, you can use the controlling Arduino to disassemble code, single step code, inspect and modify the current value of registers. I/O ports and SRAM and run code with a hardware breakpoint set.

 

You can read more about my project at https://sites.google.com/site/wayneholder/debugwire and/or watch a short, demo video at https://youtu.be/kI_Z78a_0y0

 

Wayne

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wait - this is a different project than https://github.com/dcwbrown/dwir... ??   Two independent debugwire projects in less than 6 months!  Cool.

Have we figured out more than the original RikusW post?

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Wayne.

 

Thank you for sharing. It is obvious that you have put a lot of work into this project.

 

Would you like to add it to the AVRFreaks' Project area so that this thread does not get lost in the mists of time?

 

Cheers,

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What a wonderfull project.

Do you have any ambition to make this compatible with GDB?

My understanding of GDB is that it makes the link between your low level terminal interface and information in .elf files.

GDB is a pretty popular debugging environment with a lot of different front ends.

It can supposedly be directly used in Qt Eclipse and lots of other IDE's so you can set breakpoints in your C source and GDB and your debug interface with debug wire then put it into your targetprocessor.

 

Also had a short peek at your other projects and youtube video's.

Quite a bunch of nice projects. Wonderfull.

Paul van der Hoeven.
Bunch of old projects with AVR's:
http://www.hoevendesign.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Paulvdh wrote:
Do you have any ambition to make this compatible with GDB?
dwire-debug that westfw mentioned in post #2 has a GDB server and has firmware for tiny85.

 

https://github.com/dcwbrown/dwire-debug/tree/master/src/gdbserver

debugWIRE via USB UART
http://www.avrfreaks.net/forum/debugwire-usb-uart

(search for GDB)

 

Edit: link target

 

"Dare to be naïve." - Buckminster Fuller

Last Edited: Mon. Feb 5, 2018 - 08:13 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

>Would you like to add it to the AVRFreaks' Project area so that this thread does not get lost in the mists of time?

 

Sure.  That would be nice

 

Wayne

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Several people have asked me about GDB, but I currently have no experience with it.  Perhaps in the future I'll have time to learn more about it and make it an option.   But, for the time being, my main goal is to get the core logic as solid as possible.  I used the work of dcwbrown's and RikusW as a reference, but I've discovered that debugWire has some tricky areas I'm still working to understand.  Switching between RUN and Single Stepping, for example, was hard to get working reliably because, after running, and stopping with a BREAK command, the next STEP operation would branch into the EE_RDY interrupt handler instead resuming with the instruction after the BREAK.  After a lot of trial and error, I discovered that reading the EECR register before doing a STEP seemed to stop this behavior, but I don't really understand why it works (or why the EE_RDY interrupt handler is being invoked.)

 

I'm also working to integrate a STK500-compatible ISP programmer feature into the logic so that the Arduino IDE can use it to upload code as well as debug it.  I have a first cut of this working now, but it still has some rough edges.

 

Wayne

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Nice project! You also have great technical documentation skills. Using debug wire is on my bucket list, I hope to follow your project.

It all starts with a mental vision.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Also take a look at the jtagice mkII protocol, maybe you will prefer it to the STK500.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

I’ve posted a new, part 3 article on my debugger project, along with new code and an overview video.  The new code  is now able debug an Arduino UNO running at 16 MHz and also includes some bug fixes and enhancements.

 

 https://sites.google.com/site/wayneholder/debugwire3

 https://youtu.be/F1202b0l5DA

 

Wayne

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Handy tip:   Paint the pin #1 wire of your 6-way ribbon cable with the Red Permanent Marker.   i.e. just like 6-way ribbon comes from the factory.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Ross McKenzie ValuSoft Melbourne Australia