Nios® II Software Developer Handbook

ID 683525
Date 8/28/2023
Public
Document Table of Contents

8.12. Overriding the HAL Default Device Drivers

All components can elect to provide a HAL device driver.

For more information, refer to “Integrating a Device Driver in the HAL” on page 7–17.

However, if the driver supplied with a component is inappropriate for your application, you can override the default driver by supplying a different driver.

In the Nios® II SBT for Eclipse, you can use the BSP Editor to specify a custom driver.

For more information about selecting device drivers, refer to “Using the BSP Editor” in the "Getting Started with the Graphical User Interface" chapter.

On the command line, you specify a custom driver with the following BSP Tcl command:

set_driver <driver name> <component name>

For example, if you are using the nios2-bsp command, you replace the default driver for uart0 with a driver called custom_driver as follows:

nios2-bsp hal my_bsp --cmd set_driver custom_driver uart0r