An important layer in the HAL is the OSAL: Operating System Abstraction Layer. The purpose of the OSAL is to enable the HAL drivers to be fully RTOS-aware without having to be bound to any specific RTOS.

What is the OSAL

The OSAL is the specification of an RTOS API subset sufficient to support the HAL. This API can be, in principle, implemented over any RTOS but it is designed to be usable even without a real RTOS.


  • Very lightweight abstraction over an RTOS. Most functions can be implemented as macros or inline functions, minimal overhead.
  • The OSAL services can also be conveniently used by the application if an RTOS is not available.
  • Abstracted RTOS services: critical zones, ISR handling, ISR-task synchronization, I/O timeouts, mutual exclusion, events.
  • The OSAL can also be used alone, without HAL, if an RTOS abstraction is required for 3rd parties software. We encourage adoption of OSAL by software developers.
  • OSAL templates available, implementing an OSAL just means filling the templates.

Available OSALs

The ChibiOS distribution contains OSALs for:

  • ChibiOS/RT on any architecture.
  • ChibiOS/NIL on any architecture.
  • RTOS-less ARM Cortex-M CMSIS-compliant systems.
  • RTOS-less Power Architecture e200z systems.

The OSAL has also been successfully implemented on 3rd parties RTOSes.

Code Portability

Is code portability really possible using HAL? What are the limitations?

learn more