public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] Configuring an eCos application to debug it using GDB
@ 2008-03-27  8:45 Jérémy Alles
  2008-03-27  9:02 ` Andrew Lunn
  2008-03-27 14:02 ` Gary Thomas
  0 siblings, 2 replies; 5+ messages in thread
From: Jérémy Alles @ 2008-03-27  8:45 UTC (permalink / raw)
  To: 'eCos Discussion'

Hi,
 
	I'm trying to configure properly my eCos application in order to
debug it using GDB (over Ethernet). I'm using an AT91 based development kit
with Redboot already flashed on it (by someone else in my company). My board
has IP 192.168.1.20, and I can successfully connect to it from arm-elf-gdb.
    
	The problem is I think that I'm missing something in my
configuration (ecos.ecc), as when my application starts, it returns 54321
and not something like $O3534313231#56+. That is why I think i'm doing
something wrong.

jalles@jalles1475:~/local_repository/drivers/led$ arm-elf-gdb
GNU gdb 5.3 (eCosCentric)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
(gdb) target remote 192.168.1.20:9000
Remote debugging using 192.168.1.20:9000
0x10027580 in ?? ()
(gdb) load main.elf
Loading section .rom_vectors, size 0x40 lma 0x20040000
Loading section .text, size 0x6948 lma 0x20040040
Loading section .rodata, size 0x284 lma 0x20046988
Loading section .data, size 0x6cc lma 0x20046c0c
Start address 0x20040040, load size 29400
Transfer rate: 235200 bits/sec, 294 bytes/write.
(gdb) c
Continuing.

	Moreover, if I want to use a break point, the load command is not
enough:

(gdb) load main.elf
Loading section .rom_vectors, size 0x40 lma 0x20040000
Loading section .text, size 0x7f07c lma 0x20040040
Loading section .rodata, size 0x4f5d4 lma 0x200bf0bc
Loading section .data, size 0x5264 lma 0x2010e690
Start address 0x20040040, load size 866548
Transfer rate: 407787 bits/sec, 299 bytes/write.
(gdb) b main
No symbol table is loaded.  Use the "file" command.

	Whereas I build my application using the -g option... Any idea ?


Regards,
Jeremy


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Configuring an eCos application to debug it using GDB
  2008-03-27  8:45 [ECOS] Configuring an eCos application to debug it using GDB Jérémy Alles
@ 2008-03-27  9:02 ` Andrew Lunn
  2008-03-27 14:02 ` Gary Thomas
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2008-03-27  9:02 UTC (permalink / raw)
  To: J?r?my Alles; +Cc: 'eCos Discussion'

On Thu, Mar 27, 2008 at 09:27:50AM +0100, J?r?my Alles wrote:
> Hi,
>  
> 	I'm trying to configure properly my eCos application in order to
> debug it using GDB (over Ethernet). I'm using an AT91 based development kit
> with Redboot already flashed on it (by someone else in my company). 

Do you have the configuration that was used to build this redboot
image? 

> 	The problem is I think that I'm missing something in my
> configuration (ecos.ecc), as when my application starts, it returns 54321
> and not something like $O3534313231#56+. That is why I think i'm doing
> something wrong.

This is to do with gdb mangling. Normally it should work out if it
needs to mangle nor not, depending on if gdb is connected or not. 

Take a look at CYGSEM_HAL_DIAG_MANGLER. 

What i don't know is if redboot or the application does the mangling.
I think it is redboot, but maybe Gary can confirm this.

