- Run the CubeMX, choose an MCU/board, make all desired tweaks.
- Select the
Project Manager -> Project
tab, specify a "Project Name", choose "Other Toolchains (GPDSC)". In theCode Generator
tab check "Copy only the necessary library files" and "Generate periphery initialization as a pair of '.c/.h' files per peripheral" options.
- Back in the first tab (Project) copy the "Toolchain Folder Location" string. Save the project.
- Use the copied string (project folder) as a
-d/--directory
argument for the stm32pio (can be omitted if your current working directory is already a project directory). - Run
platformio boards
(pio boards
) or go to boards to list all supported devices. Pick one and use its ID as a-b/--board
argument (for example,nucleo_f031k6
) - All done! You can now run
to trigger the code generation, compile the project and start the VSCode editor with the folder opened (last 2 options are given as an example and not required). Make sure you have all the tools in your PATH (
$ stm32pio new -d path/to/project/ -b nucleo_f031k6 --start-editor=code --with-build
java
,platformio
,python
, editor) (or set them instm32pio.ini
). You can use a slightly shorter syntax if you are already located in the project directory:path/to/project/ $ stm32pio new -b nucleo_f031k6
- To get the information about the current state of the project use
status
command. - If you will be in need to update the hardware configuration in a future, make all the necessary stuff in CubeMX and run
generate
command in a similar way:$ stm32pio generate -d /path/to/project
- To clean-up the directory and keep only an
.ioc
file run theclean
command. - If you're facing some errors complaining about tools absence, run
validate
command to check the current environment in terms of the tools' presence in your system.