This Answer Record will discuss how to use the HSI tool to create a custom driver to populate the xparameters.h file in SDK.
Step 1: Create the IP in IP packager.
Here, an AXILite IP was created with the interrupt enabled.
This IP was then added to the Block Design in Vivado IP Integrator.
The BD can be seen below.
The custom IP; myip_0 can be see here.
Step 2: Explore the HW design using HSI
When exporting to SDK, a HDF file will be created.
This HDF file can be opened in HSI, and the hardware can be explored.
In SDK, launch the SDK shell, then launch HSI, and navigate to the HW_platform (this is where the HDF resides):
Open the HW design in HSI using the command below:
You can see all of the IP in the design using the command below:
You can see all the properties of an IP (in this case, myip_0) using the command below:
list_property [get_cells myip_0]
You can now list all of the pins on an IP (in this case, myip_0) using the command below:
get_pins -of_objects [get_cells myip_0]
You can see all clock pins on an IP (in this case, myip_0) using the command below:
get_pins -of_objects [get_cells myip_0] -filter TYPE==clk
You can view the properties of a pin using the command below:
list_property [get_pins <pins_name>]
You can read a property (for example the CLK_FREQ) using the command below:
get_property CLK_FREQ [get_pins <pin_name>]
In the IP that was created in Step 1, the Interrupt was enabled.
You can use the built-in utils in HSI to see if a pin is connected.
This can be used to see if the interrupt pin is connected.
This is shown in the commands below:
set int_pin [get_pins -of_objects [get_cells myip_0] -filter TYPE==INTERRUPT]
set intc_type [:hsi::utils::get_connected_intr_controller myip_0 $int_pin]
With all of this in mind, you can update the driver files using the HSI commands.
For more information on the HSI command, see (UG1138)
Step 3: Update the driver TCL file
In the driver files created from the IP Packager in step 1, open the TCL file in the data folder. This TCL file is ran during the BSP generation in SDK.
Here, this file will be updated to add the clock frequencies of the custom IP clock pins, and if the interrupt is connected using the commands discussed in step 2.
The updated TCL can be seen below:
Here, a custom proc was added.
This proc is called by the main proc in the TCL (generate), which is called during BSP generation.
The custom proc does the following:
To test, source this TCL and run the custom proc.
To use the test file, pass the test parameter.
This will generate a test.txt file in the same directory as the TCL.
This can be opened and verified.
This should look like the following:
Step 4: Test the BSP
Once users are happy with the Tcl script, this can then be tested in SDK.
Add the custom driver to the repository in SDK. Xilinx Tools -> Repositories
Rescan Repositories -> Apply -> OK
Generate the BSP, and view the generated xparameters.h file.
This should contain the custom info:
Note: The driver used in this demo has been attached to this Answer Record.