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:
Then I created a cubemx framework project using PlatformIO.I copied the ‘Core’ folder to the ‘src’ directory in the platformio project.
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.

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

Here’s what I configured:

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

build_flags = -DL1

1 Like