7
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ 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. \$\endgroup\$ – vicatcu Jul 26 '10 at 20:22
2
\$\begingroup\$

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.

\$\endgroup\$
  • 1
    \$\begingroup\$ 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. :/ \$\endgroup\$ – bjarkef Jul 26 '10 at 22:40
  • 4
    \$\begingroup\$ 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. \$\endgroup\$ – markus_b Apr 15 '11 at 17:49
1
\$\begingroup\$

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
\$\endgroup\$
  • 1
    \$\begingroup\$ This looks spot-on, but please include relevant commands in your answer before the link goes down. \$\endgroup\$ – Dmitry Grigoryev Jun 7 '17 at 11:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.