Programming LPC-P2148 with OpenOCD 0.4.0

Hello users of OpenOCD:

I’m having problems trying to program my LPC-P2148 development board.

I have a ARM-USB-OCD and I’ve installed the latest drivers for OpenOCD 0.4.0 onto my windows7 system.

from a cmd window I executed the following command:

…\OpenOCD\0.4.0>.\bin\openocd.exe -f interface\olimex-arm-usb-ocd.cfg -f board\olimex_lpc_h2148.cfg

It appears that the OpenOCD is starting correctly. I then from another cmd window telnet to 4444 and I started to issue the commands I believe should allow me to flash my lpc2148, but I get an error with the flash erase command.

-------snippet from my telnet cmd window -----

Open On-Chip Debugger

halt

target state: halted

target halted in Thumb state due to debug-request, current mode: System

cpsr: 0x8000003f pc: 0x000004ee

arm7_9 dcc_downloads enable

dcc downloads are enabled

mdh 0x0 100

0x00000000: f018 e59f 0000 0000 0000 0000 0000 0000 0000 0000 2fb8 4f20 f018 e59

f f018 e59f

0x00000020: 007c 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 0000 014c 000

0 017c 0000

0x00000040: 2001 4770 b530 4c0b 4d0b b081 42ac d306 b001 bc30 bc01 4700 f000 fe7

2 340c 42ac

0x00000060: d2f6 6860 68a1 6822 4281 d1f5 2100 f000 fe75 e7f3 0ecc 0000 0ee4 000

0 0000 e10f

0x00000080: 001f e3c0 0012 e380 f000 e121 d014 e59f 001f e3c0 001f e380 f000 e12

1 d008 e59f

0x000000a0: 0008 e59f ff10 e12f 2b68 4000 2658 4000 00b4 0000 c001 e28f ff1c e12

f 4c04 4d05

0x000000c0: 4e05 4f06 46ae 4720

flash erase 0 0 26

flash erase 0 0 26: command requires more arguments

in procedure ‘flash’ called at file “command.c”, line 650

called at file “command.c”, line 361

poll

background polling: on

TAP: lpc2148.cpu (enabled)

target state: halted

target halted in Thumb state due to debug-request, current mode: System

cpsr: 0x8000003f pc: 0x000004ee

sleep 10

poll

background polling: on

TAP: lpc2148.cpu (enabled)

target state: halted

target halted in Thumb state due to debug-request, current mode: System

cpsr: 0x8000003f pc: 0x000004ee

flash probe 0

flash ‘lpc2000’ found at 0x00000000

flash erase 0 0 26

flash erase 0 0 26: command requires more arguments

in procedure ‘flash’ called at file “command.c”, line 650

called at file “command.c”, line 361

I got the syntax for the commands to run to program my part from the following script file:

------ooc_flash_lpc2148.script ---------------------

The following commands will be executed on

reset (because of run_and_init in the config-file)

- wait for target halt

- erase memory

- flash content of file main.bin into target-memory

- shutdown openocd

created by Martin Thomas

http://www.siwawi.arubi.uni-kl.de/avr_p … m_projects

based on information from Dominic Rath

halt

arm7_9 dcc_downloads enable

wait_halt

sleep 10

poll

mdh 0x0 100

flash probe 0

erase first bank only:

flash erase 0 0 26

mdh 0x0 100

#flash write 0 scripts/lpc2148_freertos.bin 0x0

flash write 0 scripts/main.bin 0x0

mdh 0x0 100

reset run

sleep 10

#shutdown

Can anyone provide me with a link on steps to follow or directions on what I am doing wrong?

Thanks

After further digging, I found the answer:

I seems that the scripts I was coping from was using an older version of OpenOCD. The newer version 0.4.0 has the following commands deprecated:

flash erase & flash write

They should each be changed to:

flash erase_sector 0 0 26

and

flash write_bank 0 scripts/main.bin 0x0

I guess this is a good example of RTFM.