Glossary · 5 · Hardware SDKs and devices
Hardware abstraction layer (HAL)
Also known as: HAL
German: Hardware-Abstraktionsschicht (HAL)
In software engineering, a hardware abstraction layer (HAL) is a layer of software with a standard interface that hides the differences between hardware implementations, so that higher-level software such as an operating system, a framework or an application can use differing devices in the same way while hardware vendors implement the device-specific part below the interface.
- Hardware SDK
- Embedded systems
In one sentence
A hardware abstraction layer (HAL) gives software a standard interface to differing hardware; vendors implement the device-specific part beneath it.
Example
A sensor framework calls the same read function on every phone, while each manufacturer implements that function for its own sensor chip in the HAL.
How it applies
- Hardware SDKs: The HAL is the layer that lets a kit's upper libraries run on several chips or boards. Microcontroller vendors ship HALs for their peripherals; real-time operating systems define driver interfaces with the same purpose. Code written against the HAL moves to new hardware when an implementation of the HAL exists for it. See abstraction.
- Operating systems: The Android Open Source Project defines a HAL as a type of abstraction layer with a standard interface for hardware vendors to implement, allowing vendors to implement lower-level, device-specific features without affecting or modifying code in higher-level layers.
- Relation to drivers: A device driver operates one device or device class; a HAL defines the uniform interface that drivers or vendor modules implement. In small embedded systems the two are often combined in one library, on top of the board support package.
- Developer and platform SDKs: Higher-level SDKs (graphics, XR, AI runtimes) rely on vendor implementations below them in the same way, which is why their compatibility lists name drivers and runtime versions.
- Documentation: Document the HAL interface as a contract (functions, timing, error behavior, threading) and, separately, the implementations per hardware with their deviations. A function that a HAL implementation does not support should fail in a documented way.
HAL vs. board support package
The HAL is the interface that stays the same across hardware. A board support package (BSP) is the board-specific implementation and configuration underneath it. Porting software means implementing the HAL for new hardware, usually as part of a new BSP.
External references
- Android Open Source Project: Hardware abstraction layer (HAL) overview