Nios® V Processor Software Developer Handbook

ID 743810
Date 10/12/2024
Public
Document Table of Contents

5.2.4.2. Managing Device Drivers

The BSP Editor creates an alt_sys_init.c file. By default, the BSP Editor assumes that if a device is connected to the Nios V processor, and a driver is available, the BSP must include the most recent version of the driver. However, you might want to use a different version of the driver, or you might not want a driver at all (for example, if your application accesses the device directly).

The BSP Editor includes BSP Tcl commands to manage device drivers. With these commands you can control which driver is used for each device. When the alt_sys_init.c file is generated, it is set up to initialize drivers as you have requested.

If you are using niosv-bsp, you can disable the driver for the uart0 device as follows:

When creating a new BSP:
niosv-bsp --create --qsys=<Platform Designer system> --type=hal 
--cmd=”set_driver none uart0” settings.bsp
When updating an existing BSP:
niosv-bsp --update --cmd=”set_driver none uart0” settings.bsp

Use the --cmd option to call a Tcl command on the command line. Alternatively, you can put the set_driver command in a Tcl script and pass the script to niosv-bsp or with the --script option.

You replace the default driver for uart0 with a specific version of a driver as follows:

When creating a new BSP:
niosv-bsp --create --qsys=<Platform Designer system> --type=hal
--cmd=”set_driver altera_avalon_uart:6.1 uart0” settings.bsp
When updating an existing BSP:
niosv-bsp --update --cmd=”set_driver altera_avalon_uart:6.1 uart0” settings.bsp

If you update your BSP, you must provide the original command line options again to prevent the default Tcl script from choosing its own default device drivers.