This is a template project for Nucleo-F446RE (STM32F446RETx) with FreeRTOS and LED blink
The script (from Reference 1) reads the .project and .cproject file created by STM32Cube and the platformio.ini file to create a build model that can be provided to platformio for building without using the libraries provided by PlatformIO. None of the PlatformIO libraries for CubeMX are used. This should provide a build result comparable to that in STM32CubeIDE.
-
Copy and rename the folder
-
Rename .ioc file -> Same as folder name
-
Use STM32CubeMX or STM32CubeIDE to open the .ioc file and configure. Gnerate code(required even if name was not changed).
-
Open folder with VSCode (For Windows, open with Admin Rights, or Turn on Windows Developer mode). PlatformIO extension should recognize this folder
-
Modify code between
/* USER CODE BEGIN */
and/* USER CODE END */
-
Build, Upload, Debug
-
Create new project from STM32CubeMX or STM32CubeIDE
a. Select MCU or board
b. Configure RCC; SYS: Debug -> Serial Wire; Timebase Source -> (Any TIMx, not SysTick)
c. (Optional) FREERTOS: Interface -> CMSIS_V2; Tasks and Queues -> Add and edit tasks
d. Configure clock speed
e. Project Name -> Same as folder name
d. Project location -> Folder to contain the project folder
e. Application Structure -> Advanced
f. Toolchain / IDE -> STM32CubeIDE
g. Code Generator -> Add necessary files as reference in the toolchain project configuration file; -> Generate peripheral initialization as a pair of '.c/.h' files per peripheral
h. Generate code
-
Open folder with VSCode (For Windows, open with Admin Rights, or Turn on Windows Developer mode). Use PlatformIO extension to Create New Project
a. Project Name -> Same as folder name
b. Board -> Same as selected in Step 1.a
c. Framework -> STM32Cube
d. Location -> Same as Step 1.d
e. Copy script file setup_cubemx_env_auto.py to folder
f. In platformio.ini file, add the following under [env]
extra_scripts = pre:setup_cubemx_env_auto.py platform_packages = toolchain-gccarmnoneeabi@1.90301.200702 lib_deps = STLinkedResources
g. Rename any assembler files having a lower-case '.s' ending to upper-case '.S'.
h. Reload window
i. Modify code between
/* USER CODE BEGIN */
and/* USER CODE END */
j. Delete empty folders generated by PlatformIO:
- include
- src
- test
k. Build, Upload, Debug