I 'google’d quit a lot of articles how-to import CUBEMX project in PlatformIO. I have a project that works in Atollic but STLink does not want to download the Chinese blue pill. I changed the toolchain to GPDSC and re-generate code, move the code into a newly created PlatformIO platform, and add build flags.
This configuration create a lot of duplicate resources, as Platform IO has it own HAL drivers, so I remove the HAL lib I coped, but then Platform IO HAL driver is incompatible with mine. Could be older, newer I do not know. I need either to know what version HAL PlatformIo used, then I can re-created my project with that version, or I need to ‘overide’ PlatformIO Hal to use CubeMX created lib,
My dir structure
include
lib
platformio.ini
src
test
Lib Structure
**Drivers**
**FATFS**
**MIddlewares**
Ini File I use
env:bluepill_f103c8]
platform = ststm32
board = bluepill_f103c8
framework = stm32cube
build_flags =
-Ilib/FATFS/Target
-Ilib/FATFS/App
-Ilib/USB_DEVICE/App
-Ilib/USB_DEVICE/Target
-Ilib/Core/Inc
-Ilib/Drivers/STM32F1xx_HAL_Driver/Inc
-Ilib/Drivers/STM32F1xx_HAL_Driver/Inc/Legacy
-Ilib/Middlewares/Third_Party/FatFs/src
-Ilib/Drivers/CMSIS/Device/ST/STM32F1xx/Include
-Ilib/Drivers/CMSIS/Include
-I Inc
; -Ilib/Middlewares/ST/STM32_USB_Device_Library/Core/Inc
; -Ilib/Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc
;-Os -ffunction-sections -fdata-sections -g -fstack-usage -Wall -specs=nano.specs -o Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.o ../Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ctlreq.c
;upload_flags = -c set CPUTAPID 0x1ba01477
;upload_protocol = stlink
;debug_tool = stlink
;debug_build_flags = -O0 -ggdb3 -g3
;debug_init_break = break setup
;upload_flags = -c set CPUTAPID 0x1ba01477
;upload_flags = -c set CPUTAPID 0x2ba01477