LPC2129 flash arm-usb-ocd [solved]

Hi,

I’ve problems in running/debugging my programs in flash.

Eclipse 3.2.0

OpenOCD USB 2006re100

GNU gdb 6.5.50.20060612-cvs

lpc2129

olimex arm-usb-ocd

olimex lpc2129 dev board revision B (!!!)

lpc2129_ARM_USB_OCD.cfg

#daemon configuration 
telnet_port 4444 
gdb_port 3333 
daemon_startup reset

#interface 
interface ft2232 
ft2232_device_desc "Olimex OpenOCD JTAG A" 
ft2232_layout "olimex-jtag" 
ft2232_vid_pid 0x15BA 0x0003 
jtag_speed 4


#use combined on interfaces or targets that can't set TRST/SRST separately 
reset_config trst_and_srst srst_pulls_trst 


#jtag scan chain 
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) 
#tets.... jtag_device 8 0x01 0x0e3 0xfe
jtag_device 4 0x1 0xf 0xe 
jtag_nsrst_delay 333
jtag_ntrst_delay 333


#target arm7tdmi <reset mode> <chainpos> <endianness> <variant> 
#target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
run_and_halt_time 0 300


#aus dem Linkerscript:
working_area 0 0x40000000 0x00004000 nobackup

#flash bank lpc2000 <base> <size> 0 0 <variant> <target#> <clock> ['calc_checksum']
#flash bank lpc2000 0x01ffff 0 0 0 lpc2000_v2 0 12000 calc_checksum
flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum

debug script commands

target remote localhost:3333
monitor arm7_9 sw_bkpts enable
load main.elf
symbol-file main.elf
thbreak main
continue

for RAM debugging everything works fine, but I don’t know how to place the code in the flash.

There seem to be two different ways, in both the working area should be changed (it’s not necessary, isn’t it) to

working_area 0 0 0x00004000 nobackup
  1. let the ocd do the job by adding one line to the cfg.
target_script 0 reset lpc2129_ARM_Flash.script

In the script I have to do something like

sleep 500
poll
flash probe 0
flash erase 0 0 0
flash write 0 c:\projects\test\main.bin 0x0
reset run
sleep 500

In my opinion I can leave the “debug script commands” like they were before.

Right?!

  1. leave the lpc2129_ARM_USB_OCD.cfg as it was and change the “debug script commands”… is there any documentation??

Can anyone post a working set of files/options, please?

Kind regards

Michael Sonst

Now using

#daemon configuration 
telnet_port 4444 
gdb_port 3333 
daemon_startup reset

#interface 
interface ft2232 
ft2232_device_desc "Olimex OpenOCD JTAG A" 
ft2232_layout "olimex-jtag" 
ft2232_vid_pid 0x15BA 0x0003 
jtag_speed 4


#use combined on interfaces or targets that can't set TRST/SRST separately 
reset_config trst_and_srst srst_pulls_trst 


#jtag scan chain 
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE) 
#tets.... jtag_device 8 0x01 0x0e3 0xfe
jtag_device 4 0x1 0xf 0xe 
jtag_nsrst_delay 333
jtag_ntrst_delay 333


#target arm7tdmi <reset mode> <chainpos> <endianness> <variant> 
#target arm7tdmi little run_and_halt 0 arm7tdmi-s_r4
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4
run_and_halt_time 0 300


#aus dem Linkerscript:
working_area 0 0x40000000 0x00004000 nobackup
#              base         size 
#

#flash bank lpc2000 <base> <size> 0 0 <variant> <target#> <clock> ['calc_checksum']
#flash bank lpc2000 0x01ffff 0 0 0 lpc2000_v2 0 12000 calc_checksum
flash bank lpc2000 0x0 0x40000 0 0 lpc2000_v1 0 14765 calc_checksum

#target_script 0 reset lpc2129_ARM_Flash.script




# For more information about the configuration files, take a look at: 
# http://openfacts.berlios.de/index-en.phtml?title=OpenOCD_configuration
target remote localhost:3333
monitor arm7_9 dcc_downloads enable
monitor wait_halt
monitor sleep 1000
monitor poll
monitor flash probe 0
monitor flash erase 0 0 10
monitor flash write 0 D:/projects/ARM/LPC2129/GPIO_Test/AppMain.bin 0x0
monitor reset
monitor sleep 1000
monitor poll
monitor soft_reset_halt
monitor arm7_9 force_hw_bkpts enable
symbol-file D:/projects/ARM/LPC2129/GPIO_Test/AppMain.elf
thbreak main
continue

Up to now I used arm-elf-insight.exe as GDB (!!) in the Debugger Options field. I have changed it to arm-elf-gdb.exe

It seems to be necessary to use direct paths (symbol-file D:/projects/ARM/LPC2129/GPIO_Test/AppMain.elf) in debuggerscript (don’t know why but without it don’t work)

I also increased the sleep values to 1000

Another problem I’ve faced with is that there are more than one version of scematic available!!! (and I took the wrong one of course to get the pin number for my button!!!)

Now it works, but time to time I get the following message

Execution is suspended because of error.
  Warning:
  Cannot insert breakpoint 0.
  Error accessing memory address 0x314: (undocumented errno -1).

If anyone knows something about that problem, please let me know.

Kind regards

Michael Sonst