Testing UIO with Interrupt on Zynq Ultrascale
Building the Hardware
To evaluate this flow, I have used the AXI GPIO in the Programmable Logic with the interrupt enabled, and connected to the PS IRQ:
Generate the Output Products, Create HDL wrapper, Generate Bitstream and Export to SDK to create the HDF
Create the Linux Image in Petalinux
Here, I used Petalinux 2017.4 to create the Image with the steps below:
petalinux-create -t project --template zynqMP -n linux_images
cd linux_images
petalinux-config --get-hw-description=<path to HDF>
DTG Settings → (zcu102-rev1.0) MACHINE_NAME
petalinux-config -c kernel
For Petalinux < 2019.1:
Device Drivers -> Userspace I/O drivers
<*> Userspace I/O platform driver with generic IRQ handling
<*> Userspace platform driver with generic irq and dynamic memory
For Petalinux 2019.1:
Device Drivers -> Userspace I/O drivers
<*> Userspace I/O platform driver with generic IRQ handling
<*> Userspace platform driver with generic irq and dynamic memory
<*> Xilinx AI Engine driver
Open the system-user.dtsi in linux-images\project-spec\meta-user\recipes-bsp\device-tree\files and make the mods below:
/include/ "system-conf.dtsi"
/ {
chosen {
bootargs = "earlycon clk_ignore_unused uio_pdrv_genirq.of_id=generic-uio";
stdout-path = "serial0:115200n8";
};
};
&axi_gpio_0 {
compatible = "generic-uio";
};
petalinux-build
cd images/linux
petalinux-package --boot --fsbl zynqmp_fsbl.elf --fpga design_1_wrapper.bit --u-boot
Place the BOOT.BIN and the image.ub onto the SD card and boot the kernel.
Test the Interrupt
To test, make sure that the UIO is probed:
ls /dev
You should see that the uio0 is listed here.
Make sure that the IRQ is registered:
cat /proc/interrupts
You should see this registered as below:
To generate an interrupt, we can write to the ISR in the AXI GPIO. Below is a snippet of the register space
from the AXI GPIO product guide
For example, we can use the devmem utility to write to this register from the linux console:
Then rerun, the cat /proc/interrupts and the interrupt count should be incremented for the gpio:
If users would like to debug a Linux application in SDK, then they can follow on from here with the wiki article here