Programming STM32 with Olimex ARM-USB-OCD fails (No Errors)

Hello,

I’m new to the world of OpenOCD, but I am trying to get it set up to do my production programming in a sense.

I installed the latest version (4.0) onto my Windows XP 32 bit PC, and I installed the correct driver for the Olimex JTAG programmer as well. I added the following function to the top of the STM32.cfg file:

proc program_device () {
	#Halt the processor
	halt
	wait_halt

	#Write the file to flash memory
	#arm7_9 dcc_downloads enable
	sleep 10
	poll
	flash probe 0

	#Write the bootloader to the mirco (Location of 0x08000000)
	flash write_image erase "BOOT.BIN" 0x08000000
	sleep 10

	#Write the main application to the micro (Location of 0x08004000)
	flash write_image "APP.BIN" 0x08004000
	sleep 10

	#Start execution of the program just downloaded
	#reset run
	sleep 10

	#Exit OpenOCD
	shutdown
}

and at the bottom of the file I added:

init
reset init
program_device ()

When I run the openocd.exe -f arm-usb-ocd.cfg -f stm32.cfg I get the following output:

Open On-Chip Debugger 0.4.0 (2010-02-22-19:05)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.berlios.de/doc/doxygen/bugs.html
1000 kHz
jtag_nsrst_delay: 100
jtag_ntrst_delay: 100
Info : clock speed 1000 kHz
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba0
0, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x06418041 (mfg: 0x020, part: 0x6418
, ver: 0x0)
Info : stm32.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : JTAG tap: stm32.cpu tap/device found: 0x3ba00477 (mfg: 0x23b, part: 0xba0
0, ver: 0x3)
Info : JTAG tap: stm32.bs tap/device found: 0x06418041 (mfg: 0x020, part: 0x6418
, ver: 0x0)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
background polling: on
TAP: stm32.cpu (enabled)
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Info : device id = 0x10016418
Info : flash size = 128kbytes
flash 'stm32x' found at 0x08000000
auto erase enabled
Warn : not enough working area available(requested 16384, free 16336)
wrote 14336 bytes from file BOOT.BIN in 1.625000s (8.615 kb/s)
auto erase enabled
Warn : not enough working area available(requested 16384, free 8144)
wrote 34816 bytes from file APP.BIN in 3.953125s (8.601 kb/s)
shutdown command invoked

I’m not sure why it doesn’t work, everything appearsto be ok, but the board is dead. I know the program is tested and works, so I think it’s something in this process that I don’t quite understnand.

Any help would be appreciated!!

Thanks,

B