Re: [avr-gcc-list] avr-gcc-gdb

From:

Joerg Wunsch

Subject:

Re: [avr-gcc-list] avr-gcc-gdb

Date:

Sat, 10 Mar 2007 15:04:52 +0100 (MET)

Robert Lore <address@hidden> wrote:
> Can anyone point me to an idiots page on gluing avarice to gdb and
> gcc, and a small tutorial about the whole thing..
GCC is just the compiler, and its only role here is to produce an
object file that contains symbolic debugging information (for GDB,
preferrably -gstabs is to be used). The executable contents of that
object file needs to be brought into the AVR's flash ROM then. There
are a few ways to do this, a safe way is to first extract the load
data as a hex file using avr-objcopy, and program it using AVRDUDE.
AVaRICE is just the glue between the JTAG ICE and GDB. It talks to
the ICE using RS-232 or USB, with the protocol described in the
respective Atmel appnotes. For the GDB communication, the "remote
target" interface of GDB is used, where GDB can control its target
using a serial or network connection. (This method has other
applications in GDB as well, for example it can be used to debug an
entire operating system kernel using GDB hooks built into the kernel.)
So it works like:
+--------+ +------------+ +----------+
| | JTAG | JTAG ICE | RS-232 | |
| AVR |-- or ----| or |-- or --| AVaRICE |
| | debugWire | AVR Dragon | USB | |
+--------+ +------------+ +----------+
|
TCP
socket
|
+----------+
| |
| GDB |
| |
+----------+
In theory, AVaRICE can also be used to download the code to the AVR,
but that functionality has not been debugged very well lately, so it
might not work all the time. Also, GDB offers a "load" command that
can reprogram the flash, but I know that is at least fully broken for
debugWire as it doesn't try to write in pages, and last time I
attempted to use it with JTAG, it was so awefully slow that it was
fairly unusable. Debugging these has not had a very high priority on
my list, and apparently neither for other developers.
--
cheers, J"org .-.-. --... ...-- -.. . DL8DTL
http://www.sax.de/~joerg/ NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)