FAQ ¶
Frequently asked questions ¶
1 - Why are there no user sections in STM32CubeMX2 generated code ? ¶
Separation of concerns ensures that user application logic and hardware-specific configuration are kept in distinct files.
This approach makes it easier to port an application to a new STM32 microcontroller or board, as only the hardware-specific files must be adapted. You can generate the updated content of these files for a new device by using STM32CubeMX2.
The hardware configuration code generated by STM32CubeMX2 leverages modularity and encapsulation .
Each software unit, such as peripheral configuration, is implemented in its own module (mx_[pppi].c and mx_[pppi].h).
Encapsulation allows you to update or replace hardware configuration without affecting application logic.
The benefits of this approach include:
Maintainability and reusability:
Generated code can be safely regenerated by STM32CubeMX2 without overwriting user logic.
User code remains untouched, making updates and maintenance straightforward by leveraging HAL2.
Middleware, utilities, and part drivers are series-agnostic and reusable across projects.
Clear porting path
When porting to a new microcontroller or board, only update the /generated/ folder and related configuration files.
There is no need to modify application logic or infrastructure code.
By keeping user code and generated code separate, the application remains modular, maintainable, and easy to port to new hardware. Only the hardware-specific configuration must be adapted, which is simplified by STM32CubeMX2 code generation. The core logic remains reusable and protected from accidental overwrites.
STMicroelectronics uses this layered, modular approach in STM32Cube software examples to simplify porting and maintenance, as described in the STM32Cube Software Examples - Porting Example Architecture.
On top of this, STM32CubeMX2 proposes a mechanism of diff/skip/overwrite into the project export settings to be able to handle potential changes done by end-user in some exported files. Refer to the User manual — IDE Project Generation for detailed information.
2 - How do I solve DMA conflicts in STM32CubeMX2 ? ¶
For detailed information about solving DMA conflicts refer to How to configure DMA - View and Resolve Allocation Conflicts.
3 - How do I solve pinout conflicts in STM32CubeMX2? ¶
For detailed information about solving pinout conflicts refer to User manual - Pinout - Pinout Conflicts.
4 - Why do I receive a warning when activating FreeRTOS™ ? ¶
For detailed information about FREERTOS™ refer to the FREERTOS™ User Guide.
5 - Can I use CMSIS-Packs? ¶
STM32CubeMX2 only works with packs that contain STM32Cube-specific metadata.
While other CMSIS-Packs can be installed, they are not visible in the configuration views and are not used for code generation.
Installing such packs has no effect inside STM32CubeMX2 .