Um2388 Development Guidelines For Stm32cube Firmware Packs Stmicroelectronics
Um2388 Development Guidelines For Stm32cube Firmware Packs Stmicroelectronics
Um2388 Development Guidelines For Stm32cube Firmware Packs Stmicroelectronics
User manual
Introduction
STM32Cube is an STMicroelectronics original initiative to significantly improve developer productivity by reducing development
effort, time and cost. STM32Cube covers the STM32 portfolio.
STM32Cube includes:
• STM32CubeMX, a graphical software configuration tool that allows the generation of C initialization code using graphical
wizards.
• A comprehensive embedded software platform, delivered per Series (such as STM32CubeF4 for STM32F4 Series):
– The STM32Cube HAL, STM32 abstraction layer embedded software ensuring maximized portability across the
STM32 portfolio. HAL APIs are available for all peripherals.
– Low-layer APIs (LL) offering a fast light-weight expert-oriented layer which is closer to the hardware than the HAL. LL
APIs are available only for a set of peripherals.
– A consistent set of middleware components such as FAT file system, RTOS, USB, TCP/IP and Graphics.
– All embedded software utilities, delivered with a full set of examples.
The STM32Cube Expansion Packages contain embedded software components that complement STM32Cube functionalities
and enable using STMicroelectronics microcontroller devices in various application domains.
The present user manual describes the concept of firmware components with a focus on the various component interfaces, as
well as the interaction model with the different STM32Cube Package layers (HAL, BSP and middleware). It also describes the
associated CMSIS Pack located within the PDSC file as specified by Arm.
This document assumes that the reader is familiar with STM32Cube architecture, HAL/LL APIs and programming models. A
complete documentation on STM32Cube MCU Packages is available from www.st.com.
1 Reference documents
2 Acronyms
Acronym Definition
3 Definitions
• Unitary Pack: a CMSIS Pack that contains a single firmware component as defined by the STM32Cube
specification, such as STM32F7 HAL Pack, STM32F7 BSP Pack or LwIP Pack.
• Standalone Pack: a set of unitary Packs integrated together and coming with a set of applications that fulfil
a single function, such as MEMS Pack or LoRaWAN® Pack.
• Application Pack: an application-level Pack that requires additional standalone Packs and that must
contain a set of specific applications on top of the elementary Packs. The application Packs are only used
with STM32CubeMX and cannot be open by another third-party Pack manager.
Note: Arm is a registered trademark of Arm Limited (or its subsidiaries) in the US and/or elsewhere.
cmsis-os.h
Applications
Level 1
CMSIS-RTOS API
RTOS kernel Library and protocol-based components (such as FatFS,
FreeRTOS, USB Host, USB Device, Ethernet)
CMSIS RTOS
Examples
<device>.h
CMSIS device peripheral BSP Drivers
access
system_<device>.c
CMSIS system and clock
Low level Driver Core
configuration BSP
components
CMSIS core HAL
• Drivers: folder containing the different level-0 components including the CMSIS core files.
• Middlewares: folder containing the different native STMicroelectronics and third-party stacks and protocol-
based libraries.
• Projects: set of applicative projects that explain and provide use cases of the different product features
based on the product hardware (boards, STM32 core features, interconnections and peripherals) and built
around the different firmware components.
• Utilities: miscellaneous software utilities that provide additional system and media resource services such
as CPU usage calculation with FreeRTOS, fonts used by the LCD drivers, time server, low-power manager,
several trace utilities, and standard library services such as memory, string, time and math services.
• Advanced structure: the advanced structure is a modular structure that enables a more efficient and
organized folder model by grouping application files per module and simplifying the identification of
the specific components and platform-agnostic ones within the project file. This makes the application
integration easier when several modules or middleware components are used.
The advanced structure consists of:
– A Core folder containing main.c/h, stm32tnxx_it.c/h, HAL config and msp files.
– A ModuleName/App folder containing the platform-independent application files relative to a given
module.
– A ModuleName/target folder containing the platform-dependent applications files (such as middleware
interfaces and configuration files) relative to a given module.
A module is a set of application files that fulfil the same functionality. These files are identified by the high-level
APIs that must be platform independent and by the target files relative to the platform being used. Typical
STM32Cube Package modules are the application files on top of the middleware components or the BSP board
and components drivers.
In the fist case, one module must be provided for each middleware component (calling the middleware core
high-level APIs) and must in turn be called by the core application files.
For independent middleware applications, there is a single module per middleware component that is built on
top of the middleware high-level APIs. It can have the same name as the middleware component or of the class
to which the middleware belongs (see Figure 13. Project folder structure for independent middleware application
modules):
Figure 13. Project folder structure for independent middleware application modules
For interdependent middleware based applications, some middleware are come on top of others. In this case the
associated module always references the middleware that exports its services to the application or the class to
which the middleware belongs. For example, the LoRaWAN® middleware uses the sub-GHz middleware by its
low-level interface (see Figure 14. Project folder structure for LoRaWAN® application module).
In the STM32Cube framework, the layers and firmware categories (middleware, projects and drivers) correspond
to a macroscopic view of the firmware entity hierarchy within the global architecture. However the STM32Cube
MCU Package entities are considered as standalone bricks that are referred to as 'STM32Cube firmware
component' or simply 'firmware component' in the next sections of the present document.
The firmware components are standalone entities. This means that they must not depend on each other from
architecture point of view, whereas it can be the case from functional point of view.
For example, the middleware components are linked to the HAL/BSP drivers to get working, but they are
standalone components since they can interface with the hardware through other components (such as LL
drivers, user library or direct register access).
The firmware component must provide a standalone set of services and interact with the external world
(application, other firmware components or services) thanks to dedicated communication services (interfaces)
based on various techniques (glue methods).
A component Pack is a standardized way to define a deliverable software component. Depending on the
information provided in the Pack, two levels of Pack usage through STM32CubeMX can be distinguished:
• If no STM32CubeMx STM32CubeMX files are present in the Pack, then the tool can only copy the software
components of the Pack in the generated project.
• If the Pack includes STM32CubeMX configuration files, a user interface is used to configure the software
components and the initialization C code is generated accordingly in the project.
– *.xml files: they describe how the software component configuration parameters can be modified
through the STM32CubeMX user interface
– *.flt files: they provide the initialization code to be generated by the STM32CubeMX
PDSC
In the STM32Cube framework, the single interface components generally include the HAL drivers, the LL
drivers, the utilities and the logical services (with no hardware access such as LibJPEG).
Note: The HAL drivers interact internally with the LL driver services, with exclusive access to unitary functions
and direct hardware access for optimization purposes. Since the interaction is internal and not visible for
the end-user, the HAL drivers do not have an explicit low interface.
• Dual interface component: in addition to the mandatory high interface, such a component can have an
additional interface than can be either a low or a hardware interface.
In the STM32Cube framework, the dual interface components generally include the BSP drivers as well as
several middleware components.
• Multiple interface component: such a component includes the three types of components.
In the STM32Cube framework, the multiple interface components generally include some middleware
components.
The following table summarizes the interface availability for the firmware components in the native STM32Cube
framework.
The following figure shows an example of components interaction model that uses the different interface types.
An example of full interaction based on the USB Device middleware is shown below. Both USB Device Class and
Core provide high-level APIs to the application. The class is dynamically connected to the core through internal
glue (Register Class) and uses common core APIs for dedicated class request and data transfer operations. The
core is linked to the USB PCD HAL driver through the low interface and to the hardware services for the class
specific operations.
Figure 25. Example of firmware component full interaction using USB Device middleware
Note: A component can have several hardware interfaces. They must be located in separate files according to the
required service family or class. For example, hardware interfaces can support message console, storage
services (such as microSD) for USB Device (mass storage) and RTC services for the FatFS.
The virtual component advantage is to avoid directly using lower layers (the HAL in this case) to add missing
services, which will affect the generated code. The virtual component is a light implementation of the official
component based on HAL service calls. It can have restrictions, such as being available only for a limited number
of STM32 Series. However it must implement consistent APIs whose code must be portable across all existing
implementations so that the virtual component can be seamlessly replaced by the official implementation, when it
is available.
One of the main case of virtual component usage is to provide BSP common services for controlling and driving
LEDs and buttons. Standard BSP APIs can be called instead of creating unitary applicative services such as
MX_GPIO_Init () and HAL_GPIO_WritePin () in the main.c file or in middleware low interfaces. However the
internal implementation is completely generated by the STM32CubeMX using the HAL service APIs (such as
GPIO and buses).
The virtual components must be stored in the application space under the Services folder when the application
Core and Middleware folders model are used, or directly in the project Sources and Include folders when no
middleware is used.
Note: No Pack is generated for a virtual component since it is an ephemeral firmware entity. This type of component is
fully created by the user and simply generated by STM32CubeMX.
Silicon vendor,
Silicon vendor,
Arm tool vendor, Bord vendor User tool
tool vendor
3rd party
A Pack is set of components (middleware, drivers, and projects). The location and interaction between
components are defined through the CMSIS Pack attributes and keywords.
The firmware components can be distributed through software Packs. A software Pack is a zip file containing
a single Pack description file that describes dependencies towards devices, processors, toolchains, or other
software components.
Each Pack description file (*.PDSC) contains a descriptive text of the software Pack as well as information on
devices, components, and examples. Information to ease software Pack downloading, updating and versioning is
also provided. In addition, the *.PDSC file includes the complete Software Pack revision history, which contains a
brief list of the most significant changes.
The XML schema file, PACK.xsd, defines the sections used in a *.PDSC file. The current PACK.xsd can be found
under the ARM.CMSIS.*.Pack located in the .\CMSIS\Utilities-directory folder.
The Pack Description (*.PDSC) Format is structured using grouping elements and specified according to Keil®
documentation available from https://www.keil.com web site.
Note: In an STM32Cube MCU Package, only one version per Pack component is allowed. As a result, the version
must not be mentioned in the file and folder names but rather inside the Pack descriptor itself and the associated
documents (readme.txt and release note).
Single Pack for all the HAL/LL drivers for a given STM32
HAL Pack HAL and LL drivers
Series.
CMSIS core and device drivers
CMSIS driver Pack from Arm, repackaged by CMSIS Pack for a given STM32 Series.
STMicroelectronics
Single Pack for each function set of BSP components.
Example:
• Audio
BSP component BSP components drivers • MEMS
• LCDController
• TouchScreen
• IOExpander
BSP motherboard
BSP common, bus and class drivers Single Pack for each board containing all the class drivers.
Pack
BSP common and class drivers
BSP extension board
Note: Bus drivers are generated by Single Pack for each board containing all the class drivers.
Pack
STM32CubeMX.
Middleware Pack Core, modules and interface files. All core, modules, interface files for a given middleware.
Utility Pack Utility components Single Pack for each utility component.
Application Pack Applications and examples Single Pack for all the projects supported by a given board.
Each component must have a Class (Cclass=), a Group (Cgroup=), and a Version (Cversion=), which are used to
identify the component. Optionally, a component may have Sub-Group (Csub=) and Variant (Cvariant=) additional
categories. The Class, Group, Sub-Group, Variant and Version are used together with the vendor specified
by the Pack to identify a given component. A component vendor must ensure that the combination of Class,
Group, Sub-Group and Version is unique and not used by multiple components. The bundle (Cbundle) field is
not required. However, multiple interdependent components belonging to the same Cclass can be grouped into a
bundle.
Element usage
The following HAL component description is only applicable to HAL unitary Packs. In standalone Packs, the HAL
is referenced from STM32CubeMX generated projects.
Csub HAL or LL -
Capiversion N/A -
Cversion x.y.z 0.5.0
Condition HAL_Condition CMSIS_Driver
1. Cgroup refers to the PPP HAL driver name and not to the physical peripheral driver, as defined in the STM32Cube
specifications.
Component path
STM32Cube_FW_TN_VX.Y.Z\Drivers\STM32tnxx_HAL_Driver\{Src/Inc}
PDSC format
Element usage
The CMSIS component elements and descriptions are defined in the same way as Arm native Packs. The STM32
start-up and device components have been introduced and the RTOS/RTOS2 subfolders and files reorganized as
described below:
Component path
STM32Cube_FW_TN_VX.Y.Z\Drivers\CMSIS\
Folder organization
Element usage
Component path
STM32Cube_FW_TN_VX.Y.Z\Drivers\BSP\Components\NNNxxxx
Cgroup list
Cgroup Description
PDSC format
Component path
STM32Cube_FW_TN_VX.Y.Z\Drivers\BSP\BoardName (see board naming rules below)
Csub list
Cgroup Description
Cgroup Description
stm32tnnnm_eval STM32TnnnM-EVAL
Evaluation board STM32TnnnM-EV/EVAL
Example: stm32f769i_eval Example: STMF769I-EVAL
b_txxxm_aaayyt(z) B-TxxxM-AAAyyT(z)
Discovery board (application focus) Example: b_l475e_iot01a1 Example : b-l475e-iot01a1
B-TxxxM-AAAyyT(z)
b_txxxm_aaaaaa(y) B-TxxxM-AAAAAA(y)
B-TxxxM-AAAAAA(y)
Example: b_l072z_lrwan1 Example: b-l072z-lrwan1
stm32tnxx_nucleo STM32TNxx_Nucleo
Nucleo board NUCLEO-TnnnMM
Example: stm32l4xx_nucleo Example: STM32L4xx_Nucleo
nnnnn NNNNN
Extension board {X/I}-NUCLEO-NNNNN
Example: iks01a2 Example: iks01a2
Note: For Nucleo boards, the projects must refer to the exact board part number even if they use the same BSP
drivers: STM32Cube_FW_TN_VX.Y.Z\Projects\STM32TNNN_Eval\Applications.
1. The Csub element must reflect the physical split of the middleware component folder. If no subfolder is defined, the Csub:
Core must be used by default.
Component path
STM32Cube_FW_TN_VX.Y.Z\Middleware\ST\MwName (Cgroup)
STM32Cube_FW_TN_VX.Y.Z\Middleware\ThirdParty\MwName (Cgroup)
Cclass list
Cclass Description
Component path
STM32Cube_FW_TN_VX.Y.Z\Utilities\UtilityGroupName\UtilityName
STM32Cube_FW_TN_VX.Y.Z\Utilities\UtilityName (No Csub/UtilityGroupName defined)
Cgroup/Csub list
Unitary Packs
In unitary Packs, the projects (examples, applications and demonstration) are defined according to the example
structure defined by Arm.
The /package/examples/example element fully describes the examples contained in the Pack. Each example
contains a list of files. The example itself and each individual file must refer to a condition that must resolve
to true, otherwise the example or file is ignored. The board element is used to reference one or more board
descriptions using the board vendor and name for which the example is targeted. Each example can specify
attributes that list the related components using Class (Cclass=), Group (Cgroup=), Subgroup (Csub) and a
Version (Cversion=).
Example 1 :
<examples>
<example name="Blinky" folder=" Projects\BoardName" doc="Abstract.txt" version="1.0">
<description>This is a basic example demonstrating the development flow and letting the LED
on the board blink</description>
<board vendor="STMicroelectronics" name="32F429IDISCOVERY"/>
<project>
<environment name="uv" load="ARM/Blinky.uvproj"/>
<environment name="iar" load="IAR/Blinky.ewarm" />
</project>
<attributes>
<component Cclass="CMSIS" Cgroup="Core"/>
<component Cclass="Device" Cgroup="Startup"/>
<keyword>Blinky</keyword>
<keyword>Getting Started</keyword>
</attributes>
</example>
</examples>
Standalone Packs
Cclass Device
• Demonstration
Cgroup Application category • Application
• Examples
Variant <AppName> • LWIP_WebServer
Capiversion
Cversion a.b.c 1.0.0
Condition <AppName>_Condition Applicative modules
In standalone Packs, the application is generated by STM32CubeMX through the user interface and according to
the user configuration. As a result, only the top-level information of the application(s) are provided in the PSDC.
Example 2 :
<Cvendor="STMicroelectronics" Cclass="Device" Cversion="7.0.0">
<description>MEMS library applications</description>
<doc>Documentation/STMicroelectronics.X-CUBE-MEMS1_GettingStarted.pdf</doc>
<component Cgroup="Application" Cvariant="IKS01A3_DataLogTerminal"
isDefaultVariant="true" condition="IKS01A3 Examples Condition" maxInstances="1">
<!-- short component description -->
<description>DataLogTerminal sample application for X-NUCLEO-IKS01A3</description>
<RTE_Components_h>#define IKS01A3_DATALOGTERMINAL_DEMO</RTE_Components_h>
<files/>
</component>
(…)
Note: The application element is only supported by STM32Cube and it is not seen by external or third-party Pack
managers.
An standalone Pack is mainly composed of a set of components offering a services that fulfil a common
functionality (such as BSP Class or Middleware Class). Function Packs are typically:
• Packs based on a BSP driver high-level APIs and containing a set of applications built around the BSP
Class services (such as MEMS Pack).
• Packs based on a single middleware class with a set of applications relative to the middleware class (such
as Wireless or File system) and containing optionally a set of utilities and driver components required either
by the middleware low-level interfaces or by the applications (such as Lora Pack).
After adding the function Pack in STM32CubeMX, it might be required to configure the different components
through the parameter setting and platform setting menus, as shown below.
STM32CubeMX then generates the selected application project with the required components, according to the
conditions, the interface files and the virtual components (if any) and the selected platform.
Note: 1. The pack application services are centralized in a single entry point that manages the internal modules
services.
2. The MX_Entry_Process () can be omitted for some applications where the processes are either managed
by an RTOS or handled in an asynchronous way through interrupts.
Multicores source files are duplicated for each core leading to two different binaries and sources split into two
folders (CORE_CMx and CORE_CMy). When only one core is running (the other core being off after reset), the
CMx folder level can be omitted as only the master core source files are used (single-core structure).
Multicores project source files are provided for each core. However, the two projects might share some common
code (such as IPCC, Clock or System Configuration). In this case, an additional folder can be added at CMx
folder level. It must contain several subfolders to group together the functional sources in an explicit way. Refer to
Figure 41 and Figure 40 for examples.
Note: • CORE_CMx and CORE_CMy define statements need to be added in the preprocessor symbols.
• The codes running on the two cores can be cooperative or non-cooperative, meaning that they can either
communicate together and share the applications processes or completely work in a standalone way
without interacting.
• When the codes running on each core are not cooperative, they must not alter each other. For example,
they must not share and use common resources without resource management policy.
• When one single core is running (when the other core is off after Reset), the CMx folder level can be
omitted as only the Master core sources files are used.
• When the advanced folder structure is applied (application level), the repository model is applied for each
core when need be (see Figure 42).
From project settings point of view, the TrustZone® projects are organized into one single workspace file (*.eww),
one single startup file, two project file (*.ewp) and two debugger settings file (*.ewd). The secure and non secure
sub-project related project files must be postfixed with the “_s” and “_ns” postfix, respectively:
• Project.eww
• Project_s.ewp
• Project_ns.ewp
• Project_s.ewd
• Project_ns.ewd
• stm32ynnnxx_flash{sram}_s.icf
• stm32ynnnxx_flash{sram}_ns.icf
• startup_stm32ynnnxx.s
The TrustZone® secure and non-secure subprojects for a given project are visible in the same IDE instance, and
thus the debugger can be launched at the same time for the secure and the non secure subprojects in the same
IDE instance.
The TrustZone® projects source files are provided for secure and non-secure projects. However, the two projects
might share some common code (such as OS services or System). In this case, an additional folder can be added
at the IDE folder level. It must contains several subfolders to group together the functional sources in explicit way.
8 STM32Cube multipacks
This approach prevents from having Pack interdependencies at application level and handling the common
system and BSP resources for each Pack. The multipack integration leads to the creation of a new applicative
code (new Pack) with a dependency with the two initial Function Pack components resolved through intrinsic
conditions. The following example shows how MEMS and BLE standalone Packs can coexist.
Revision history
Table 16. Document revision history
Contents
1 Reference documents . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
2 Acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3
3 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .4
4 STM32Cube MCU Package architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.1 Overview of STM32Cube MCU Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Overview of STM32Cube MCU Package architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.3 Packaging model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.4 Project organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
5 STM32Cube firmware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .13
5.1 Component concept . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
5.2 Component interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Component description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.4 Component interaction model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
5.5 Virtual components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6 STM32Cube Pack architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21
6.1 CMSIS Pack overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.2 CMSIS Pack component organization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
6.3 CMSIS Pack component location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
6.4 Description of CMSIS Pack components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
6.4.1 Description of HAL drivers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4.2 Description of CMSIS drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.4.3 Description of BSP components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
6.4.4 Description of BSP Class drivers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.4.5 Description of middleware components. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.4.6 Description of Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
6.4.7 Description of applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
7 STM32Cube standalone Packs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36
7.1 Application architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.2 Module definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
7.3 Multicore considerations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
7.4 Arm®TrustZone® considerations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
8 STM32Cube multipacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .44
8.1 Overview of STM32Cube multipacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
8.2 Multipack usage policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
List of tables
Table 1. List of acronyms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Table 2. Firmware component interface availability in native STM32Cube MCU Packages. . . . . . . . . . . . . . . . . . . . . . . 18
Table 3. HAL driver element usage. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Table 4. CMSIS driver element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Table 5. BSP element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 6. BSP CGroup list . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Table 7. STMicroelectronics board element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 8. Extension board element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Table 9. Custom board element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 10. Csub list for BSP Class drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Table 11. Middleware element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Table 12. Cclass list for middleware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Table 13. Utility element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Table 14. Cgroup/Csub list for Utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
Table 15. Application element usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Table 16. Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
List of figures
Figure 1. STM32Cube components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Figure 2. STM32Cube MCU Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Figure 3. STM32Cube MCU Package architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 4. STM32Cube MCU Package directory scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
Figure 5. STM32Cube MCU Package directory scheme: Release_Notes folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 6. STM32Cube MCU Package directory scheme: Documentation folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 7. STM32Cube MCU Package directory scheme: Drivers folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 8. STM32Cube MCU Package directory scheme: Middleware folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Figure 9. STM32Cube MCU Package directory scheme: Projects folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Figure 10. STM32Cube MCU Package directory scheme: Utilities folder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Figure 11. Basic folder structure. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 12. Advanced folder structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 13. Project folder structure for independent middleware application modules . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 14. Project folder structure for LoRaWAN® application module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 15. STM32Cube firmware components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 16. STM32Cube firmware component interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 17. Firmware component internal interfaces. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 18. Firmware component external interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 19. Firmware component detailed description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 20. Component Pack structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 21. Single interface firmware component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 22. Dual interface firmware component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 23. Multiple interface firmware component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 24. Firmware component interaction model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Figure 25. Example of firmware component full interaction using USB Device middleware . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 26. Replacing missing BSP services by a virtual component . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
Figure 27. Content of the CMSIS Pack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
Figure 28. CMSIS component architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Figure 29. CMSIS Pack component location . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Figure 30. PDSC format for HAL drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Figure 31. CMSIS driver folder organization. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
Figure 32. PDSC format for BSP drivers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Figure 33. BSP Class driver: external component implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Figure 34. Arm CMSIS Pack project samples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Figure 35. Selecting function Packs in STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Figure 36. Configuring components in STM32CubeMX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Figure 37. Module folders and calls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Figure 38. Application folder structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Figure 39. Example of multicore project structure for STM32WL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
Figure 40. Multicore project structure with common files - example 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Figure 41. Multicore project structure with common files - example 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
Figure 42. Example of multicore-project advanced-folder structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
Figure 43. TrustZone® project high-level folder structure . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Figure 44. Example of TrustZone® project folder structure for STM32L5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Figure 45. TrustZone® project folder structure with common files . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
Figure 46. Building multipacks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Figure 47. Example of MEMS and BLE coexistence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44