Note, this only applies to output from diag_printf. If you open the
serial port, /dev/ser0, and write to that, no mangling is performed.

       Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Configuring an eCos application to debug it using GDB
  2008-03-27  8:45 [ECOS] Configuring an eCos application to debug it using GDB Jérémy Alles
  2008-03-27  9:02 ` Andrew Lunn
@ 2008-03-27 14:02 ` Gary Thomas
  2008-03-27 14:55   ` Jérémy Alles
  1 sibling, 1 reply; 5+ messages in thread
From: Gary Thomas @ 2008-03-27 14:02 UTC (permalink / raw)
  To: Jérémy Alles; +Cc: 'eCos Discussion'

Jérémy Alles wrote:
> Hi,
>  
> 	I'm trying to configure properly my eCos application in order to
> debug it using GDB (over Ethernet). I'm using an AT91 based development kit
> with Redboot already flashed on it (by someone else in my company). My board
> has IP 192.168.1.20, and I can successfully connect to it from arm-elf-gdb.
>     
> 	The problem is I think that I'm missing something in my
> configuration (ecos.ecc), as when my application starts, it returns 54321
> and not something like $O3534313231#56+. That is why I think i'm doing
> something wrong.

Where/when did you get this?

If you load and run your application directly from RedBoot, then when
you print (via diag_printf()) to the console, the mangling is disabled
and you'll see the actual string.

If you load and start your application via GDB (even if it's RedBoot
providing the GDB support), then mangling is enabled and the strings
are sent through the GDB protocol.  Only if you somehow got eCos
confused and it thought there was a GDB agent on the console would
you ever see the $O..#.. line.

> 
> jalles@jalles1475:~/local_repository/drivers/led$ arm-elf-gdb
> GNU gdb 5.3 (eCosCentric)
> Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
> (gdb) target remote 192.168.1.20:9000
> Remote debugging using 192.168.1.20:9000
> 0x10027580 in ?? ()
> (gdb) load main.elf
> Loading section .rom_vectors, size 0x40 lma 0x20040000
> Loading section .text, size 0x6948 lma 0x20040040
> Loading section .rodata, size 0x284 lma 0x20046988
> Loading section .data, size 0x6cc lma 0x20046c0c
> Start address 0x20040040, load size 29400
> Transfer rate: 235200 bits/sec, 294 bytes/write.
> (gdb) c
> Continuing.
> 
> 	Moreover, if I want to use a break point, the load command is not
> enough:
> 
> (gdb) load main.elf
> Loading section .rom_vectors, size 0x40 lma 0x20040000
> Loading section .text, size 0x7f07c lma 0x20040040
> Loading section .rodata, size 0x4f5d4 lma 0x200bf0bc
> Loading section .data, size 0x5264 lma 0x2010e690
> Start address 0x20040040, load size 866548
> Transfer rate: 407787 bits/sec, 299 bytes/write.
> (gdb) b main
> No symbol table is loaded.  Use the "file" command.
> 
> 	Whereas I build my application using the -g option... Any idea ?

You've not told GDB about the symbols.  It's much better to
start GDB like this:

   $ arm-elf-gdb main.elf
   (gdb) target remote XYZ:9000
   (gdb) load
   (gdb) b main
   (gdb) cont


-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [ECOS] Configuring an eCos application to debug it using GDB
  2008-03-27 14:02 ` Gary Thomas
@ 2008-03-27 14:55   ` Jérémy Alles
  2008-03-27 15:27     ` Gary Thomas
  0 siblings, 1 reply; 5+ messages in thread
From: Jérémy Alles @ 2008-03-27 14:55 UTC (permalink / raw)
  To: 'Gary Thomas'; +Cc: 'eCos Discussion'

Thank you for your answers...

After some check, I'm able to use GDB over serial line (and by loading
properly the symbols as you describe). 
However, it is quite long to load a 4.5MB programm... 

Any idea why this is not working throught Ethernet ? Am I supposed to change
something in eCos's configuration ?

Jeremy

-----Message d'origine-----
De : ecos-discuss-owner@ecos.sourceware.org
[mailto:ecos-discuss-owner@ecos.sourceware.org] De la part de Gary Thomas
Envoyé : jeudi 27 mars 2008 13:13
À : Jérémy Alles
Cc : 'eCos Discussion'
Objet : Re: [ECOS] Configuring an eCos application to debug it using GDB

Jérémy Alles wrote:
> Hi,
>  
> 	I'm trying to configure properly my eCos application in order to 
> debug it using GDB (over Ethernet). I'm using an AT91 based 
> development kit with Redboot already flashed on it (by someone else in 
> my company). My board has IP 192.168.1.20, and I can successfully connect
to it from arm-elf-gdb.
>     
> 	The problem is I think that I'm missing something in my
configuration 
> (ecos.ecc), as when my application starts, it returns 54321 and not 
> something like $O3534313231#56+. That is why I think i'm doing 
> something wrong.

