Nios® V Processor Software Developer Handbook

ID 743810
Date 7/20/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

6.11.7. Eliminate Unused Device Drivers

If a hardware device is present in the system, by default the Nios® V processor tools assume the device needs drivers, and configures the HAL BSP accordingly. If the HAL can find an appropriate driver, it creates an instance of this driver. If your program never actually accesses the device, resources are being used unnecessarily to initialize the device driver.

If the hardware includes a device that your program never uses, consider removing the device from the hardware. This reduces both code footprint and FPGA resource usage.

However, there are cases when a device must be present, but runtime software does not require a driver. The most common example is flash memory. The user program might boot from flash, but not use it at runtime; thus, it does not need a flash driver. You can selectively omit any individual driver, select a specific driver version, or substitute your own driver.

For more information about controlling driver configurations, refer to the Nios® V Processor Board Support Package Editor chapter.

Another way to control the device driver initialization process is to use the free-standing environment. For more information, refer to the Boot Sequence and Entry Point chapter.

Unlike common device drivers, timer drivers have dedicated HAL settings. If you are not using HAL system clock or timestamp functionality, you can disable the settings to eliminate the unused timer driver. Configure as such:
set_setting hal.sys_clk_timer {none}
set_setting hal.timestamp_timer {none}