PlatformIO Community

ST-link for MAC OS

I was given a STM controller to try, I have STM32F0DISCOVERY, MacBook, Catalina, VSC and Platformio. How to upload a sketch to STM32F0DISCOVERY? This DEV board uses st-link, but as I understand it, something in my configuration does not support st-link. I read a lot on the forum but no answer came.

This combination should be fully supported. Just specify (in platformio.ini):

debug_tool = stlink
upload_protocol = stlink

and press the upload button in the status bar.

In order to better support, you please provide more information:

  • Where are you stuck? What did you try? What didn’t work? What error message or log output did you get?
  • What does your platformio.ini look like?

Maybe here it will not be difficult for someone to show the small code for stm32 and an example of the platformio.ini :pray:
Apparently I just don’t understand something

What error message are you getting…

Examples are e.g. at https://github.com/platformio/platform-ststm32/tree/develop/examples/arduino-blink

Make sure to use the appropriate board name. I think you want https://docs.platformio.org/en/latest/boards/ststm32/disco_f051r8.html.

1 Like

How are we supposed to help you if you don’t provide any information? I’ve asked specific question but you haven’t answered any of them.

From your information so far we don’t understand if you have run into a specific problem (it doesn’t compile, it doesn’t upload, it runs but doesn’t behave as expected) or if you don’t where to start and need guidance.

Please help us help you.

I did according to the instructions https://github.com/platformio/platform-ststm32/tree/develop/examples/arduino-blink, but at the “platformio run” step I get this kind of infinite loop

Building .pio/build/robotdyn_blackpill_f303cc/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.3% (used 960 bytes from 40960 bytes)
Flash: [          ]   4.5% (used 11720 bytes from 262144 bytes)
==================================================================================== [SUCCESS] Took 6.08 seconds ====================================================================================

