If you run into weird issues flashing your board, it might be because the board is locked.
While pressing the boot button or shorting the boot pads, open OpenOCD, connect the SWD port and run:
> stm32f2x unlock 0
stm32f2x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
> reset halt
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x1ff00c88 msp: 0x20003af8
> stm32f1x unlock 0
stm32f1x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
> reset halt
Now try to debug or flash again.
Download and install: http://www.st.com/en/embedded-software/stsw-link004.html
Open the app, connect the board and reset the Option Bytes