Where/when did you get this?

If you load and run your application directly from RedBoot, then when you
print (via diag_printf()) to the console, the mangling is disabled and
you'll see the actual string.

If you load and start your application via GDB (even if it's RedBoot
providing the GDB support), then mangling is enabled and the strings are
sent through the GDB protocol.  Only if you somehow got eCos confused and it
thought there was a GDB agent on the console would you ever see the $O..#..
line.

> 
> jalles@jalles1475:~/local_repository/drivers/led$ arm-elf-gdb GNU gdb 
> 5.3 (eCosCentric) Copyright 2002 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and 
> you are welcome to change it and/or distribute copies of it under 
> certain conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
details.
> This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
> (gdb) target remote 192.168.1.20:9000
> Remote debugging using 192.168.1.20:9000 0x10027580 in ?? ()
> (gdb) load main.elf
> Loading section .rom_vectors, size 0x40 lma 0x20040000 Loading section 
> .text, size 0x6948 lma 0x20040040 Loading section .rodata, size 0x284 
> lma 0x20046988 Loading section .data, size 0x6cc lma 0x20046c0c Start 
> address 0x20040040, load size 29400 Transfer rate: 235200 bits/sec, 
> 294 bytes/write.
> (gdb) c
> Continuing.
> 
> 	Moreover, if I want to use a break point, the load command is not
> enough:
> 
> (gdb) load main.elf
> Loading section .rom_vectors, size 0x40 lma 0x20040000 Loading section 
> .text, size 0x7f07c lma 0x20040040 Loading section .rodata, size 
> 0x4f5d4 lma 0x200bf0bc Loading section .data, size 0x5264 lma 
> 0x2010e690 Start address 0x20040040, load size 866548 Transfer rate: 
> 407787 bits/sec, 299 bytes/write.
> (gdb) b main
> No symbol table is loaded.  Use the "file" command.
> 
> 	Whereas I build my application using the -g option... Any idea ?

You've not told GDB about the symbols.  It's much better to start GDB like
this:

   $ arm-elf-gdb main.elf
   (gdb) target remote XYZ:9000
   (gdb) load
   (gdb) b main
   (gdb) cont


--
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss


--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [ECOS] Configuring an eCos application to debug it using GDB
  2008-03-27 14:55   ` Jérémy Alles
@ 2008-03-27 15:27     ` Gary Thomas
  0 siblings, 0 replies; 5+ messages in thread
From: Gary Thomas @ 2008-03-27 15:27 UTC (permalink / raw)
  To: Jérémy Alles; +Cc: 'eCos Discussion'

Jérémy Alles wrote:
> Thank you for your answers...
> 
> After some check, I'm able to use GDB over serial line (and by loading
> properly the symbols as you describe). 
> However, it is quite long to load a 4.5MB programm... 
> 
> Any idea why this is not working throught Ethernet ? Am I supposed to change
> something in eCos's configuration ?

You should not have to do anything.  That said, debugging via ethernet
can be very tricky since your eCos application (if it is!) and RedBoot
are sharing the same ethernet device.

There are a couple ways around this - both involve separating the load
and execute/debug steps.  You do need to know the entry address.

1. Load the application using Redboot, then start GDB over the serial
    port.

      (via serial or telnet)
      RedBoot> load main.elf

      disconnect from RedBoot - by serial, just drop out (minicom, etc)
      by network, close the telnet session

      $ arm-elf-gdb main.elf
      (gdb) tar rem /dev/ttyXX
      (gdb) set $pc=XXX
      (gdb) c

2. Load the application using GDB over the network, then change to use
    serial.

      $ arm-elf-gdb main.elf
      (gdb) tar rem redboot-IP:9000
      (gdb) load
      (gdb) detach
      (gdb) tar rem /dev/ttyXX
      (gdb) c

