Specifications

Overview of the Hardware Abstraction Layer
5
2015.05.14
NII5V2
Subscribe
Send Feedback
The HAL is a lightweight embedded runtime environment that provides a simple device driver interface
for programs to connect to the underlying hardware. The HAL application program interface (API) is
integrated with the ANSI C standard library. The HAL API allows you to access devices and files using
familiar C library functions, such as printf(), fopen(), fwrite(), etc.
The HAL serves as a device driver package for Nios II processor systems, providing a consistent interface
to the peripherals in your system. The Nios II software development tools extract system information
from your SOPC Information File (.sopcinfo). The Nios II Software Build Tools (SBT) generate a custom
HAL board support package (BSP) specific to your hardware configuration. Changes in the hardware
configuration automatically propagate to the HAL device driver configuration. As a result, changes in the
underlying hardware are prevented from creating bugs.
HAL device driver abstraction provides a clear distinction between application and device driver software.
This driver abstraction promotes reusable application code that is resistant to changes in the underlying
hardware. In addition, the HAL standard makes it straightforward to write drivers for new hardware
peripherals that are consistent with existing peripheral drivers.
Getting Started with the Hardware Abstraction Layer
The easiest way to get started using the HAL is to create a software project. In the process of creating a
new project, you also create a HAL BSP. You need not create or copy HAL files, and you need not edit any
of the HAL source code. The Nios II SBT generates the HAL BSP for you.
For more information about an exercise in creating a simple Nios II HAL software project, refer to
“Getting Started with Eclipse” in the Getting Started with the Graphical User Interface chapter of the Nios
II Software Developer’s Handbook.
In the Nios II SBT command line, you can create an example BSP based on the HAL using one of the
create-this-bsp scripts supplied with the Nios II Embedded Design Suite.
You must base the HAL on a specific hardware system. A Nios II system consists of a Nios II processor
core integrated with peripherals and memory. Nios II systems are generated by Qsys or SOPC Builder.
If you do not have a custom Nios II system, you can base your project on an Altera-provided example
hardware system. In fact, you can first start developing projects targeting an Altera
®
development board,
and later re-target the project to a custom board. You can easily change the target hardware system later.
For more information about creating a new project with the Nios II SBT, refer to the Getting Started with
the Graphical User Interface chapter of the Nios II Software Developer’s Handbook.
©
2015 Altera Corporation. All rights reserved. ALTERA, ARRIA, CYCLONE, ENPIRION, MAX, MEGACORE, NIOS, QUARTUS and STRATIX words and logos are
trademarks of Altera Corporation and registered in the U.S. Patent and Trademark Office and in other countries. All other words and logos identified as
trademarks or service marks are the property of their respective holders as described at www.altera.com/common/legal.html. Altera warrants performance
of its semiconductor products to current specifications in accordance with Altera's standard warranty, but reserves the right to make changes to any
products and services at any time without notice. Altera assumes no responsibility or liability arising out of the application or use of any information,
product, or service described herein except as expressly agreed to in writing by Altera. Altera customers are advised to obtain the latest version of device
specifications before relying on any published information and before placing orders for products or services.
ISO
9001:2008
Registered
www.altera.com
101 Innovation Drive, San Jose, CA 95134