Debuging lpc2138 with GNU-arm-gdb

Started by soren_t_hansen April 14, 2005

I'm trying to establish a development enviroment to a lpc2138 on the
Keil MCB2130 evaluation board. I'm using Eclipse and would like to
debug my program using the GNU-arm-gdb. To connect to the board I'm
using the Raven OCDemon from Macraigor and their program OCDRemote to
interface between JTAG and GDB. But so far I'm having some problems.

At first it seemed to work okay using gdb from a shell. But when
running in Eclipse it was only possible to pause and resume the
program. I tried to erase the flash since the program was also present
there, due to earlier tests. But now my program (linked for RAM) will
not run at all unless I step my way trough. If I try to "go" the
program counter (PC) jumps to address 0x7fffd2a2 and keeps looping
there forever.

I can't seem to grasp if it something in my program or maybe my
linking script that's wrong. Or maybe it's the Raven/ocdRemote/GDB
combo that causes the problem. Anyone have had this problem?

Has anyone tried debuging in Eclipse through JTAG?

Best Regards
Sen Hansen



An Engineer's Guide to the LPC2100 Series


After having worked some more with the problem, I susbect the problem
to come from the startup.s file. The one I use, comes from an example
for a LPC2129, and maybe the memory layout is a little different on
the LPC2138.

Does anyone have a startup.s for the lpc2138?

Best Regards
Sen Hansen

--- In lpc2000@lpc2..., "soren_t_hansen" <soren_t_hansen@y...>
wrote:
>
> I'm trying to establish a development enviroment to a lpc2138 on the
> Keil MCB2130 evaluation board. I'm using Eclipse and would like to
> debug my program using the GNU-arm-gdb. To connect to the board I'm
> using the Raven OCDemon from Macraigor and their program OCDRemote to
> interface between JTAG and GDB. But so far I'm having some problems.
>
> At first it seemed to work okay using gdb from a shell. But when
> running in Eclipse it was only possible to pause and resume the
> program. I tried to erase the flash since the program was also present
> there, due to earlier tests. But now my program (linked for RAM) will
> not run at all unless I step my way trough. If I try to "go" the
> program counter (PC) jumps to address 0x7fffd2a2 and keeps looping
> there forever.
>
> I can't seem to grasp if it something in my program or maybe my
> linking script that's wrong. Or maybe it's the Raven/ocdRemote/GDB
> combo that causes the problem. Anyone have had this problem?
>
> Has anyone tried debuging in Eclipse through JTAG?
>
> Best Regards
> Sen Hansen



> At first it seemed to work okay using gdb from a shell. But when
> running in Eclipse it was only possible to pause and resume the
> program. I tried to erase the flash since the program was also present
> there, due to earlier tests. But now my program (linked for RAM) will
> not run at all unless I step my way trough. If I try to "go" the
> program counter (PC) jumps to address 0x7fffd2a2 and keeps looping
> there forever.

Check your linker-script if you do not set the vectors to zero.
I thing gdb starts execution at zero, but you did not program the MEMMAP to
map the internal RAM to 0 (the vectors).

So after connecting, the gdb should issue at least this command before
downloading
your code.

--
42Bastian Schick




--- In lpc2000@lpc2..., "soren_t_hansen" <soren_t_hansen@y...>
wrote:
>..
> not run at all unless I step my way trough. If I try to "go" the
> program counter (PC) jumps to address 0x7fffd2a2 and keeps looping
> there forever.
>..
> Best Regards
> Sen Hansen


that's because you're in the Bootloader.. you had to program MEMMAP to
0x00000002.
you should have a look at "The Insider's Guide To The Philips ARM7-
Based Microcontrollers" book (page 51) from Hitex.
there's a free download here :
http://www.hitex.co.uk/arm/lpc2000book/



--- In lpc2000@lpc2..., "valdef78" <valdef@s...> wrote:
>
> --- In lpc2000@lpc2..., "soren_t_hansen" <soren_t_hansen@y...>
> wrote:
> >..
> > not run at all unless I step my way trough. If I try to "go" the
> > program counter (PC) jumps to address 0x7fffd2a2 and keeps looping
> > there forever.
> >..
> > Best Regards
> > Sen Hansen > that's because you're in the Bootloader.. you had to program MEMMAP to
> 0x00000002.
> you should have a look at "The Insider's Guide To The Philips ARM7-
> Based Microcontrollers" book (page 51) from Hitex.
> there's a free download here :
> http://www.hitex.co.uk/arm/lpc2000book/

Will this help me getting the Program Counter (PC) to work right? It
seems as if it gets stuck in the bootloader (sometimes around
0x00000240 and sometimes around 0x7fffd2a2) and newer jumps to address
0x40000000 in the RAM where the program is situated when debugging
from Eclipse.

When debugging from uVision (Keil IDE) the program uses a ini file
telling the PC that startup is at 0x40000000. How do I tell this to
GDB when calling it from Eclipse? Is it through the linker file or as
a command line option?

If it at any help, I could upload the linker file.

Best Regards
Sen Hansen