Resources configuration ¶
STM32 hardware resources ¶
Files ¶
The STM32 microcontroller and its peripherals are configured in the
mx_
prefixed files. These files are in the
hal/
sub-folder of the
[board_name]/generated/
folder.
Each
mx_[pppi].c
file corresponds to the configuration of a specific peripheral (for example:
mx_adc1.c
,
mx_i2c1.c
, etc…).
These
mx_[pppi].c/h
files can be integrated in your own application to re-use the configuration from the example.
The aliases to address the board parts in use in the example are defined in the
mx_
prefixed files in the
parts/
subfolder of the
[board_name]/generated/
folder.
The hardware resources that the part drivers use are configured in the
mx_
prefixed files. These files are in the
hal/
subfolder of the
[board_name]/generated/
folder.
Services ¶
Each
mx_pppi.c/h
file provides the following services to configure their drivers:
-
HAL:
-
initialization and configuration of the peripheral
-
get the peripheral handle
-
deinitialization of the peripheral
-
-
LL:
-
initialization and configuration of the peripheral
-
These services are called from the
app_init()
and
app_deinit()
functions in
example.c
.
Each part driver provides an interface to use the board parts thanks to a
[part.h]
file included through the
mx_[part].h
file.
The applicative code (typically in
example.c
) can use these
[part.h]
APIs with the definitions in the
mx_[part].h
file.
Naming conventions ¶
The example code is designed to be hardware-agnostic.
Therefore, the code in
example.c
does not use the STM32 peripheral instance names.
The STM32 peripheral instance names are used in the
mx_
prefixed files to configure the STM32 microcontroller and its peripherals.
These files expose their services to the example code through a set of aliases defined in
mx_hal_def.h
.
All these identifiers are prefixed with
MX_
for the constants and
mx_
for the functions.
The identifiers to address the board parts are prefixed with
MX_
for the constants and
mx_
for the functions.
Other resources ¶
In this revision of the document, we focus only on the STM32 microcontroller and its peripherals, and the parts of the STM32 board.