What is an example? ¶
Each example is a complete project that can be built, flashed, and run on the STM32 development boards and Discovery kits. These projects are available for the IDEs supported by the STM32Cube ecosystem.
![]() |
![]() |
![]() |
|
IDE |
STM32CubeIDE for Visual Studio Code |
IAR Embedded Workbench for Arm® |
Not supported in this release |
Toolchain |
GNU Tools for STM32 |
IAR C/C++ compiler (with IAR assembler and XLINK linker) |
Not supported in this release |
Project format |
CMake (.settings) |
IAR project (.eww and .ewp) |
Not supported in this release |
The exact version of IDE and toolchain used to build the project can vary from one STM32 series to another. The version of the IDE and toolchain used to build the projects is specified in the release notes of the STM32Cube Software Package.
What is in it for me ? ¶
The STM32Cube Software Examples are designed to showcase the STM32 features, and teach how to make the best use of them to speed up your developments.
An example project provides:
-
Some hardware agnostic code to demonstrate a functionality.
-
Some hardware specific code to explain how to configure precisely a specific STM32 and its IPs.
-
Some specific documentation (README) to make the best use of the STM32Cube software and tools for the use-case it illustrates.
-
A step by step description of the use-case sequence to help you follow the code execution.
In summary, the STM32Cube Software Examples are designed:
-
To be as simple as possible, yet meaningful.
-
To be a practical way to learn how to use the STM32 microcontrollers and their peripherals.
Categories of examples ¶
The STM32Cube Software Examples are organized in different categories, each of them illustrating a specific part of the STM32Cube Software Package.
Category |
Description |
---|---|
advanced |
Examples combining several STM32 peripherals to achieve a complex use-case. |
hal |
Examples demonstrating the use of the STM32 HAL (Hardware Abstraction Layer). HAL examples can use LL APIs for some specific needs and part drivers for LED and user button handling. |
ll |
Examples demonstrating the use of the STM32 LL (Low Layer) drivers. |
middleware |
Examples demonstrating the use of the STM32 middleware. Middleware leverage the HAL and part drivers too. |
parts |
Examples demonstrating the use of the part drivers with the STM32 evaluation boards and Discovery kits. Part drivers leverage the HAL drivers too. |
templates |
Project templates to start developing an STM32 application compliant with the STM3Cube architecture. A template project has the same structure as any example, but with no configuration and use-case code. |
utilities |
Examples demonstrating the use of the STM32 utilities. |
In the STM32Cube Software Package, all examples of a same category are grouped in a folder named after the category.
HAL1 and HAL2-based examples ¶
The STM32Cube Software Examples are available for HAL1 and HAL2-based products. The HAL1-based examples are available in the STM32Cube firmware packages, and are not described in this user manual.
Though the architecture of the examples is different, the HAL1 and HAL2 examples are similar in terms of features and functionalities. In particular:
-
the categories of examples are similar ( advanced examples covering both Applications and Demonstrations ).
-
the names of the examples are similar (for example ADC_AnalogWatchdog for HAL1 and hal_adc_analog_watchdog for HAL2).
With HAL2-based examples, a specific focus is put on the following points compared to HAL1-based examples:
-
The code is more modular and reusable (see Example architecture ).
-
The code is more portable across the STM32 series (see How to port an example ).
-
All examples are available on all boards and kits supporting the required features (see the Examples catalog ).
-
The README files are more detailed and provide more information about the example (see README ).