telnet good, gdb bad! [Now solved]

I’m trying to write a script to flash my LPC2119.

I use Linux with:

arm-elf-gcc (GCC) 4.0.2

arm-elf-gdb 6.4.0.20051202-cvs.

openocd Open On-Chip Debugger (2007-09-05 09:00 CEST)

Using telnet this command works fine:

flash erase 0 0 14

erased sectors 0 through 14 on flash bank 0 in 18s 560976us

but using gdb :

(gdb) monitor flash erase 0 0 14

results in:

Ignoring packet error, continuing…

Reply contains invalid hex digit 116

(note: 0x16 would be a SYN character, but 0x116 !?)

And the openocd server spews out masses of debug messages like:

Warning: gdb_server.c:255 gdb_get_packet(): acknowledgment received, but no packet pending

Debug: gdb_server.c:248 gdb_get_packet(): character: ‘+’

Warning: gdb_server.c:255 gdb_get_packet(): acknowledgment received, but no packet pending

Debugging with gdb manually or via eclipse doesn’t give problems; in fact it is remarkably good! So I’m surprised that this particular command causes problems.

Any kind soul care to enlighten me please?

[Edit] SOLVED!

Using

(gdb) set debug remote 1

showed that gdb was timing out because erase and write take longer than 2 seconds (gdb’s default timeout period).

The solution is to use :

(gdb) set remotetimeout 60

before erasing or flashing large blocks of memory[/Edit]