* Re: how to debug mips or arm platform applications by cgdb
@ 2009-06-06 23:36 Duane Ellis
2009-07-19 14:16 ` loody
0 siblings, 1 reply; 4+ messages in thread
From: Duane Ellis @ 2009-06-06 23:36 UTC (permalink / raw)
To: gdb, miloody
>> Would someone tell me how to debug mips or arm applications by CGDB.
By CGDB, I presume you mean "cross gdb".
You need to describe your target better.
===========
(A) Is your target running linux?
===========
If so, if your development host is not your target, (ie: cross work),
you need a "gdb-server" application for your target. That "gdb server"
would talk via RS232 (serial) or TCP/IP (ethernet) back to your
development host.
You can "simulate" the TCP environment quite easily using "local host"
on your development host so you can more easily understand how this
works. It can be confusing the first few times you do it.
You can learn how to run "gdb server" on your development host, (aka:
"local host"), and connect to the server using the GDB command: "target
remote localhost:port" ... 90% of the battle is understanding how
"gdbserver and target remote works" - doing that with "localhost" and a
"development host program" is sometimes a little easier to understand
and figure out.
Only then - change "target remote localhost" to "target remote
<ip-address-of-your-target-linux-board>".
===========
(B) is your target running standalone - no operating system, or
something other then linux.
===========
For example, you might be debugging "UBOOT" or some other FLASH MEMORY
type device, perhaps like: 'contiki' or 'freertos' or 'ethernut'
Some use JTAG to debug the Linux Kernel.
In this case, 2 options:
(a) A serial rom monitor that talks the GDB protocol (very rare these
days, most people use jtag).
(b) A JTAG dongle, and software for that jtag dongle that understands
the GDB protocol.
You'll need to *PURCHASE* a jtag dongle (or make one) - I highly
recommend a "USB based ftdi-2232 based dongle", and *STRONGLY* do not
recommend a "printer-port" solution.
The "jtag dongle method" - is 80% identical to the GDBREMOTE example
above - but is more complicated (20%) because you have to create an
initialization script to setup your target board, program the cpu
clocks, erase & program the flash memory, stuff like that.
A *VERY* common JTAG solution (de-facto for ARM) is: "openocd" - see:
http://openocd.berlios.de/web
In the JTAG dongle case, GDB talks "target remote" to a GDB server
program running on Linux, or Windows, or in some cases the DONGLE is
really a tiny computer that talks the GDBSERVER protocol over Ethernet
(the Zylin zy1000 is an example, it actually runs OpenOCD inside).
-Duane.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to debug mips or arm platform applications by cgdb
2009-06-06 23:36 how to debug mips or arm platform applications by cgdb Duane Ellis
@ 2009-07-19 14:16 ` loody
2009-07-19 15:09 ` Duane Ellis
0 siblings, 1 reply; 4+ messages in thread
From: loody @ 2009-07-19 14:16 UTC (permalink / raw)
To: Duane Ellis; +Cc: gdb
Hi:
2009/6/7 Duane Ellis <duane@duaneellis.com>:
>
>>> Would someone tell me how to debug mips or arm applications by CGDB.
>
> By CGDB, I presume you mean "cross gdb".
>
> You need to describe your target better.
>
> ===========
> (A) Is your target running linux?
> ===========
>
> If so, if your development host is not your target, (ie: cross work), you
> need a "gdb-server" application for your target. That "gdb server" would
> talk via RS232 (serial) or TCP/IP (ethernet) back to your development host.
>
> You can "simulate" the TCP environment quite easily using "local host" on
> your development host so you can more easily understand how this works. It
> can be confusing the first few times you do it.
>
> You can learn how to run "gdb server" on your development host, (aka: "local
> host"), and connect to the server using the GDB command: "target remote
> localhost:port" ... 90% of the battle is understanding how "gdbserver and
> target remote works" - doing that with "localhost" and a "development host
> program" is sometimes a little easier to understand and figure out.
>
> Only then - change "target remote localhost" to "target remote
> <ip-address-of-your-target-linux-board>".
>
First all, I have to appreciate your kind and detail help and sorry
for late replying this letter.
My cgdb is an application which combine curses (terminal-based)
interface to the GNU Debugger (GDB).
It is a more light weight process than ddd.
But your explanation is the answer of next question I want to ask :)
I intend to use cgdb instead of sde-insight to debug the program
running on the target board.
But I don't realize the whole story at all until reading your letter.
> ===========
> (B) is your target running standalone - no operating system, or something
> other then linux.
> ===========
>
> For example, you might be debugging "UBOOT" or some other FLASH MEMORY type
> device, perhaps like: 'contiki' or 'freertos' or 'ethernut'
>
> Some use JTAG to debug the Linux Kernel.
>
> In this case, 2 options:
>
> (a) A serial rom monitor that talks the GDB protocol (very rare these days,
> most people use jtag).
>
> (b) A JTAG dongle, and software for that jtag dongle that understands the
> GDB protocol.
>
> You'll need to *PURCHASE* a jtag dongle (or make one) - I highly recommend a
> "USB based ftdi-2232 based dongle", and *STRONGLY* do not recommend a
> "printer-port" solution.
>
> The "jtag dongle method" - is 80% identical to the GDBREMOTE example above -
> but is more complicated (20%) because you have to create an initialization
> script to setup your target board, program the cpu clocks, erase & program
> the flash memory, stuff like that.
>
> A *VERY* common JTAG solution (de-facto for ARM) is: "openocd" - see:
> http://openocd.berlios.de/web
>
> In the JTAG dongle case, GDB talks "target remote" to a
> GDB server program running on Linux, or Windows, or in some cases the DONGLE is really a tiny
> computer that talks the GDBSERVER protocol over Ethernet (the Zylin zy1000
> is an example, it actually runs OpenOCD inside).
from the case you mention above, there seems a gdbserver running on
the dongle not on the target board such that
when we send gdb protocol from host to the dongle, it can translate it
to the proper jtag instructions to handle the target board.
Is my assumption correct?
Thanks for your help,
miloody
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: how to debug mips or arm platform applications by cgdb
2009-07-19 14:16 ` loody
@ 2009-07-19 15:09 ` Duane Ellis
0 siblings, 0 replies; 4+ messages in thread
From: Duane Ellis @ 2009-07-19 15:09 UTC (permalink / raw)
To: loody; +Cc: gdb
loody wrote:
> Hi:
>
> 2009/6/7 Duane Ellis <duane@duaneellis.com>:
>
loody> Would someone tell me how to debug mips or arm applications by CGDB.
duane> You need to describe your target better.
[... snip ...]
[answer: Basically a standalone board, NO OS]
duane> ....
>> In this case, 2 options:
>>
>> (a) A serial rom monitor that talks the GDB protocol (very rare these days,
>> most people use jtag).
>>
>> (b) A JTAG dongle, and software for that jtag dongle that understands the
>> GDB protocol.
>>
>> You'll need to *PURCHASE* a jtag dongle (or make one) - I highly recommend a
>> "USB based ftdi-2232 based dongle", and *STRONGLY* do not recommend a
>> "printer-port" solution.
>>
>> The "jtag dongle method" - is 80% identical to the GDBREMOTE example above -
>> but is more complicated (20%) because you have to create an initialization
>> script to setup your target board, program the cpu clocks, erase & program
>> the flash memory, stuff like that.
>>
>> A *VERY* common JTAG solution (de-facto for ARM) is: "openocd" - see:
>> http://openocd.berlios.de/web
>>
>> In the JTAG dongle case, GDB talks "target remote" to a
>> GDB server program running on Linux, or Windows, or in some cases the DONGLE is really a tiny
>> computer that talks the GDBSERVER protocol over Ethernet (the Zylin zy1000
>> is an example, it actually runs OpenOCD inside).
>>
>
>
loody> ...
> from the case you mention above, there seems a gdbserver running on
> the dongle not on the target board such that
> when we send gdb protocol from host to the dongle, it can translate it
> to the proper jtag instructions to handle the target board.
>
> Is my assumption correct?
> Thanks for your help,
>
Yes, exactly. Some are standalone and self contained "dongles" - ie:
ZYLIN Z1000 (it has an Ethernet connector). Others are a cheap piece of
hardware (few chips) and the software runs on your PC under windoze, or
Linux (ie: OpenOCD is an example of that).
If the GDB server runs on the target (with no operating system present)
- it is most typically a ROM monitor of some sort. The problem with this
sort of platform is this: If your program goes off into the weeds - so
might your ROM monitors ability to respond to GDB requests. Example:
You are using a serial port to respond to GDB requests. If your program
*disables* interrupts and gets hung up, there will be no more serial
port interrupts. GDB will be ignored.
Another variant of this is a commercial product. In the past I used the
"ARM" version of the "EPI TOOLS" majic debugger. Which, is/was a
fantastic package with fantastic support. Today, they are owned by
Mentor. I have no experience since Mentor's acquisition, nor their MIPS
variant of their debuggers. My experience with Mentor though has always
been very positive.
http://www.mentor.com/products/embedded_software/majic-jtag-probe/
Another variant is offered by "Green Hills Software".
And another is Lauterbach software.
(They also often include/require use of their compiler and/or tools).
-Duane.
Be
^ permalink raw reply [flat|nested] 4+ messages in thread
* how to debug mips or arm platform applications by cgdb
@ 2009-06-06 5:51 loody
0 siblings, 0 replies; 4+ messages in thread
From: loody @ 2009-06-06 5:51 UTC (permalink / raw)
To: gdb
Dear all:
Would someone tell me how to debug mips or arm applications by CGDB.
I have cross-toolchain like arm-linux-gdb, but I have no idea how to
embed it with cgdb.
Should I recompile cgdb with arm-linux target or only replace the
build-in gdb with arm-linux-gdb?
thanks for your help,
miloody
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-07-19 15:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-06-06 23:36 how to debug mips or arm platform applications by cgdb Duane Ellis
2009-07-19 14:16 ` loody
2009-07-19 15:09 ` Duane Ellis
-- strict thread matches above, loose matches on Subject: below --
2009-06-06 5:51 loody
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox