Architectural features

STM32Cube embedded software provides a unified, modular architecture for STM32 microcontrollers.

It is designed to accelerate development, maximize code reuse, and optimize the use of STM32 features across the entire portfolio.

Architecture principles and concepts

STM32Cube embedded software is organized in layers to separate hardware-independent code from hardware-specific implementations . This approach ensures portability and scalability , allowing developers to move projects between different STM32 devices with minimal effort .

Tools like STM32CubeMX2 that facilitate configuration and code generation maximize the benefits from this concept.

This philosophy has been pushed even further with the HAL2-based STM32 series.

Note

For customers who do not use STM32CubeMX2, the same architecture principles apply to templates and example projects to ensure consistency.

Configuration and code generation

STM32Cube embedded software leverages STM32CubeMX2 for configuration and code generation. STM32CubeMX2 provides a graphical interface to configure components and other settings, generating initialization and configuration code that integrates seamlessly with STM32Cube embedded software.

Picture summarizing the configuration and code generation flow with STM32Cube embedded software and STM32CubeMX2

Configuration and code generation flow with STM32Cube embedded software and STM32CubeMX2

This generated code follows the same architecture principles as the rest of STM32Cube embedded software, ensuring consistency and maintainability. This code is kept separated from the component code . It is some application code directly managed by the user. Additionally, this generated application code is also kept separated from the pure user code , which is the code that implements the actual application logic.

Note

For customers who do not use STM32CubeMX2, each component provides standalone templates for the user to start from, following the same architecture principles. These templates must be copied into the user application and customized according to the application needs.

Separation of concerns

A data-centric approach is adopted to limit dependencies between embedded software components and development tools like STM32CubeMX2. This means that the embedded software components can be updated or replaced independently of the version of STM32CubeMX2 being used. STM32CubeMX2 consumes data provided by STM32Cube embedded software to generate code, but the two are not tightly coupled.

Picture summarizing the independent lifecycles of STM32Cube embedded software and STM32CubeMX2, highlighting the separation of concerns between software components and configuration tools.

Independent lifecycles of STM32Cube embedded software and STM32CubeMX2

This separation of concerns enhances maintainability and allows developers to benefit from the latest features and improvements in both the embedded software components and STM32CubeMX2 without compatibility issues. Thus, just by updating the embedded software components, developers can take advantage of new APIs, bug fixes, and performance enhancements even in the code generated with STM32CubeMX2.

Note

For customers who do not use STM32CubeMX2, this separation of concerns is still valid (with templates for instance). The embedded software components are easy to integrate into custom projects. They can be updated independently of the project structure.

Modularity and extensibility

CMSIS-Pack technology

The distribution and maintenance model is reinforced through the use of CMSIS-Packs. This is the packaging system used to install the embedded software components into STM32CubeMX2 and STM32CubeIDE for Visual Studio Code.

Picture summarizing the CMSIS-Packs constituting the STM32Cube embedded software offer

CMSIS-Packs constituting the STM32Cube embedded software offer

This enables flexible integration and standalone configuration and code generation with STM32CubeMX2. For customers who do not use STM32CubeMX2, the modularity and extensibility principles are still valid.

CMSIS-Packs provide a standardized way to package and distribute software components. This technology can be used with any compatible development environment. See Software components delivery channels for more details on the delivery channels of software components and STM32Cube packs.

Important

The STM32Cube packs comply with the CMSIS-Pack format description [1], but they do not implement all CMSIS-Pack features. Moreover, the STM32Cube packs have extra features and content compared to a standard CMSIS-Pack, such as STM32CubeMX2 code generation support. These additional features are supported only by STMicroelectronics tools.

Versioning model

The versioning model of the software components is based on Semantic Versioning 2.0.0.

The software components are delivered as CMSIS-Packs, so there are two versioning levels to consider:

  • The version of the software component itself: this is the CMSIS-Pack deliverable version. It is the version seen when installing a pack in STM32CubeMX2 or STM32CubeIDE for Visual Studio Code.

  • The version of the CMSIS components within a given CMSIS-Pack version. It is the fine grain version for a set of files providing a service.

This double level versioning allows to have a clear view on the impacts of a pack update, and to manage the dependencies between software components in a more efficient way:

  • The version of the pack indicates the global level of changes and the potential impacts on the user project.

  • The component version allows to track precisely the changes and to manage dependencies between files in a more granular way.

Component-based design

Customers do not need to leverage the CMSIS-Packs technology to benefit from the component-based design of STM32Cube embedded software.

For instance:

  • The board support package (BSP) layer is a set of independent part drivers, with easy integration between components and bus interfaces (such as I2C, SPI, …).

  • The middleware offer is designed as a set of independent components, with clear interfaces and well-defined responsibilities. They are provided through high-level components that are easy to integrate and use in applications.

This component-based design allows developers to select and integrate only the components they need for their application, reducing memory footprint and complexity. This can be achieved just by including the relevant source files and headers in their project, without unnecessary dependencies.

Diagram illustrating the STM32Cube software component model, showing modular components such as HAL, middleware, and part drivers, with interfaces connecting each layer to enable integration, scalability, and portability across STM32 devices.

STM32Cube software component model