> -----Message d'origine-----
> De : ecos-discuss-owner@ecos.sourceware.org
> [mailto:ecos-discuss-owner@ecos.sourceware.org] De la part de Gary Thomas
> Envoyé : jeudi 27 mars 2008 13:13
> À : Jérémy Alles
> Cc : 'eCos Discussion'
> Objet : Re: [ECOS] Configuring an eCos application to debug it using GDB
> 
> Jérémy Alles wrote:
>> Hi,
>>  
>> 	I'm trying to configure properly my eCos application in order to 
>> debug it using GDB (over Ethernet). I'm using an AT91 based 
>> development kit with Redboot already flashed on it (by someone else in 
>> my company). My board has IP 192.168.1.20, and I can successfully connect
> to it from arm-elf-gdb.
>>     
>> 	The problem is I think that I'm missing something in my
> configuration 
>> (ecos.ecc), as when my application starts, it returns 54321 and not 
>> something like $O3534313231#56+. That is why I think i'm doing 
>> something wrong.
> 
> Where/when did you get this?
> 
> If you load and run your application directly from RedBoot, then when you
> print (via diag_printf()) to the console, the mangling is disabled and
> you'll see the actual string.
> 
> If you load and start your application via GDB (even if it's RedBoot
> providing the GDB support), then mangling is enabled and the strings are
> sent through the GDB protocol.  Only if you somehow got eCos confused and it
> thought there was a GDB agent on the console would you ever see the $O..#..
> line.
> 
>> jalles@jalles1475:~/local_repository/drivers/led$ arm-elf-gdb GNU gdb 
>> 5.3 (eCosCentric) Copyright 2002 Free Software Foundation, Inc.
>> GDB is free software, covered by the GNU General Public License, and 
>> you are welcome to change it and/or distribute copies of it under 
>> certain conditions.
>> Type "show copying" to see the conditions.
>> There is absolutely no warranty for GDB.  Type "show warranty" for
> details.
>> This GDB was configured as "--host=i686-pc-linux-gnu --target=arm-elf".
>> (gdb) target remote 192.168.1.20:9000
>> Remote debugging using 192.168.1.20:9000 0x10027580 in ?? ()
>> (gdb) load main.elf
>> Loading section .rom_vectors, size 0x40 lma 0x20040000 Loading section 
>> .text, size 0x6948 lma 0x20040040 Loading section .rodata, size 0x284 
>> lma 0x20046988 Loading section .data, size 0x6cc lma 0x20046c0c Start 
>> address 0x20040040, load size 29400 Transfer rate: 235200 bits/sec, 
>> 294 bytes/write.
>> (gdb) c
>> Continuing.
>>
>> 	Moreover, if I want to use a break point, the load command is not
>> enough:
>>
>> (gdb) load main.elf
>> Loading section .rom_vectors, size 0x40 lma 0x20040000 Loading section 
>> .text, size 0x7f07c lma 0x20040040 Loading section .rodata, size 
>> 0x4f5d4 lma 0x200bf0bc Loading section .data, size 0x5264 lma 
>> 0x2010e690 Start address 0x20040040, load size 866548 Transfer rate: 
>> 407787 bits/sec, 299 bytes/write.
>> (gdb) b main
>> No symbol table is loaded.  Use the "file" command.
>>
>> 	Whereas I build my application using the -g option... Any idea ?
> 
> You've not told GDB about the symbols.  It's much better to start GDB like
> this:
> 
>    $ arm-elf-gdb main.elf
>    (gdb) target remote XYZ:9000
>    (gdb) load
>    (gdb) b main
>    (gdb) cont

-- 
------------------------------------------------------------
Gary Thomas                 |  Consulting for the
MLB Associates              |    Embedded world
------------------------------------------------------------

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2008-03-27 14:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-27  8:45 [ECOS] Configuring an eCos application to debug it using GDB Jérémy Alles
2008-03-27  9:02 ` Andrew Lunn
2008-03-27 14:02 ` Gary Thomas
2008-03-27 14:55   ` Jérémy Alles
2008-03-27 15:27     ` Gary Thomas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).