How to select a format and generate code ¶
Selecting a format and generating code with STM32CubeMX2, then compiling your project, involves a few clear steps. Here’s a comprehensive guide:
Selecting a format ¶
STM32CubeMX2 supports generating project code for several popular formats:
IAR Embedded Workbench for ARM®
CMake [default]
Open-CMSIS(Keil µVision / Studio)
raw (no IDE project file)
How to select format in STM32CubeMX2:
Open your project in STM32CubeMX2.
Navigate to the project manager tab.
Locate the Project Generation Settings section under project settings.
Select your desired format from the list (for example, CMake).
Configure all needed input fields, or keep the default settings.
Generating Code ¶
After configuring peripherals, clocks, and middleware, click the Generate project button (gear icon or from Project Settings tab).
STM32CubeMX2 will generate the project files tailored for the selected format.
Additional tips ¶
Keep STM32CubeMX2 and your IDE updated for compatibility.
Configure debug settings in your IDE to match your hardware.
Use STM32CubeMX2’s Project manager tab to customize code generation options.
Build project ¶
Load the previously generated project in VSCode
Select Debug configuration
Configure the board/Device with the right board name
Save configuration
Once the project is well configured launch the build
Check that no error occurred