Processing sparky_v1 (board: sparky_v1; platform: ststm32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/sparky_v1.html
PLATFORM: ST STM32 (8.0.0) > Sparky V1 F303
HARDWARE: STM32F303CCT6 72MHz, 40KB RAM, 256KB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-arduinoststm32 4.10900.200819 (1.9.0) 
 - framework-cmsis 2.50501.200527 (5.5.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 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/sparky_v1/FrameworkArduinoVariant/PeripheralPins.c.o
Compiling .pio/build/sparky_v1/FrameworkArduinoVariant/variant.cpp.o
Compiling .pio/build/sparky_v1/FrameworkArduino/HardwareSerial.cpp.o
...
Compiling .pio/build/sparky_v1/src/Blink.cpp.o
Linking .pio/build/sparky_v1/firmware.elf
Checking size .pio/build/sparky_v1/firmware.elf
Building .pio/build/sparky_v1/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   2.3% (used 960 bytes from 40960 bytes)
Flash: [          ]   4.4% (used 11576 bytes from 262144 bytes)
==================================================================================== [SUCCESS] Took 6.64 seconds ====================================================================================

Processing vake_v1 (board: vake_v1; platform: ststm32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/vake_v1.html
PLATFORM: ST STM32 (8.0.0) > VAkE v1.0
HARDWARE: STM32F446RET6 180MHz, 128KB RAM, 512KB Flash
DEBUG: Current (blackmagic) External (blackmagic, jlink, stlink)
PACKAGES: 
 - framework-arduinoststm32 4.10900.200819 (1.9.0) 
 - framework-cmsis 2.50501.200527 (5.5.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 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/vake_v1/FrameworkArduinoVariant/PeripheralPins.c.o
Compiling .pio/build/vake_v1/FrameworkArduinoVariant/variant.cpp.o
Compiling .pio/build/vake_v1/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/vake_v1/FrameworkArduino/HardwareTimer.cpp.o
...
Compiling .pio/build/vake_v1/FrameworkArduino/abi.cpp.o
Compiling .pio/build/vake_v1/FrameworkArduino/avr/dtostrf.c.o
/Users/ruslanpavluchenko/.platformio/packages/framework-arduinoststm32/cores/arduino/Tone.cpp:136:2: warning: #warning "TIMER_TONE or HAL_TIM_MODULE_ENABLED not defined" [-Wcpp]
  136 | #warning "TIMER_TONE or HAL_TIM_MODULE_ENABLED not defined"
      |  ^~~~~~~
Compiling .pio/build/vake_v1/FrameworkArduino/board.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/hooks.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/itoa.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/main.cpp.o
Compiling .pio/build/vake_v1/FrameworkArduino/new.cpp.o
Compiling .pio/build/vake_v1/FrameworkArduino/pins_arduino.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/device.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/generic/condition.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/generic/cortexm/sys.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/generic/generic_device.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/generic/generic_init.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/generic/generic_io.c.o
Compiling .pio/build/vake_v1/FrameworkArduino/stm32/OpenAMP/libmetal/generic/generic_shmem.c.o

...
Compiling .pio/build/vake_v1/SrcWrapper/src/stm32/rtc.c.o
Compiling .pio/build/vake_v1/SrcWrapper/src/stm32/stm32_def.c.o
Compiling .pio/build/vake_v1/SrcWrapper/src/stm32/stm32_eeprom.c.o
Compiling .pio/build/vake_v1/SrcWrapper/src/stm32/system_stm32yyxx.c.o
Compiling .pio/build/vake_v1/SrcWrapper/src/stm32/timer.c.o
Compiling .pio/build/vake_v1/SrcWrapper/src/stm32/uart.c.o
Compiling .pio/build/vake_v1/SrcWrapper/src/syscalls.c.o
Compiling .pio/build/vake_v1/src/Blink.cpp.o
Linking .pio/build/vake_v1/firmware.elf
Checking size .pio/build/vake_v1/firmware.elf
Building .pio/build/vake_v1/firmware.bin
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.9% (used 1188 bytes from 131072 bytes)
Flash: [          ]   2.2% (used 11480 bytes from 524288 bytes)
==================================================================================== [SUCCESS] Took 6.78 seconds ====================================================================================

Processing st3dp001_eval (board: st3dp001_eval; platform: ststm32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/st3dp001_eval.html
PLATFORM: ST STM32 (8.0.0) > 3DP001V1 Evaluation board for 3D printer
HARDWARE: STM32F401VGT6 84MHz, 96KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: 
 - framework-arduinoststm32 4.10900.200819 (1.9.0) 
 - framework-cmsis 2.50501.200527 (5.5.1) 
 

***pio run***
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.9% (used 880 bytes from 98304 bytes)
Flash: [          ]   2.1% (used 10788 bytes from 524288 bytes)
==================================================================================== [SUCCESS] Took 2.33 seconds ====================================================================================

Processing nucleo_wb55rg_p (board: nucleo_wb55rg_p; platform: ststm32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_wb55rg_p.html
PLATFORM: ST STM32 (8.0.0) > P-Nucleo WB55RG
HARDWARE: STM32WB55RG 64MHz, 192.00KB RAM, 512KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: 
 - framework-arduinoststm32 4.10900.200819 (1.9.0) 
 - framework-cmsis 2.50501.200527 (5.5.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 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/nucleo_wb55rg_p/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.5% (used 940 bytes from 196604 bytes)
Flash: [          ]   2.5% (used 13056 bytes from 524288 bytes)
==================================================================================== [SUCCESS] Took 2.06 seconds ====================================================================================

Processing nucleo_h743zi (board: nucleo_h743zi; platform: ststm32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/nucleo_h743zi.html
PLATFORM: ST STM32 (8.0.0) > ST Nucleo H743ZI
HARDWARE: STM32H743ZIT6 400MHz, 512KB RAM, 2MB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES: 
 - framework-arduinoststm32 4.10900.200819 (1.9.0) 
 - framework-cmsis 2.50501.200527 (5.5.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 37 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Checking size .pio/build/nucleo_h743zi/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   0.2% (used 1052 bytes from 524288 bytes)
Flash: [          ]   0.8% (used 17392 bytes from 2097152 bytes)
==================================================================================== [SUCCESS] Took 2.43 seconds ====================================================================================

Processing nucleo_g071rb (board: nucleo_g071rb; platform: ststm32; framework: arduino)
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
^CBuild interrupted.
Error: Aborted by user
ruslanpavluchenko@Ruslans-MacBook-Pro arduino-blink %

As said in

You only want an environment which contains your specific board. The README also tells you to only run it for a specific environment (-e <env>). Since your board isn’t listed in the platformio.ini you should replace it with

[env:disco_f051r8]
platform = ststm32
board = disco_f051r8
framework = arduino