Unable to connect to STM32 via ST-LINK after successful Arduino Blink upload

Just installed Atom+PlatformIO, configured my first arduino project with following settings:
[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = stlink

The code is simple Blink example. Successfully uploaded the code, but after that I am not able to connect to STM32. It says:
st-flash 1.3.1
2017-08-03T17:33:39 INFO src\common.c: Loading device parameters…
2017-08-03T17:33:39 WARN src\common.c: unknown chip id! 0xa05f0000
*** [upload] Error -1

St-link GUI is not able to connect also.
When I hit Reset on the board, I am able to connect via ST-LINK GUI, and able to clear the FLASH. After that I can use PlatformIO once again, and after that it locks chip communication again.
When I manually flash the same .bin - the same happens again - chip locks. So there is something inside the .bin file, blocking the communication. I found some explanation where the guy does not use Platformio, but says he found out CMSIS/HAL initialization blocks SWD communication. I feel like this is probably my case. But how to fix this?

P.S. I also tried the same Blink example through standard Arduino - and it flashes as many times as needed without blocking.

Please add this line build_flags = -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1 to platformio.ini:

platformio.ini

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = stlink
build_flags = -DCONFIG_MAPLE_MINI_NO_DISABLE_DEBUG=1