PlatformIO Community

How to create the STM32CubeMx project?

How do you migrate the code generated by their CubeMx to the blank project created by platformio?
I used cubemx to generate stm32 code, and the code file directory is as follows:
1111
Then I created a cubemx framework project using PlatformIO.I copied the ‘Core’ folder to the ‘src’ directory in the platformio project.
2222
There were a lot of errors when I compiled the project.What configurations should I do to compile the project? And I don’t need to destroy the directory structure of the cubemx generation code.In order to compile successfully, I must copy the files under the “Core/Src/” path to the “src” directory in the project and the files under the “Core/Inc/” path to the “include” directory in the project.
3333

This problem has been solved, just configure the path to compile successfully!

Here’s what I configured:

[env:disco_l152rb]
platform = ststm32
board = disco_l152rb
framework = stm32cube

; change microcontroller
board_build.mcu = stm32l151rbt6

; change MCU frequency
board_build.f_cpu = 32000000L

upload_protocol = jlink ; SWD interface
debug_tool=jlink

build_flags = -DL1
-Isrc/Core/Inc

1 Like