ARM-USB-OCD + OpenOCD + IAR troubles

Hello, Guys!

I use Olimex ARM-USB-OCD device + OpenOCD + IAR to debug my project based NXP LPC1759. I performed all instructions of “Manual_IAR.pdf” document, but debug is not work. When I press “Download and debug” GDB server show a lot of errors and warnings as showed below.

Error: JTAG-DP STICKY ERROR 
Error: MEM_AP_CSW 0x23000042, MEM_AP_TAR 0xe000edf0
...
Block write error

the target is not running when halt was requested stopping gdb

This leads to bad code downloading and not starting from “main”.

When I use Eclipse, I run program with follow commands for debugger (“Run commands”):

target remote localhost:3333
symbol-file xxx_flash.elf
monitor reset
monitor sleep 500
monitor soft_reset_halt
monitor flash erase_sector 0 0 29
monitor flash write_image .\\xxx_flash.hex 0x00
thbreak main
cont

and it work fine.

I know that OpenOCD 0.4.0 has first debug session bug, but running OpenOCD 0.6.1 not fix this problem.

Please tell me how I must configure my IAR project to debug perform fine.