This is correct – STM32CubeMX generates projects with a different foler structure than PlatformIO expects ot. They’re two different systems, after all. PlatformIO expects the standardized PlatformIO folder structure or the appropriate build flags / library directives for the folder structures.
Also have a look at the example projects for STM32Cube in platform-ststm32/examples at develop · platformio/platform-ststm32 · GitHub.
I can e.g. see you’re putting the whole Drivers/
folder with the STM32HAL and CMSIS in the PlatformIO project, but these aren’t supposed to be there, since they will be sourced from PlatformIO packages (aka loaded in C:\Users\<user>\.platformio\packages\framework-stm32cubef1
in this case). The Drivers/
folder in the project folder will be ignored by PIO during build, since it only builds source files in src/
an the libraries (in lib/
or in the manually declared path), with not-built but included header files sourced from include/
.
There are also automated conversion programs as GitHub - ussserrr/stm32pio: Automate managing of STM32CubeMX + PlatformIO projects, as discussed in PlatformIO for stm32 and CubeMX include error - #9 by ussserrr. The topic also contains the same information about the manual way of solving it with build_flags
and lib_deps
.