Monday, June 2, 2008

openocd config for LPC2294 that worked for me...

#daemon configuration
telnet_port 4444
gdb_port 3333

#interface
interface ft2232
ft2232_device_desc "Amontec JTAGkey A"
ft2232_layout jtagkey
ft2232_vid_pid 0x0403 0xcff8
jtag_speed 3
jtag_nsrst_delay 200

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

#jtag scan chain
#format L IRC IRCM IDCODE (Length, IR Capture, IR Capture Mask, IDCODE)
jtag_device 4 0x1 0xf 0xe


#target configuration
daemon_startup reset

#target arm7tdmi
target arm7tdmi little run_and_init 0 arm7tdmi-s_r4

# run_and_halt_time
run_and_halt_time 0 1000

# commands below are specific to arm7tdmi Flash Programming
# −−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

#target_script specifies the flash programming script file
target_script 0 reset openocd_lpc2294_flash.sh

#working_area <'backup'|'nobackup'>
working_area 0 0x40000000 0x2000 nobackup

#flash configuration
#flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 0 14765 calc_checksum
flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 10000 calc_checksum

Flash write script (openocd_lpc2294_flash.sh):

arm7_9 dcc_downloads enable
wait_halt
sleep 10
poll
flash probe 0

# erase first bank only:
flash erase_sector 0 0 0
#load_binary main.bin 0x0
flash write_image main.bin 0x0
poll
sleep 10
reset run
sleep 10
shutdown
resume

Using the flash write_image did the trick for me. I read it in some post that when you use flash write_image then the calc_checksum in the

flash bank lpc2000 0x0 0x40000 0 0 0 lpc2000_v1 0 10000 calc_checksum

works.
If not programmed with calc_checksum enable, a valid crc wouldn't be put in the exception vector table and the program would not get pass the bootloader.