UM1786
User Manual
Description of STM32F3 HAL and low-layer drivers
Introduction
STMCubeTM is an STMicroelectronics original initiative to make developers' lives easier by reducing
development effort, time and cost. STM32Cube covers the whole STM32 portfolio.
STM32Cube Version 1.x 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 STM32CubeF3 for
STM32F3 Series).
The STM32Cube HAL, STM32 abstraction layer embedded software ensuring maximized
portability across the STM32 portfolio
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 RTOS, USB, TCP/IP, Graphics
All embedded software utilities, delivered with a full set of examples.
The HAL driver layer provides a generic multiinstance simple set of APIs (application programming
interfaces) to interact with the upper layer (application, libraries and stacks).
The HAL driver APIs are split into two categories: generic APIs which provide common and generic
functions for all the STM32 series, and extension APIs which include specific and customized functions
for a given line or part number. The HAL drivers include a complete set of ready-to-use APIs which
simplify the user application implementation. As an example, the communication peripherals contain
APIs to initialize and configure the peripheral, manage data transfers in polling mode, handle interrupts
or DMA, and manage communication errors.
The HAL drivers are feature-oriented instead of IP-oriented. As an example, the timer APIs are split into
several categories following the functions offered by the IP such as basic timer, capture, or pulse width
modulation (PWM). The HAL driver layer implements run-time failure detection by checking the input
values of all functions. Such dynamic checking contributes to enhance the firmware robustness. Run-
time detection is also suitable for user application development and debugging.
The LL drivers offer hardware services based on the available features of the STM32 peripherals. These
services reflect exactly the hardware capabilities and provide atomic operations that must be called
following the programming model described in the product line reference manual. As a result, the LL
services are not based on standalone processes and do not require any additional memory resources to
save their states, counter or data pointers: all operations are performed by changing the associated
peripheral registers content. Contrary to the HAL, the LL APIs are not provided for peripherals for which
optimized access is not a key feature, or for those requiring heavy software configuration and/or
complex upper level stack (such as FSMC or USB).
The HAL and LL drivers are complementary and cover a wide range of applications requirements:
The HAL offers high-level and feature-oriented APIs, with a high-portability level. They hide the
MCU and peripheral complexity to end-user.
The LL offers low-level APIs at registers level, with better optimization but less portability. They
require deep knowledge of the MCU and peripherals specifications.
HAL and LL source code is developed in Strict ANSI-C which makes it independent from the
development tools. It is checked with CodeSonarTM static analysis tool. It is fully documented and is
MISRA-C 2004 compliant.
July 2017
DocID026526 Rev 7
1/1880
www.st.com
全部评论(2)
2023-03-03 13:33:24夜夜风
正需要,感谢楼主分享
2021-02-24 07:26:05杨义
感谢分享