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.
-
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– vicatcu2010年07月26日 20:22:21 +00:00Commented Jul 26, 2010 at 20:22
2 Answers 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.
-
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– bjarkef2010年07月26日 22:40:45 +00:00Commented Jul 26, 2010 at 22:40
-
5\$\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– markus_b2011年04月15日 17:49:00 +00:00Commented Apr 15, 2011 at 17:49
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
-
1\$\begingroup\$ This looks spot-on, but please include relevant commands in your answer before the link goes down. \$\endgroup\$Dmitry Grigoryev– Dmitry Grigoryev2017年06月07日 11:20:07 +00:00Commented Jun 7, 2017 at 11:20
Explore related questions
See similar questions with these tags.