1. Introduction[edit source]
This article introduces STM32Cube MP1 Package architecture based on the Armยฎ Cortexยฎ-M processor (e.g. Arm Cortex-M4)
- Please refer to STM32Cube MP1 Package article to get started.
2. STM32Cube MP1 Package architecture[edit source]
The STM32Cube MP1 Package gathers together, in a single package, all the generic embedded software components required to develop applications on top of Cortex-M microprocessors.
On top of the hardware, the STM32Cube MP1 Package solution is built around three levels of software components (Level 0 for Drivers, level 1 for Middlewares, Level 2 for Boards demonstrations), that interact easily with each other. It also includes 2 common components CMSIS and Utilities which interact with all three levels.
2.1. Level 0 (Drivers)[edit source]
This level is divided into three software components:
- Hardware Abstraction Layer (HAL)
- Low Layer (LL)
- Board Support Package (BSP)
2.1.1. HAL drivers[edit source]
The HAL drivers provide the low level drivers and the hardware interfacing methods to interact with the upper layers (application, libraries and stacks). They provide generic, multi instance and function-oriented APIs which simplify user application implementation by providing ready-to-use processes.
As example, for the communication peripherals (I2C, UARTโฆ), they include APIs allowing to initialize and configure the peripheral, to manage data transfer based on polling, interrupt or DMA process, and to handle communication errors that may raise during communication.
2.1.1.1. HAL drivers overview[edit source]
The HAL APIs layer is composed of native and extended APIs set. It is directly built around a generic architecture and allows the build-upon layers, like the middleware layer, to implement its functions without in-depth knowledge about the used STM32 device. This improves the library code reusability and guarantees an easy portability on other devices and STM32 families
Contrary to the low layer drivers (see HAL Low Layer section), the HAL ones are functionality-oriented and not IP-oriented, Example: for the Timer peripheral, the APIs could be split into several categories following the functions offered by the IPs (Basic timer, capture, PWM โฆetc.).
The HAL Drivers are a set of common APIs with a high compliancy level with most of the clients available on the market (stacks) called native APIs and embed also some extended functionalities for special services or a combination of several features offered by the STM32 peripherals
The HAL drivers APIs are split in two categories:
- Generic APIs which provide common and generic functions to all the STM32 Series
- Extension APIs which provide specific customized functions for a specific family or a specific part number
2.1.1.2. List of HAL drivers[edit source]
Please find hereafter the list of HAL drivers available for STM32MP1xx familyย :
Legend: (HAL drivers added since ecosystem release โฅ v2.1.0) โโโ stm32mp1xx_hal_adc.c ADC HAL Driver โโโ stm32mp1xx_hal_adc_ex.c ADC Extended HAL Driver โโโ stm32mp1xx_hal_cec.c CEC HAL Driver โโโ stm32mp1xx_hal_cortex.c CORTEX HAL Driver โโโ stm32mp1xx_hal_crc.c CRC HAL Driver โโโ stm32mp1xx_hal_crc_ex.c CRC Extended HAL Driver โโโ stm32mp1xx_hal_cryp.c CRYP HAL Driver โโโ stm32mp1xx_hal_cryp_ex.c CRYP Extended HAL Driver โโโ stm32mp1xx_hal_dac.c DAC HAL Driver โโโ stm32mp1xx_hal_dac_ex.c DAC Extended HAL Driver โโโ stm32mp1xx_hal_dcmi.c DCMI HAL Driver โโโ stm32mp1xx_hal_dfsdm.c DFSDM HAL Driver โโโ stm32mp1xx_hal_dfsdm_ex.c DFSDM Extended HAL Driver โโโ stm32mp1xx_hal_dma.c DMA HAL Driver โโโ stm32mp1xx_hal_dma_ex.c DMA Extended HAL Driver โโโ stm32mp1xx_hal_exti.c EXTI HAL Driver โโโ stm32mp1xx_hal_fdcan.c FDCAN HAL Driver โโโ stm32mp1xx_hal_gpio.c GPIO HAL Driver โโโ stm32mp1xx_hal_gpio_ex.c GPIO Extended HAL Driver โโโ stm32mp1xx_hal_hash.c HASH HAL Driver โโโ stm32mp1xx_hal_hash_ex.c HASH Extended HAL Driver โโโ stm32mp1xx_hal_hsem.c HSEM HAL Driver โโโ stm32mp1xx_hal_i2c.c I2C HAL Driver โโโ stm32mp1xx_hal_i2c_ex.c I2C Extended HAL Driver โโโ stm32mp1xx_hal_ipcc.c IPCC HAL Driver โโโ stm32mp1xx_hal_lptim.c LPTIM HAL Driver โโโ stm32mp1xx_hal_mdios.c MDIOS HAL Driver โโโ stm32mp1xx_hal_mdma.c MDMA HAL Driver โโโ stm32mp1xx_hal_pwr.c PWR HAL Driver โโโ stm32mp1xx_hal_pwr_ex.c PWR Extended HAL Driver โโโ stm32mp1xx_hal_qspi.c QSPI HAL Driver โโโ stm32mp1xx_hal_rcc.c RCC HAL Driver โโโ stm32mp1xx_hal_rcc_ex.c RCC Extended HAL Driver โโโ stm32mp1xx_hal_rng.c RNG HAL Driver โโโ stm32mp1xx_hal_rtc.c RTC HAL Driver โโโ stm32mp1xx_hal_rtc_ex.c RTC Extended HAL Driver โโโ stm32mp1xx_hal_sai.c SAI HAL Driver โโโ stm32mp1xx_hal_sai_ex.c SAI Extended HAL Driver โโโ stm32mp1xx_hal_sd.c SD HAL Driver โโโ stm32mp1xx_hal_smartcard.c SMARTCARD HAL Driver โโโ stm32mp1xx_hal_smartcard_ex.c SMARTCARD Extended HAL Driver โโโ stm32mp1xx_hal_smbus.c SMBUS HAL Driver โโโ stm32mp1xx_hal_spdifrx.c SPDIFRX HAL Driver โโโ stm32mp1xx_hal_spi.c SPI HAL Driver โโโ stm32mp1xx_hal_spi_ex.c SPI Extended HAL Driver โโโ stm32mp1xx_hal_sram.c FMC HAL Driver (for PSRAM) โโโ stm32mp1xx_hal_tim.c TIM HAL Driver โโโ stm32mp1xx_hal_tim_ex.c TIM Extended HAL Driver โโโ stm32mp1xx_hal_uart.c UART HAL Driver โโโ stm32mp1xx_hal_uart_ex.c UART Extended HAL Driver โโโ stm32mp1xx_hal_usart.c USART HAL Driver โโโ stm32mp1xx_hal_usart_ex.c USART Extended HAL Driver โโโ stm32mp1xx_hal_wwdg.c WWDG HAL Driver
2.1.2. LL drivers[edit source]
The Low Layer (LL) drivers offer a fast light-weight expert-oriented layer which is closer to the hardware than the HAL. The LL APIs are available only for a set of peripherals
2.1.2.1. Low Layer drivers overview[edit source]
The Low Layer (LL) drivers are part of the STM32Cube firmware HAL that provides basic set of optimized and one-shot services. The Low layer drivers, contrary to the HAL ones are not Fully Portable across the STM32 families; the availability of some functions depends on the physical availability of the relative features on the product.
The Low Layer (LL) drivers are designed to offer the following features:
- New set of inline functions for direct and atomic register access
- One-shot operations that can be used by the HAL drivers or from application level.
- Fully independent from HAL and can be used in standalone usage (without HAL drivers)
- Full feature coverage of all the supported peripherals
2.1.2.2. List of LL drivers[edit source]
Please find hereafter the list of LL drivers available for STM32MP1xx familyย :
โโโ stm32mp1xx_ll_adc.h ADC LL Driver โโโ stm32mp1xx_ll_bus.h BUS LL Driver โโโ stm32mp1xx_ll_cortex.h CORTEX LL Driver โโโ stm32mp1xx_ll_dma.h DMA LL Driver โโโ stm32mp1xx_ll_dmamux.h DMAMUX LL Driver โโโ stm32mp1xx_ll_exti.h EXTI LL Driver โโโ stm32mp1xx_ll_gpio.h GPIO LL Driver โโโ stm32mp1xx_ll_hsem.h HSEM LL Driver โโโ stm32mp1xx_ll_i2c.h I2C LL Driver โโโ stm32mp1xx_ll_ipcc.h IPCC LL Driver โโโ stm32mp1xx_ll_lptim.h LPTIM LL Driver โโโ stm32mp1xx_ll_pwr.h PWR LL Driver โโโ stm32mp1xx_ll_rcc.h RCC LL Driver โโโ stm32mp1xx_ll_rtc.h RTC LL Driver โโโ stm32mp1xx_ll_spi.h SPI LL Driver โโโ stm32mp1xx_ll_sram.h FMC LL Driver (for PSRAM) โโโ stm32mp1xx_ll_system.h SYSTEM LL Driver (SYSCFG & DBGMCU) โโโ stm32mp1xx_ll_tim.h TIM LL Driver โโโ stm32mp1xx_ll_usart.h USART LL Driver โโโ stm32mp1xx_ll_utils.h UTILITIES LL Driver โโโ stm32mp1xx_ll_wwdg.h WWDG LL Driver
2.1.3. BSP drivers[edit source]
The BSP drivers are firmware components based on the HAL drivers and provide a set of APIs relative to the hardware components in the evaluation boards coming with the STM32Cube Package. All examples and applications given with the STM32Cube are based on these BSP drivers.
2.1.3.1. BSP drivers overview[edit source]
The BSP architecture proposes a new model that prevents some Standard library weaknesses and provides more features:
- Portable external resources code (components): the external components could be used by all STM32 families.
- Multiple use of hardware resources without duplicated initialization: example: I2C Physical Layer could be used for several EVAL Drivers
- Intuitive functionalities based on high level use case
- Portable BSP drivers for different external devices
2.1.3.2. List of BSP drivers[edit source]
The BSP drivers offer a set of APIs relative to the hardware components available in the hardware boards (LEDs, Buttons and COM port).
โโโ STM32MP15xx_DISCO โย ย โโโ bumpversion.cfg โย ย โโโ Release_Notes.html โย ย โโโ STM32MP15xx_DISCO_BSP_User_Manual.chm โย ย โโโ stm32mp15xx_disco_bus.c โย ย โโโ stm32mp15xx_disco_bus.h โย ย โโโ stm32mp15xx_disco.c โย ย โโโ stm32mp15xx_disco_conf_template.h โย ย โโโ stm32mp15xx_disco_errno.h โย ย โโโ stm32mp15xx_disco.h โย ย โโโ stm32mp15xx_disco_stpmic1.c โย ย โโโ stm32mp15xx_disco_stpmic1.h โโโ STM32MP15xx_EVAL โย ย โโโ bumpversion.cfg โย ย โโโ Release_Notes.html โย ย โโโ STM32MP15xx_EVAL_BSP_User_Manual.chm โย ย โโโ stm32mp15xx_eval_bus.c โย ย โโโ stm32mp15xx_eval_bus.h โย ย โโโ stm32mp15xx_eval.c โย ย โโโ stm32mp15xx_eval_conf_template.h โย ย โโโ stm32mp15xx_eval_errno.h โย ย โโโ stm32mp15xx_eval.h โย ย โโโ stm32mp15xx_eval_stpmic1.c โย ย โโโ stm32mp15xx_eval_stpmic1.h
2.2. Level 1 (Middlewares)[edit source]
Middleware components are a set of libraries providing a set of services. STM32Cube MP1 Package offers 2 main componentsย : OpenAMP and FreeRTOS
Each middleware component is mainly composed of:
- Library core: this is the core of a component; it manages the main library state machine and the data flow between the several modules.
- Interface layer: the interface layer is generally used to link the component core with the lower layers like the HAL and the BSP drivers
2.2.1. OpenAMP[edit source]
OpenAMP is a library implementing the Remote Processor Service framework (RPMsg) which is a messaging mechanism to communicate with a remote processor.
- Load and control Cortexยฎ-M firmware
- Inter processor communication
2.2.2. FreeRTOS[edit source]
FreeRTOS is a Free Real Time Operating System (RTOS). The FreeRTOS offers preemptive real-time performance with optimized context switch and interrupt times, enabling fast, highly predictable response times.
It includes the following main featuresย :
- Small memory fingerprint
- High portability
- Multithread management
- Pre-emptive scheduling
- Fast interrupt response
- Extensive inter-pocess communication
- Synchronization facilities
- Tickless operation during low-power mode
- Open source standard
- CMSIS compatibility layer
2.3. Level 2 (Boards demonstrations)[edit source]
The Boards demonstrations level is composed of a single layer which provides all Examples and Applications. It includes also all STM32CubeIDE projects for each supported board as well as Templates source files.
There are 4 kinds of projects demonstrating different usages of software APIs from level 0 (Drivers) and level 1 (Middleware):
- Examples projects showing how to use HAL APIs and Low Layer drivers if any (Level 0) with very basic usage of BSP layer (buttons and LEDs in general)
- Applications projects showing how to use the middleware components (Level 1) and how to integrate them with the hardware and BSP/HAL layers (Level 0). These applications could be hybrid and use several other middleware components.
- Demonstrations projects showing how to integrate and run a maximum number of peripherals and Middleware stacks to showcase the product features and performance
- Templates projects is a really basic user application including IDE projects files, which could be used to start a custom project
2.4. Utilities[edit source]
The Utilities is a set of common utilities and services offered by STM32Cube MP1 Package and is composed of different componentsย :
โโโ Utilities
โโโ ResourcesManager Services for coprocessing in multi-core devices. Refer to Resource_manager_for_coprocessing
2.5. CMSIS[edit source]
The Cortex Microcontroller Software Interface Standard (CMSIS) is a vendor-independent hardware abstraction layer for the Cortex-M processor series.
- Please refer to article CMSIS to get more information on CMSIS component
The CMSIS component also provides specific common ressources for device support. It enables consistent and simple software interfaces to the processor and the peripherals, simplifying software re-use, reducing the learning curve for microcontroller developers, and reducing the time to market for new devices
This vendor part is called CMSIS Device and it provides interrupt list, peripherals registers description and associated defines for all registers bit fields.
- CMSIS structure overview:
โโโ CMSIS โย ย โโโ Core โย ย โย ย โโโ Include โย ย โย ย โโโ Template โย ย โโโ Core_A โย ย โย ย โโโ Include โย ย โย ย โโโ Template โย ย โโโ Device CMSIS Device โย ย โย ย โโโ ST โย ย โย ย โย ย โโโ STM32MP1xx Common ressources for STM32MP1xx family โย ย โโโ docs โย ย โย ย โโโ Core โย ย โย ย โโโ Core_A โย ย โย ย โโโ DAP โย ย โย ย โโโ Driver โย ย โย ย โโโ DSP โย ย โย ย โโโ General โย ย โย ย โโโ index.html โย ย โย ย โโโ Pack โย ย โย ย โโโ RTOS โย ย โย ย โโโ RTOS2 โย ย โย ย โโโ SVD โย ย โย ย โโโ Zone โย ย โโโ DSP โย ย โย ย โโโ Examples โย ย โย ย โโโ Include โย ย โย ย โโโ Source โย ย โโโ Include โย ย โย ย โโโ cmsis_armcc.h โย ย โย ย โโโ cmsis_armclang.h โย ย โย ย โโโ cmsis_compiler.h โย ย โย ย โโโ cmsis_gcc.h โย ย โย ย โโโ cmsis_iccarm.h โย ย โย ย โโโ cmsis_version.h โย ย โย ย โโโ core_armv8mbl.h โย ย โย ย โโโ core_armv8mml.h โย ย โย ย โโโ core_cm0.h โย ย โย ย โโโ core_cm0plus.h โย ย โย ย โโโ core_cm23.h โย ย โย ย โโโ core_cm33.h โย ย โย ย โโโ core_cm3.h โย ย โย ย โโโ core_cm4.h โย ย โย ย โโโ core_cm7.h โย ย โย ย โโโ core_sc000.h โย ย โย ย โโโ core_sc300.h โย ย โย ย โโโ mpu_armv7.h โย ย โย ย โโโ mpu_armv8.h โย ย โย ย โโโ tz_context.h โย ย โโโ Lib โย ย โย ย โโโ ARM โย ย โย ย โโโ GCC โย ย โโโ LICENSE.txt โย ย โโโ README.md โย ย โโโ RTOS โย ย โย ย โโโ Template โย ย โโโ RTOS2 โย ย โโโ Include โย ย โโโ Source โย ย โโโ Template
- CMSIS Device structureย :
Legend: (Header files added since ecosystem release โฅ v1.2.0 ) (Header files added since ecosystem release โฅ v1.1.0 ) โโโ CMSIS โย ย โโโ Device CMSIS Device โย ย โย ย โโโ ST โย ย โย ย โย ย โโโ |STM32MP1xx Common ressources for STM32MP1xx family โย ย โย ย โย ย โย ย โโโ Include Device ressources definition โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151axx_cm4.h โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151axx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151cxx_cm4.h โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151cxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151dxx_cm4.h --> Added for 800MHz โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151dxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151fxx_cm4.h --> Added for 800MHz โย ย โย ย โย ย โย ย โย ย โโโ stm32mp151fxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153axx_cm4.h โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153axx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153cxx_cm4.h โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153cxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153dxx_cm4.h --> Added for 800MHz โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153dxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153fxx_cm4.h --> Added for 800MHz โย ย โย ย โย ย โย ย โย ย โโโ stm32mp153fxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157axx_cm4.h โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157axx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157cxx_cm4.h โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157cxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157dxx_cm4.h --> Added for 800MHz โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157dxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157fxx_cm4.h --> Added for 800MHz โย ย โย ย โย ย โย ย โย ย โโโ stm32mp157fxx_ca7.h --> Added "as example" โย ย โย ย โย ย โย ย โย ย โโโ stm32mp1xx.h โย ย โย ย โย ย โย ย โย ย โโโ system_stm32mp1xx.h โย ย โย ย โย ย โย ย โโโ Release_Notes.html โย ย โย ย โย ย โย ย โโโ Source โย ย โย ย โย ย โย ย โย ย โโโ Templates โย ย โย ย โย ย โย ย โย ย โย ย โโโ arm linker files and startup files (memory mapping) โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ linker โย ย โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ stm32mp15xx_m4.sct โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ startup_stm32mp15xx.s โย ย โย ย โย ย โย ย โย ย โย ย โโโ gcc linker files and startup files (memory mapping) โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ linker โย ย โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ stm32mp15xx_m4.ld โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ startup_stm32mp15xx.s โย ย โย ย โย ย โย ย โย ย โย ย โโโ iar linker files and startup files (memory mapping) โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ linker โย ย โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ stm32mp15xx_sram.icf โย ย โย ย โย ย โย ย โย ย โย ย โย ย โโโ startup_stm32mp15xx.s โย ย โย ย โย ย โย ย โย ย โย ย โโโ system_stm32mp1xx.c
3. STM32Cube MP1 Package versus legacy STM32Cube MCU Package[edit source]
STM32 MPU devices introduce light differences with STM32 MCU. So please find hereafter a short description of the main differences between STM32Cube MP1 Package and STM32Cube MCU Package:
- The middleware and BSP components offer is smaller in STM32Cube MP1 Package as we can take advantage of a rich OS like Linuxยฎ running on Cortex-A core for networking, USB, visual and audio services
- There is no Flash HAL driver as there is no volatile embedded FLASH dedicated to Cortex-M in MPU devices
- Specific pieces of software have been added to handle multi-core operations:
- OpenAMP middleware for Intercommunication processeur between cortex A and cortex M (RPMsg protocol implementation)
- Resource Manager library for system resource management
- Virtual UART driver (specific usage when Linux is used on Cortex-A)
- Linux script to load STM32Cube MPU firmware running on Cortex-M core (specific usage when Linux is used on Cortex-A)
4. References[edit source]