How to get STM32Cube Software Examples?

The STM32Cube Software Examples are distributed as part of the STM32Cube Software Package [1]. It is possible to retrieve all or part of the STM32Cube Software Examples through different distribution channels.

STM32 Example Library

The STM32 Example Library is a web application for browsing the STM32Cube Software Examples and downloading specific projects. Example documentation and code can be viewed directly within the web application or downloaded to the local disk. This is the most convenient way to retrieve one specific example project.

Note

STM32 Example Library offers HAL2-based and HAL1-based examples, but only the HAL2-based ones are documented in this user manual. Check the HAL version column to determine if the HAL version for the required STM32 device is HAL1 or HAL2.

STM32 Package Creator

The STM32Cube Software Examples can be obtained through a software package that can be tailored to specific needs with the STM32 Package Creator. Installing the software package on the local machine provides example projects on the local disk. This is the best way to retrieve all examples related to a topic of interest for a given STM32 series.

STMicroelectronics GitHub

The STM32Cube Software Examples are available in the STMicroelectronics GitHub organization. It is possible to clone an entire STM32Cube MCU Package repository for a given STM32 series, and the example projects are copied on the local disk.

Note

STMicroelectronics GitHub offers HAL2-based and HAL1-based components, but only the HAL2-based ones are addressed in this user manual. Verify the HAL version for the required STM32 device in the repository to determine if it is HAL1 or HAL2.

Folder structures

Depending on the delivery channel used, the project folder structure varies:

  • STM32Cube MCU Package folder structure:

    • Provides several examples, each organized in its own independent subfolder.

    • Each subfolder contains multiple example projects (typically one per supported board).

    • All libraries, including Device Family Packs (DFP), Hardware Abstraction Layer (HAL), middleware, part drivers, and utilities, are shared among all example projects.

    • This structure represents the global folder organization of a STM32Cube Software Package.

  • Standalone project folder structure:

    • Contains a single example project, typically for one board and one IDE.

    • All dependencies (DFP, HAL, middleware, part drivers, utilities) are grouped together under the same top-level folder as the example project.

    • This structure corresponds to the STM32CubeMX2 generated project, where no component is shared with other projects.

Summary of delivery channels and folder structures

Folder structure

Delivery channel

ST tools (STM32CubeMX2, STM32CubeIDE for Visual Studio Code)

Other vendors tools (IAR Embedded Workbench® for Arm®, Keil® MDK for Arm®)

STM32Cube MCU package folder structure

Format of: STM32 Package Creator and STMicroelectronics GitHub

Key point: example projects share their dependencies, so a change in one dependency affects all projects.

Always work with a standalone structure.

When opening an existing project in this package structure, the tool extracts the project to another location, and converts it to a standalone project. When creating a new project with STM32CubeMX2 or STM32CubeIDE for Visual Studio Code, the generated project is in the standalone structure.

Work in place with both structures.

The project is used “as is”.

Standalone project folder structure

Format of: STM32 Example Library

Key point: each example project is standalone, with no shared dependencies.

When opening an existing project in the standalone structure, the tool opens it in place, without any conversion. When creating a new project with STM32CubeMX2 or STM32CubeIDE for Visual Studio Code, the generated project is in this standalone structure.

Work in place with both structures.

The project is used “as is”.