STLINK & BluePill: Upload Problem


Hello everyone,

I just tried using Platformio with the Code::Blocks IDE following the steps in the documentation. I set up a small example Project for the STM32F103C8T6 aka. “BluePill” board using only CMSIS as framework and STLINK as upload protocol. I have the BluePill board connected to an STLINK via SWD. When I build and upload my code (a simple LED blinker), the Platformio script says everything was successfull:

Processing bluepill_f103c8 (board: bluepill_f103c8; framework: cmsis; platform: ststm32)

Verbose mode can be enabled via -v, --verbose option
PLATFORM: ST STM32 > BluePill F103C8
HARDWARE: STM32F103C8T6 72MHz 20KB RAM (64KB Flash)
DEBUG: CURRENT(stlink) EXTERNAL(blackmagic, jlink, stlink)
Library Dependency Finder -> httpx://
Collected 0 compatible libraries
Scanning dependencies…
No dependencies
Checking size .pioenvs/bluepill_f103c8/firmware.elf
Memory Usage ->
DATA: [ ] 0.0% (used 8 bytes from 20480 bytes)
PROGRAM: [ ] 1.0% (used 626 bytes from 65536 bytes)
Configuring upload protocol…
AVAILABLE: blackmagic, dfu, jlink, mbed, stlink
CURRENT: upload_protocol = stlink
Uploading .pioenvs/bluepill_f103c8/firmware.elf
GNU MCU Eclipse 64-bits Open On-Chip Debugger 0.10.0+dev-00392-gbe9ef0b0 (2018-01-12-14:56)
Licensed under GNU GPL v2
For bug reports, read
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v21 API v2 SWIM v5 VID 0x0483 PID 0x374B
Info : using stlink api v2
Info : Target voltage: 3.211002
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x08000228 msp: 0x20005000
** Programming Started **
auto erase enabled
Info : device id = 0x20036410
Info : flash size = 128kbytes
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20005000
wrote 1024 bytes from file .pioenvs/bluepill_f103c8/firmware.elf in 0.420990s (2.375 KiB/s)
** Programming Finished **
** Verify Started **
target halted due to breakpoint, current mode: Thread
xPSR: 0x61000000 pc: 0x2000002e msp: 0x20005000
verified 626 bytes in 0.368001s (1.661 KiB/s)
** Verified OK **
** Resetting Target **
shutdown command invoked
========================= [SUCCESS] Took 1.91 seconds =========================

Process returned 0 (0x0) execution time : 2.150 s
Press ENTER to continue.

But in reality the upload apparently didn’t work, because the LED doesn’t blink. I tried manually resetting the µC, but it didn’t help.
My example program works fine when I upload it via the SW4STM32 IDE (which I was using before trying out Platformio).
I also noticed that in the project’s /.pioenvs/ directory, there is only an firmware.elf binary but no .bin binary, but I dont know if that is the problem…
Does someone have an idea where the problem could be?


Please show the code you’re running. You must have PC_13 on the board as your LED I guess? Did you previously confirm this?

Also how did you place the BOOT0 and BOOT1 pins? Maybe you have to jumper them correctly or it will never leave the bootloader mode.


Thanks for your response!
As I said, I just copy & pasted the code from a project written in the SW4STM32 IDE, and if I compile and upload it from there it works just fine, so the problem can’t be in my program code.

I also didn’t change the BOOT pins config (it is 00 ), since I don’t use any bootloader. I am programming the MCU using an STLINK from a Discovery(Nucleo)-Board.

Really, the only thing I changed is that I used the Plaformio Tool instead of the SW4STM32 IDE to compile & upload.

Could it be, that platformio implicitly flashes an arduino-style bootloader? But I set framework=cmsis it the project settings since I am programming “bare metal” …

As I have written, I am also wondering why there is no .bin file in the /.pioenvs/ directory, I thought that that’s what gets written to the MCU (but I might be mistaken).