HAL FreeRTOS Overview

Introducing HAL FreeRTOS

group OS_Introduction

The STM32 HAL OS Abstraction Layer provides a unified interface for operating system (OS) primitives such as semaphores and mutexes, enabling STM32 HAL drivers and middleware to be portable across different OS environments.

This module abstracts the underlying OS-specific mechanisms, allowing application code and drivers to use synchronization primitives without being tightly coupled to a particular RTOS or bare-metal implementation.

The main purpose of this module is to facilitate safe and efficient access to shared resources in both multitasking (RTOS) and single-threaded (No OS) environments. By providing a consistent API, the HAL OS layer enables developers to switch between FreeRTOS and bare-metal (No OS) configurations with minimal code changes, improving code reusability and maintainability.

Module and files

The following diagram illustrates the OSAL module and its associated files.

Module and files diagram

Component diagram

The following diagram illustrates the software components involved in the OSAL module. It shows the interactions between the user application, HAL drivers, low-level drivers, and the hardware components.

The OSAL replaces the current HAL lock management by introducing acquire and release APIs built on the HAL OS abstraction layer (OSAL), in order to simplify user calls for semaphore and mutex services and to provide a transversal, reusable solution that does not depend on any specific operating system.

Module and files diagram

Configuration table

The following table lists the configuration defines for the HAL FreeRTOS, specifying their locations, default values, and descriptions:

group OS_Configuration_Table

Configuration inside the OS driver

Config defines

Description

Default value

Note

USE_HAL_MUTEX

from hal_conf.h

0

Allows HAL PPP drivers to enable HAL PPP acquire/release based on the HAL OS