How to select an IDE and generate code ¶
Selecting an IDE and generating code with STM32CubeMX2, then compiling your project, involves a few clear steps. Here’s a comprehensive guide:
Selecting an IDE ¶
STM32CubeMX2 supports generating project code for several popular IDEs:
IAR Embedded Workbench®
Open-CMSIS (compatible with Keil® MDK-Arm)
CMake (compatible with STM32 VS Code and STM32CubeIDE)
How to select IDE in STM32CubeMX2:
Open your project in STM32CubeMX2.
Navigate to the project manager tab.
Locate the IDE project generation 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 Code button (gear icon or from Project Settings tab).
STM32CubeMX2 will generate the project files tailored for the selected IDE.
Additional tips ¶
Keep STM32CubeMX2 and your IDE updated for compatibility.
Configure debug settings in your IDE to match your hardware.
Use STM32CubeMX’s Project manager tab to customize code generation options.
Build project ¶
Load the previous 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