OpenOCD + Olymex ARM-USB-TINY-H + LPC2146

Hello everybody,

I am trying to upload and debug my code on a LPC2146 chip in an asctec board.

I have Olymex ARM-USB-TINY-H jtag interface (for OpenOCD and GDB).

I have installed OpenOCD 0.4.0, Eclipse CDT and yagarto and I am trying to debug using zylin native.

I followed the tutorial in yagarto (http://www.yagarto.de/howto/yagarto2/index.html) which is very useful, and the tutorial in olymex but the first is for sigger jtag interface and the second one does not explain everything.

When I run openOCD I got the same message showed in the olymex tutorial (this should mean that I got the communication with the jtag intarface) but I can not debug.

I run OpenOCD with the following config files (both provided by olymex):

-f /../olimex-arm-usb-tiny-h.cfg 
-f ../target/lpc2148.cfg

(my target is LPC2146 but I guess the config does not change since the only difference is the flash memory)

so far should be ok (at least according olymex tutorial)

When I debug I get these msgs:

target remote localhost:3333
0x00000000 in ?? ()
monitor sleep 500
monitor poll
background polling: on
TAP: lpc2148.cpu (enabled)
target state: running
monitor flash probe 0
flash 'lpc2000' found at 0x00000000
monitor flash erase 0 0 13
flash erase 0 0 13: command requires more arguments
in procedure 'flash' called at file "command.c", line 650
called at file "command.c", line 361
monitor flash write 0 main.bin 0x0
flash write 0 main.bin 0x0: command requires more arguments
in procedure 'flash' called at file "command.c", line 650
called at file "command.c", line 361
monitor reset run
JTAG tap: lpc2148.cpu tap/device found: 0x4f1f0f0f (mfg: 0x787, part: 0xf1f0, ver: 0x4)
NOTE! DCC downloads have not been enabled, defaulting to slow memory writes. Type 'help dcc'.
NOTE! Severe performance degradation without fast memory access enabled. Type 'help fast'.
monitor sleep 500
monitor soft_reset_halt
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0x00000000
symbol-file test_ram.elf
thbreak main
Hardware assisted breakpoint 1 at 0x40000320: file src/main.c, line 73.
continue

it does not look complety wrong but probably I miss some commands.

My Init commands are:

target remote localhost:3333
monitor sleep 500
monitor poll
monitor flash probe 0
monitor flash erase 0 0 13
monitor flash write 0 main.bin 0x0
monitor reset run
monitor sleep 500
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
symbol-file main.elf
thbreak main
continue

I am not using any run command.

Which exact GDB initialization commands should I use in my debug configuration?Should I use Run commands?

Any advice would be very appreciated!!

Thanks in advance.

I made a step ahead (I guess)!

I changed the command in:

Initialize commands:

target remote localhost:3333
monitor arm7_9 dcc_downloads enable
monitor arm7_9 fast_memory_access enable

Run command:

monitor arm7_9 dbgrq enable
monitor gdb_breakpoint_override hard
monitor soft_reset_halt
monitor flash write_bank 0  C:\\OpenOCD\\workspace\\TEST@\\test_ram.elf 0
thbreak main
continue

So now the output in the console is:

target remote localhost:3333
0x00000000 in ?? ()
monitor arm7_9 dcc_downloads enable
dcc downloads are enabled
monitor arm7_9 fast_memory_access enable
fast memory access is enabled
monitor arm7_9 dbgrq enable
use of EmbeddedICE dbgrq instead of breakpoint for target halt enabled
monitor gdb_breakpoint_override hard
force hard breakpoints
monitor soft_reset_halt
requesting target halt and executing a soft reset
target state: halted
target halted in ARM state due to debug-request, current mode: Supervisor
cpsr: 0x000000d3 pc: 0x00000000
monitor flash write_bank 0  C:\\OpenOCD\\workspace\\TEST@\\test_ram.elf 0
Verification will fail since checksum in image (0x00000001) to be written to flash is different from calculated vector checksum (0x998ab90a).
To remove this warning modify build tools on developer PC to inject correct LPC vector checksum.
wrote 45566 bytes from file C:\OpenOCD\workspace\TEST@\test_ram.elf to flash bank 0 at offset 0x00000000 in 1.062000s (41.900 kb/s)
thbreak main
Hardware assisted breakpoint 1 at 0x40000320: file src/main.c, line 73.
continue

There is only one warning, and according to the console my .elf file was written in to the flash (but this not seems actually true) but I cannot still debug. Furthermore after it asking me about the source file (main.c) everything looks like stuck (the arrows for the debugging are not marked but is strange because before choosing the source file they were!). I am going crazy…Please help me.

Thanks.