HAL and LL drivers’ folder structure

The HAL folder is organized as follow:

hal/
  |-- stm32tnxx/
      |-- _htmresc/
      |-- hal/
      |-- ll/
      |-- os_port/
      |-- templates/
      |-- timebases/
      |-- utils/
      |-- license.md
      |-- license.txt
      |-- README.html
      |-- README.md
      |-- Release_Notes.html
      `-- STMicroelectronics.stm32tnxx_hal.pdsc
  • .config subfolder contains the configuration artefacts including the HAL drivers configuration parameters and templates, and any other configuration helpers.

  • 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 (w/o 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 3 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 (w/o 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 allowing to calculate the I2C timing values needed by the HAL_I2C_Init .

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