[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] RE: some help with gcc/gdb/avarice?

From: Theodore A. Roth
Subject: Re: [avr-gcc-list] RE: some help with gcc/gdb/avarice?
Date: Wed, 15 Sep 2004 08:46:16 -0700 (PDT)

On Wed, 15 Sep 2004, Bernard Fouché wrote:

> Hi there.
> (I dunno if it's the correct place to post such a request, sorry if I sent
> it to the wrong place).
> I'm working with a STK500/501 with an atmega128. I try to run code working
> well on a custom PCB with an atmega162. I've changed the mcu type on the
> Makefile, I download the software, but things get weird, I'm only able to
> switch on a few leds and then it seems that the program freezes or crash. So
> I wanted to use avarice/gdb to understand what's going on.
> I recently bought an olimex JTAG probe, so after having downloaded and
> compiled avarice 2.2 & gdb 6.02, I tried to use them the following way:
> 1) I made a sym link from my tty connected to the probe to /dev/avrjtag and
> I use AVARICE_ARGS=-B125KHz (BTW, there is a bug in main.cc in
> avarice-2.2/src/main.cc: the -B option tests are performed with strncmp
> instead of !strncmp, I just reported that on the avarice mailing list)
> 2) 'ice-insight myfile.hex' where myfile.hex is generated thru the Makefile
> provided with WinAVR and working well for the atmega162. I kept the -g
> option during compilation to keep debug infos. I don't see any 'strip'
> command, however I dunno if the myfile.elf used is the correct format for
> debugging.

I think this stage is your problem. You should be telling gdb to use the
.elf file.

> 3) ice-insight downloads the hex file to the STK500 and I see a red led
> flashing on the Olimex, so I think that avarice is doing its job. Once done,
> it says that it waits connections on a local port.
> 4) I run avr-gdb and type 'target remote localhost:port_number', and avr-gdb
> seems happy: it says that the connection is opened and that it is, at the
> moment at:
> 0x0000000 in ?? ()

The question marks mean that gdb can't resolve the address to a symbol.
If things go right, you should see something like this:

  (gdb) target remote :1212
  0x00000000 in __vectors ()

> However, from this point, I do not know what to do. I'm used to gdb on
> Linux, so I type 's<return>', and gdb says 'Cannot find bounds of current
> function'. 'bt' reports tons of '#<number> 0x0000000 in ??()'.

The 'target remote ...' command is the equivalent of the 'run' command
when using gdb with avarice. At this point, all you need to do is
'continue' if you just want the program to run. You would probably want
to set a break point before continuing though. ;-)

> I must be missing something and any pointer is welcomed!

This is how I use avr-gdb/avarice.

Load the program in the device with avarice (this step could be skipped
if you use the gdb 'load' command after the 'target remote' and before

  $ avarice -e -p -f test.elf

Start avarice as a gdb-remote-server:

  $ avarice --ignore-intr :1212

I use emacs for editing, so I just run avr-gdb directly from there with:

  'M-X gdb' -> 'avr-gdb test.elf'

You could also just start avr-insight in another terminal:

  $ avr-insight test.elf

The key thing to note here is that I have only used the .elf file. When
using gdb/avarice, you really don't need anything but the .elf file.

Ted Roth
PGP Key ID: 0x18F846E9
Jabber ID: address@hidden

reply via email to

[Prev in Thread] Current Thread [Next in Thread]