Skip to content

Why We Need Hardware Abstraction Layer (HAL)?

May 28, 2016

In embedded system development, one of the tedious work is to control microcontroller(MCU) hardware through special function register(SFR). Microcontroller hardware such as timer/interrupt/GPIO etc is control through SFR. Applications software that implement business logic will then ride on top of the hardware. From applications perspective, there are 2 way of accesssing the hardware:

  • directly access SFR from application or
  • through HAL(Harwdare Abstraction Layer) API.

HAL-API is a separation layer between application and hardware, any MCU hardware control has to be done by calling this HAL-API layer.

Among the advantages of using HAL-API as lists below:

  • Enforce a design that have clear separation between HAL and application
  • Ease code maintainence. Hardware modification will only inolve code change in HAL. And testing is only require to be perform on HAL layer, without application
  • Ease future migration to a new microcontroller(by re-implementing hardware driver, with application layer unchange)
  • Ease future changes if expansion is require to support external hardware
  • Enable engineers to think and work in modular design



From → Embedded System

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: