Thanks, I really didn’t understand the purpose of the flags for compilation, I never used it, now I understand what it is for!
I changed the ini file
[env:disco_f051r8]
platform = ststm32
framework = stm32cube
board = disco_f051r8
debug_tool = stlink
upload_protocol = stlink
build_flags = -DF1
And changed the GPIO to the corresponding one - 9 (on the board, the LEDs are signed PC8, PC9)
(penv) ruslanpavluchenko@Ruslans-MacBook-Pro-3 stm32cube-hal-blink % pio run -t upload
Processing disco_f051r8 (platform: ststm32; framework: stm32cube; board: disco_f051r8)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/ststm32/disco_f051r8.html
PLATFORM: ST STM32 (8.1.0) > ST STM32F0DISCOVERY
HARDWARE: STM32F051R8T6 48MHz, 8KB RAM, 64KB Flash
DEBUG: Current (stlink) On-board (stlink) External (blackmagic, jlink)
PACKAGES:
- framework-stm32cube 2.0.200813
- tool-dfuutil 1.9.200310
- tool-ldscripts-ststm32 0.1.0
- tool-openocd 2.1000.200630 (10.0)
- tool-stm32duino 1.0.1
- toolchain-gccarmnoneeabi 1.70201.0 (7.2.1)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 10 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/disco_f051r8/src/main.o
src/main.c:4:10: fatal error: stm32f1xx_hal.h: No such file or directory
***********************************************************************
* Looking for stm32f1xx_hal.h dependency? Check our library registry!
*
* CLI > platformio lib search "header:stm32f1xx_hal.h"
* Web > https://platformio.org/lib/search?query=header:stm32f1xx_hal.h
*
***********************************************************************
#include "stm32f1xx_hal.h"
^~~~~~~~~~~~~~~~~
compilation terminated.
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_smbus.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_spi.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_spi_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_tim.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_tim_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_tsc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_uart.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_uart_ex.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_usart.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_hal_wwdg.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_adc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_comp.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_crc.o
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_crs.o
*** [.pio/build/disco_f051r8/src/main.o] Error 1
Compiling .pio/build/disco_f051r8/FrameworkHALDriver/Src/stm32f0xx_ll_dac.o
================================================================================= [FAILED] Took 1.06 seconds =================================================================================
(penv) ruslanpavluchenko@Ruslans-MacBook-Pro-3 stm32cube-hal-blink %