GDB without OpenOCD

Started by Harald Kubota October 20, 2008
Hi,

Probably most of people here use JTAG to debug (ignoring people like me
who tend to use I/O like LEDs or text outputs to debug).

However GDB can use stubs running on the target to debug programs
running on it. I cannot find lot of information about those needed
stubs for LPC21xx though. I expected a small program to support the GDB
remote protocol (using serial I/O as there's no Ethernet on most LPC2xxx
CPUs). But either that does not exist, or no one uses it, or there is a
better way to debug.

Is JTAG the only way to go?

Harald

An Engineer's Guide to the LPC2100 Series

--- In l..., Harald Kubota wrote:

> Is JTAG the only way to go?

I've had great success with JTAG (you can connect to a JTAG server
with GDB and use GDB to control the debugging). However, it appears
to be possible for GDB to connect in other ways as well. Google for
"gdb remote stub" and you'll find tons of info about it. It looks
like you just need to implement 4-5 simple functions (well,
_relatively_ simple...they have to handle debugger stuff like setting
breakpoints and catching exceptions).

Hmmm, I need to get more comfortable dealing with ARM
exceptions...maybe I'll write a serial GDB stub...

d.
Harald Kubota wrote:

thirdshoedrops wrote:

> --- In l..., Harald Kubota wrote:
>
>
>
>> Is JTAG the only way to go?
>>
>>
> I've had great success with JTAG (you can connect to a JTAG server
> with GDB and use GDB to control the debugging). However, it appears
> to be possible for GDB to connect in other ways as well. Google for
> "gdb remote stub" and you'll find tons of info about it. It looks
> like you just need to implement 4-5 simple functions (well,
> _relatively_ simple...they have to handle debugger stuff like setting
> breakpoints and catching exceptions).
>
>

Back 20 years ago, I would have written such a stub for Z80 in no time.
On ARM this is a tad more complex, especially with Thumb code joining
the fun.
And while I think it's very reasonable to create a gdb remote stub for a
new CPU,
it requires a good understanding of the architecture of the CPU and the
serial port
subsystem. Consider me as having neither one. I'd probably need to use a
debugger
to debug the gdb remote stub code...Catch 22!

I'm surprised there is no ready-to-use implementation. ARM and GDB are
common enough to think this is a solved problem. However ARM did a good
job of making everyone have a simple standard JTAG interface, so there
never was a need for a stub.

Harald

Harald Kubota ha scritto:
>
> Hi,
>
> Probably most of people here use JTAG to debug (ignoring people like me
> who tend to use I/O like LEDs or text outputs to debug).
>
> However GDB can use stubs running on the target to debug programs
> running on it. I cannot find lot of information about those needed
> stubs for LPC21xx though. I expected a small program to support the GDB
> remote protocol (using serial I/O as there's no Ethernet on most LPC2xxx
> CPUs). But either that does not exist, or no one uses it, or there is a
> better way to debug.
>
> Is JTAG the only way to go?
>

Why don't using jtag? You may build or buy simple interfaces to connect
to your PC and they work very well with GDB.
>
> Harald
>
> Nessun virus nel messaggio in arrivo.
> Controllato da AVG - http://www.avg.com
> Versione: 8.0.173 / Database dei virus: 270.8.1/1733 - Data di rilascio: 19/10/2008 18.02
>
>