LPC1756 flash upload cfg file help

Eclipse Helios + OpenOCD. Could use some assistance with generating the cfg files to upload to the flash in this device.

I’ve got 3 config files in my call to openocd.exe:

openocd.exe -f interface/arm-usb-ocd.cfg -f target/lpc1756.cfg -f upload/uploadFirmware.cfg

My lpc1756 using the lpc1768.cfg as a template but I don’t know if it’s correct:

# NXP LPC1756 Cortex-M3 with 256kB Flash and 32kB SRAM
# LPC17xx chips support both JTAG and SWD transports.
# Adapt based on what transport is active.
source [find swj-dp.tcl]

if { [info exists CHIPNAME] } {
	set  _CHIPNAME $CHIPNAME
} else {
	set  _CHIPNAME lpc1756
}

# After reset the chip is clocked by the ~4MHz internal RC oscillator.
# When board-specific code (reset-init handler or device firmware)
# configures another oscillator and/or PLL0, set CCLK to match; if
# you don't, then flash erase and write operations may misbehave.
# (The ROM code doing those updates cares about core clock speed...)
#
# CCLK is the core clock frequency in KHz
if { [info exists CCLK ] } {
	set _CCLK $CCLK
} else {
	set _CCLK 4000
}
if { [info exists CPUTAPID ] } {
	set _CPUTAPID $CPUTAPID
} else {
	set _CPUTAPID 0x4ba00477
}

#delays on reset lines
adapter_nsrst_delay 200
jtag_ntrst_delay 200

#jtag newtap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID
swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME cortex_m3 -chain-position $_TARGETNAME

# LPC1756 has 32kB of SRAM
$_TARGETNAME configure -work-area-phys 0x10000000 -work-area-size 0x8000

# LPC1756 has 256kB of flash memory, managed by ROM code (including a
# boot loader which verifies the flash exception table's checksum).
# flash bank <name> lpc2000 <base> <size> 0 0 <target#> <variant> <clock> [calc checksum]
set _FLASHNAME $_CHIPNAME.flash
flash bank $_FLASHNAME lpc2000 0x0 0x40000 0 0 $_TARGETNAME \
	lpc1700 $_CCLK calc_checksum

# Run with *real slow* clock by default since the
# boot rom could have been playing with the PLL, so
# we have no idea what clock the target is running at.
jtag_khz 10

$_TARGETNAME configure -event reset-init {
	# Do not remap 0x0000-0x0020 to anything but the flash (i.e. select
	# "User Flash Mode" where interrupt vectors are _not_ remapped,
	# and reside in flash instead).
	#
	# See Table 612. Memory Mapping Control register (MEMMAP - 0x400F C040) bit description
	# Bit Symbol Value Description Reset
	# value
	# 0 MAP Memory map control. 0
	# 0 Boot mode. A portion of the Boot ROM is mapped to address 0.
	# 1 User mode. The on-chip Flash memory is mapped to address 0.
	# 31:1 - Reserved. The value read from a reserved bit is not defined. NA
	#
	# http://ics.nxp.com/support/documents/microcontrollers/?scope=LPC1768&type=user

	mww 0x400FC040 0x01
}

When I attempt to run this “external tool” I get a number of errors. For instance, in relation to the “source [find swj-dp.tcl]” and “swj_newdap $_CHIPNAME cpu -irlen 4 -expected-id $_CPUTAPID” lines I get the error:

...
Error: 19 13 transport.c:288 jim_transport_select(): session's transport is not selected.
User : 20 13 command.c:679 command_run_line(): Runtime Error: embedded:startup.tcl:20: 
in procedure 'script' 
at file "embedded:startup.tcl", line 58
in procedure 'swj_newdap' called at file "C:\ ... \workspace\ ... \openocd\cfg\lpc1756.cfg", line 38
in procedure 'transport' called at file "swj-dp.tcl", line 22
in procedure 'ocd_bouncer' 
at file "embedded:startup.tcl", line 20

If I comment those lines out momentarily I also get an error on the line “target create $_TARGETNAME cortex_m3 -chain-position $_TARGETNAME”:

Debug: 17 24 command.c:151 script_debug(): command - ocd_target ocd_target create lpc1756.cpu cortex_m3 -chain-position lpc1756.cpu
Error: 18 25 command.c:1430 parse_ulong(): Invalid command argument
User : 19 25 command.c:679 command_run_line(): Runtime Error: embedded:startup.tcl:20: -chain-position required when creating target
in procedure 'script' 
at file "embedded:startup.tcl", line 58
in procedure 'target' called at file "C:\ ... \workspace\ ... \openocd\cfg\lpc1756.cfg", line 41
in procedure 'ocd_bouncer' 
at file "embedded:startup.tcl", line 20

I’d like to get these (and whatever other) errors may exist before getting to my “uploadFirmware.cfg” file that looks like this:

#define our ports
telnet_port 4444
gdb_port 3333

#commands specific to the Olimex ARM-USB-OCD
interface ft2232
ft2232_device_desc "Olimex OpenOCD JTAG A"
ft2232_layout "olimex-jtag"
ft2232_vid_pid 0x15BA 0x0003

#flash auto_erase on
gdb_flash_program enable

init

fast enable
jtag_khz 500

flash write_image erase "..\..\output\<insert file name here>.hex"
sleep 100
verify_image "..\..\output\<insert file name here>.hex"
sleep 100

Any assistance would be greatly appreciated…