platformio-core: STM32F0 upload failing

Solution

Please add to platformio.ini

[env:myenv]
board = ...
upload_protocol = stlink

$ pio run --target upload
[Fri May 20 12:05:58 2016] Processing disco_f051r8 (platform: ststm32, board: disco_f051r8, framework: mbed)
------------------------------------------------------------------------------------------------------------------------
MethodWrapper(["upload"], [".pioenvs/disco_f051r8/firmware.bin"])
scons: *** [upload] Explicit exit, status Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms this can be a USB flash drive (i.e. /media/<user>/<device name>)

Error: Please specify `upload_port` for environment or use global `--upload-port` option.
For some development platforms this can be a USB flash drive (i.e. /media/<user>/<device name>)

Port is /dev/stlinkv2_6 so let’s follow advice in another approach:

$ pio run --target upload --upload-port /dev/stlinkv2_6 
.clang_complete  .gitignore       .pioenvs/        src/             
.gcc-flags.json  lib/             platformio.ini   .travis.yml      
jazg@JAZG-LENOVO:~/work/stm32_test $ pio run --target upload --upload-port /dev/stlinkv2_6 
[Fri May 20 12:06:22 2016] Processing disco_f051r8 (platform: ststm32, board: disco_f051r8, framework: mbed)
------------------------------------------------------------------------------------------------------------------------
MethodWrapper(["upload"], [".pioenvs/disco_f051r8/firmware.bin"])
scons: *** [upload] /dev/stlinkv2_6/firmware.bin: Not a directory

Port is accessible, of course:

$ ls -la /dev/stlinkv2_6 
lrwxrwxrwx 1 root root 15 maj 20 11:53 /dev/stlinkv2_6 -> bus/usb/003/003

Code builds without problems:

$ pio run
[Fri May 20 12:13:34 2016] Processing disco_f051r8 (platform: ststm32, board: disco_f051r8, framework: mbed)
------------------------------------------------------------------------------------------------------------------------
arm-none-eabi-g++ -o .pioenvs/disco_f051r8/src/main.o 

[ ... skipped for brevity ... ]

"arm-none-eabi-size" -B -d .pioenvs/disco_f051r8/firmware.elf
arm-none-eabi-objcopy -O binary .pioenvs/disco_f051r8/firmware.elf .pioenvs/disco_f051r8/firmware.bin
text       data     bss     dec     hex filename
12988       124     548   13660    355c .pioenvs/disco_f051r8/firmware.elf
============================================= [SUCCESS] Took 0.91 seconds =============================================

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 15 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @zgoda Looks like your kit only supports uploading over STlink. Could you try upload_protocol = stlink option in your platformio.ini?

@bfarayev Thanks, I got you now. The stlink protocol is set by default only for the disco_* boards where the mbed disk is used for nucleo_*.

In this case, you need manually force the upload_protocol as you do it.

@valeros please specify stlink upload protocol for the boards without ARM mbed bootloader.