8

So, I have hooked up a ATtiny88, and am programming it with the Dragon AVR using ISP. I have also set up the build toolchain, using avrdude, and the gnu avr tools. Everything is working great.

Now I would like to do in-circuit debugging using the advertised debugwire which is also connected to the ISP and which the dragon supports. But which tools do I use? I see there is a avr-gdb, but it seems that I needs some kind of simulator, however I would like to debug in-circuit on the real MCU. Is this possible?

Thanks in advance.

bjarkef
  • 738
  • 3
  • 8
  • 17
  • 1
    I'm also interested in how one actually uses debugwire. I keep seeing it in the manuals for my chips, but haven't had occasion to use it yet. – vicatcu Jul 26 '10 at 20:22

2 Answers2

2

enable debugwire

enable with avrdude (fuse for attiny88):

avrdude -c dragon_isp -P usb -p attiny88 -v -U hfuse:w:0xd9:m

compilation

  • must be compiled with -ggdb or great (--gdb3) but doesn't seem to help with macros
  • no optimisations

    COMPILE = $(GCC_PATH) -ggdb3 -Wall -Wextra $(OPTIMIZATION) -std=gnu11 -flto -mmcu=$(DEVICE) -DF_CPU=$(CLOCK)

need main.hex and main.elf

debugging

start avarice:

avarice -g -w -P attiny88 :4242

then start gdb:

avr-gdb main.elf

and connect:

target remote localhost:4242

breakpoints

only sw breakpoints with debugwire, so if need breakpoints use:

asm('break');

switch back to spi/icsp mode

NB. VTG/VCC pin (2 on header) must be connected to chip supply for this to work!

avrdude -c dragon_isp -P usb -p attiny88 -v -U hfuse:w:0xdd:m
Matt Venn
  • 21
  • 4
2

Have a look at avarice. It's man page also has something to say about debugwire. I don't know if that'll be good news or bad, though.

XTL
  • 1,223
  • 1
  • 11
  • 18
  • 1
    You are right, it really seems that avarice does support both the AVR Dragon and debugWire debugging. There is however the drawback, that to enable debugging with the debugWire, the reset pin fuse has to be change do debugWire mode, which means that ISP is no longer possible, leaving only the option of reflashing the device using high voltage programming. :/ – bjarkef Jul 26 '10 at 22:40
  • 5
    There is a workaround for this problem: You can reprogram the fuses using debugWire/avarice. So, after your debug session, just reset the DWEN fuse with avarice and you've got ISP back. – markus_b Apr 15 '11 at 17:49