HAL and LL drivers’ folder structure

The HAL folder is organized as follows:

hal/
  ├── stm32tnxx/
      ├── .config/
      ├── deprecated/
      ├── doc/
      ├── hal/
      ├── ll/
      ├── os_port/
      ├── templates/
      ├── timebases/
      ├── utils/
      ├── license.md
      ├── README.md
      ├── Release_Notes.html
      └── STMicroelectronics.stm32tnxx_hal.pdsc
  • .config subfolder contains the configuration artifacts, including the HAL driver configuration parameters and templates, and other configuration helpers.

  • deprecated subfolder contains the required files to describe the deprecated APIs and ensure transition to the new APIs. The deprecated files are used when a compatibility break occurs between two HAL2 versions. It is not intended to ensure backward compatibility with Cube 1.x HAL.

  • doc subfolder contains the dependencies .md files that list the dependencies table of the different HAL components.

  • hal subfolder provides the STM32 HAL drivers. This folder provides the HAL source and header files stm32tnxx_hal_ppp.c/.h. The HAL core drivers (e.g., stm32tnxx_usb_core.c/.h, stm32tnxx_fmc_core.c/.h, …) are also placed in this folder.

  • ll subfolder provides the stm32 LL drivers. This folder provides the LL header files stm32tnxx_ll_ppp.h. Note that the LL source files stm32tnxx_ll_ppp.c have been removed.

  • os_port subfolder provides a HAL OS abstraction layer. Services within this OSAL are limited to semaphore and mutex usage; it is intended to be used by the HAL but can also be used by any other layer that needs to abstract these services. The os_port supports FreeRTOS, and a no-OS variant.

  • templates subfolder contains the template source files that need to be copied and customized into the user application when using the HAL in standalone mode (without code generation). As an example, the HAL conf header file must be copied and customized into the user application.

  • timebases subfolder provides the HAL time base implementation with three possible flavors: based on TIMER, based on RTC alarm, and based on RTC wakeup. These are ready-to-use components that are not configurable. Nevertheless, these components require the corresponding peripheral TIMER or RTC to be initialized and configured either through the configuration or by the user when in standalone mode (without code generation). In the case of a standalone application (without code generation) and depending on the peripheral used as HAL time base (RTC or TIMER), the user needs to copy and customize the corresponding mx_timx.c/.h or mx_rtc.c/.h TIM/RTC file from the template subfolder.

  • utils subfolder provides the HAL utilities modules:

    Example: utils/i2c_timing/stm32_utils_i2c.c/.h allows calculating the I2C timing values needed by HAL_I2C_Init.

  • The release notes, README, license, and the pdsc files that list the given series HAL pack content and components are provided directly under the top driver folder.