I've got an issue regarding starting demo project by using chibistudio preview 5. Once I've build the ARMCM4-STM32F407-DISCOVERY project, started the openocd with stm32f4discovery.cfg, ran the debug and here's what i got:
Open On-Chip Debugger 0.7.0 (2013-05-05-10:41)
Licensed under GNU GPL v2
For bug reports, read
http://openocd.sourceforge.net/doc/doxygen/bugs.html
Warn : Interface already configured, ignoring
Error: already specified hl_layout stlink
srst_only separate srst_nogate srst_open_drain connect_deassert_srst
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v14 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : Target voltage: 2.886772
Info : stm32f4x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'gdb' connection from 3333
Info : device id = 0x10016413
Info : flash size = 1024kbytes
Warn : acknowledgment received, but no packet pending
undefined debug reason 6 - target needs reset
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Info : Padding image section 0 with 8 bytes
Error: timeout waiting for algorithm, a target reset is recommended
Error: error executing stm32x flash write algorithm
Error: flash write failed = 00000040
Error: error writing to flash at address 0x08000000 at offset 0x00000000
Warn : The target is not in the halted nor running stated, stepi/continue ignored.
Warn : target not halted
Warn : target not halted
Warn : target not halted
Error: address + size wrapped(0xfffffffe, 0x00000004)
Error: address + size wrapped(0xfffffffe, 0x00000004)
Info : rejected 'gdb' connection, no more connections allowed
Info : dropped 'gdb' connection
Info : accepting 'gdb' connection from 3333
Warn : acknowledgment received, but no packet pending
target state: halted
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc
Error: address + size wrapped(0xfffffffe, 0x00000004)
Error: address + size wrapped(0xfffffffe, 0x00000004)
Info : Padding image section 0 with 8 bytes
Error: Target is already running an algorithm
Error: error starting target flash write algorithm
Error: error writing to flash at address 0x08000000 at offset 0x00000000
Error: jtag status contains invalid mode value - communication failure
Polling target stm32f4x.cpu failed, GDB will be halted. Polling again in 100ms
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Error: JTAG failure -4
Polling target stm32f4x.cpu succeeded again
Any ideas what might go wrong? Flash is ofc clean as should.