Blue Pill Programmed via DFU from PlatformIO

Generic Blue Pill CS32F103C8T6

I finally managed to program the Blue Pill board directly using the on-board micro USB connector, using DFU upload protocol, from PlatformIO.

Previously, when I click the upload button on PlatformIO, I was presented with the following error:

No DFU capable USB device found
Filter on vendor = 0x1eaf product = 0x0003

Now, my understanding is that the 1eaf:0003 vendor and product ID, from Roger Clark’s bootloader, only active for a short time, probably only one second, to wait for a new programming command from the computer. After that, if no programming command is detected, the bootloader will change the vendor and product ID to 0483:5740, which is STMicroelectronics Virtual COM Port. The purpose is to enable serial communication with the computer using the USB port, so the computer is able to send/receive serial communications such as Serial.println statements.

With Arduino IDE, during upload there will be a message to manually reset the Blue Pill, which means I need to press the reset button on the board so the vendor and product ID changes back to 1eaf:0003, so the board will be able to receive new programming command. Strangely PlatformIO did not do something like that.

According to this thread at PlatformIO Community, that was probably because I was using the wrong env or board. Previously my platform.ini was like this:

[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = arduino
upload_protocol = dfu

After reading that thread, I modified it to this:

[env:bluepill_f103c8_128k]
platform = ststm32
board = bluepill_f103c8_128k
framework = arduino
upload_protocol = dfu

I clicked the upload button again, and a new error appeared:

platformio upload-reset: No such file or directory

So I browsed the web again, and found this thread at PlatformIO Community. Apparently the upload-reset utility is 32-bit executable. Since my OS is 64-bit, this is a problem. According to user pfeerick, Ubuntu is missing 32-bit libraries. User pfeerick presented two solution there, I choose option number two, to compile the upload-reset utility as 64-bit executable. So I backed-up the 32-bit upload-reset, compiled the 64-bit executable, and tested it:

joshua@joshua-t530:~$ cd ~/.platformio/packages/tool-stm32duino
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino$ mv upload-reset upload-reset-32
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino$ cd src/upload-reset
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino/src/upload-reset$ gcc -o ../../upload-reset upload-reset.c
upload-reset.c:121:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
 121 | main(int argc, char *argv[])
     | ^~~~
upload-reset.c: In function ‘main’:
upload-reset.c:127:3: warning: ‘return’ with no value, in function returning non-void
 127 | return;
     | ^~~~~~
upload-reset.c:121:1: note: declared here
 121 | main(int argc, char *argv[])
     | ^~~~
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino/src/upload-reset$ cd ../..
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino$ ls -Flah upload-reset*
-rwxrwxr-x 1 joshua joshua  18K Mei 24 15:34 upload-reset*
-rwxr-xr-x 1 joshua joshua 7,8K Des  2  2018 upload-reset-32*
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino$ file upload-reset
upload-reset: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=e5e26198184684180439e9ec8ef804d70a460caf, for GNU/Linux 3.2.0, not stripped
joshua@joshua-t530:~/.platformio/packages/tool-stm32duino$ ./upload-reset
Usage upload-reset <serial_device> <Optional_delay_in_milliseconds>

So with that I have confirmed that the 64-bit executable for upload-reset has been compiled and ready to use. So I clicked the upload button again. The result:

> Executing task in folder STM32Test: platformio run --target upload <
Processing bluepill_f103c8_128k (platform: ststm32; board: bluepill_f103c8_128k; framework: arduino)
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/bluepill_f103c8_128k.html
PLATFORM: ST STM32 6.1.0 > BluePill F103C8 (128k)
HARDWARE: STM32F103C8T6 72MHz, 20KB RAM, 128KB Flash
DEBUG: Current (stlink) External (blackmagic, jlink, stlink)
PACKAGES:
 - framework-arduinoststm32 4.10800.200207 (1.8.0)
 - tool-dfuutil 1.9.200310
 - tool-openocd 2.1000.190707 (10.0)
 - tool-stm32duino 1.0.1
 - toolchain-gccarmnoneeabi 1.90201.191206 (9.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 15 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduinoVariant/PeripheralPins.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduinoVariant/variant.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/HardwareTimer.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/Print.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/RingBuffer.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/Tone.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/USBSerial.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/WInterrupts.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/WSerial.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/WString.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/abi.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/avr/dtostrf.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/board.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/hooks.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/itoa.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/main.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/new.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/pins_arduino.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/startup_stm32yyxx.S.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/cdc/cdc_queue.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/cdc/usbd_cdc.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/cdc/usbd_cdc_if.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/hid/usbd_hid_composite.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/hid/usbd_hid_composite_if.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usb_device_core.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usb_device_ctlreq.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usb_device_ioreq.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usbd_conf.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usbd_desc.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usbd_ep_conf.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/stm32/usb/usbd_if.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/wiring_analog.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/wiring_digital.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/wiring_pulse.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/wiring_shift.c.o
Compiling .pio/build/bluepill_f103c8_128k/FrameworkArduino/wiring_time.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_adc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_adc_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_can.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_cec.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_comp.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_comp_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_cordic.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_cortex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_crc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_crc_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_cryp.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_cryp_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dac.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dac_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dcmi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dcmi_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dfsdm.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dfsdm_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dma.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dma2d.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dma_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_dsi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_eth.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_eth_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_exti.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_fdcan.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_firewall.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_flash.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_flash_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_flash_ramfunc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_fmac.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_fmpi2c.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_fmpi2c_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_gfxmmu.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_gpio.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_gpio_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_hash.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_hash_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_hcd.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_hrtim.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_hsem.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_i2c.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_i2c_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_i2s.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_i2s_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_ipcc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_irda.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_iwdg.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_jpeg.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_lcd.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_lptim.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_ltdc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_ltdc_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_mdios.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_mdma.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_mmc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_mmc_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_msp_template.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_nand.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_nor.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_opamp.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_opamp_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_ospi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_pccard.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_pcd.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_pcd_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_pka.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_pwr.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_pwr_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_qspi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_ramecc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_rcc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_rcc_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_rng.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_rtc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_rtc_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sai.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sai_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sd.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sd_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sdadc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sdram.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_smartcard.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_smartcard_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_smbus.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_spdifrx.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_spi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_spi_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_sram.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_swpmi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_tim.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_tim_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_timebase_rtc_alarm_template.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_timebase_rtc_wakeup_template.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_timebase_tim_template.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_tsc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_uart.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_uart_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_usart.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_usart_ex.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/HAL/stm32yyxx_hal_wwdg.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_adc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_bdma.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_comp.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_cordic.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_crc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_crs.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_dac.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_delayblock.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_dma.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_dma2d.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_exti.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_fmac.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_fmc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_fsmc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_gpio.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_hrtim.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_i2c.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_lptim.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_lpuart.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_mdma.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_opamp.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_pka.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_pwr.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_rcc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_rng.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_rtc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_sdmmc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_spi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_swpmi.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_tim.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_ucpd.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_usart.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_usb.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/LL/stm32yyxx_ll_utils.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/PortNames.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/analog.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/bootloader.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/clock.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/core_callback.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/dwt.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/hw_config.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/interrupt.cpp.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/lock_resource.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/low_power.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/pinmap.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/rtc.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/stm32_def.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/stm32_eeprom.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/system_stm32yyxx.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/timer.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/stm32/uart.c.o
Compiling .pio/build/bluepill_f103c8_128k/SrcWrapper/src/syscalls.c.o
Compiling .pio/build/bluepill_f103c8_128k/src/main.cpp.o
Linking .pio/build/bluepill_f103c8_128k/firmware.elf
Checking size .pio/build/bluepill_f103c8_128k/firmware.elf
Building .pio/build/bluepill_f103c8_128k/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ] 4.1% (used 844 bytes from 20480 bytes)
Flash: [=         ] 7.4% (used 9664 bytes from 131072 bytes)
Configuring upload protocol...
AVAILABLE: blackmagic, dfu, jlink, stlink
CURRENT: upload_protocol = dfu
Looking for upload port...
Auto-detected: /dev/ttyACM0
Uploading .pio/build/bluepill_f103c8_128k/firmware.bin
No valid DFU suffix signature
dfu-util 0.7
Warning: File has no DFU suffix
Copyright 2005-2008 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2012 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to dfu-util@lists.gnumonks.org
Filter on vendor = 0x1eaf product = 0x0003
Opening DFU capable USB device… ID 1eaf:0003
Run-time device DFU version 0110
Found DFU: [1eaf:0003] devnum=0, cfg=1, intf=0, alt=2, name="STM32duino bootloader v1.0 Upload to Flash 0x8002000"
Claiming USB DFU Interface...
Setting Alternate Setting #2 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 1024
bytes_per_hash=199
Copying data from PC to DFU device
Starting download: [##################################################] finished!
state(8) = dfuMANIFEST-WAIT-RESET, status(0) = No error condition is present
Done!
Resetting USB to switch back to runtime mode
Waiting for /dev/ttyACM0 serial...Done
================================================================================ [SUCCESS] Took 20.43 seconds ================================================================================
Terminal will be reused by tasks, press any key to close it.

That’s right, DFU upload from PlatformIO is a success! The test program is the same as the previous post, which simply turns the PC13 LED on continuously. The result is pictured above.

See you next time.

One response on “Blue Pill Programmed via DFU from PlatformIO