Writing userspace IO device driver
Creating an UIO driver
In this section we will create an UIO driver using the UIO framework. We will modify the program used in part41 and call it: LED_DimmerUIO.c.
-> cd ..../PetaZed
2. Replace the template file LED_DimmerUIO.c with the file downloaded from this page.
3. Run petalinux-config -c rootfs and select the LED_DimmerUIO application.
-> petalinux-config -c rootfs
4. Save and exit
Configure the Linux kernel
5. Run petalinux-config -c to start kernel configuration
-> petalinux-config -c kernel
6. Scroll down and select Device Drivers.
7. Scroll down and select Userspace I/O drivers.
8. Mark with an "M" for module.
9. Save and exit.
Edit the system.dts file
We find the device tree definition file system.dts file here:
10. Open the system.dts file in an editor and change the line after #gpio-cells = <2> to compatible = "generic-uio";
Rebuild the Linux kernel
The first time after we added the UIO module and edited the DTS file we have to rebuild the kernel from scratch.
-> petalinux-build -x mrproper
When the build has finished we copy the image.ub file to the SD card and we are ready to boot PetaLinux.
Insert the SD card, power on the board and connect a terminal. Here are the commands executed to load the UIO module:
October 14, 2014 09:06 AM PDT
I couldn't find system.dts in directory as mentioned above. I am using bsp package available at Xilinx website.
|Leave a Comment:|