Writing on LEDs on ZedBoard through a C application with PetaLinux and custom PL
I have successfully run a very simple program with custom PL (with a custom IP core) and its C code on ZedBoard in standalone. Now I want to run the exact same program with PetaLinux, but I have no idea how to do that. I have watched these video tutorials. I have been able to build the PetaLinux image and create BOOT.BIN and boot the board with SD card. But I don't know how to build drivers or module to interact with my custom IP, and how to write the C code (user application) for PetaLinux.
Here is more details. I have created the attached diagram in IP integrator of Vivado 2018.3. It has a custom-made IP, named My_PWM_Core_0, which is connected to 4 LEDs and its input comes from AXI interconnect. The CPU constantly sends a PWM signal to the IP, and as a result, the LEDs brighness constantly changes. According to the Address Editor, the offset address of the My_PWM_Core_0 in memory is 0x43C0_0000, and its High Address is 0x43C0_FFFF. I generated the bitstream, exported the hardware to SDK, and created the following standalone application:
#define MY_PWM 0x43C00000 //This value is found in the Address editor tab in Vivado (next to Diagram tab)
if(num == 1024)
num = 0;
I downloaded the .bit file generated by Vivado, and the .elf file generated by SDK on ZedBoard, and it works the way it should.
Now I want to do the exact same thing, but on PetaLinux instead of standalone. I used PetaLinux SDK and the generated hardware platform (.hdf) file to create the Linux Kernel image, FSBL and U-Boot. On the device tree, the
Next, I used the FSBL, the .bit file and U-Boot to generate BOOT.BIN. I transferred the BOOT.BIN and image.ub to the SD card, and Linux successfully boots. However, the LEDs are turned off and I need to write a Linux application to send the PWM signal to the IP. On the device tree of the petalinux, this is how pl.dtsi looks like:
Also, when the zedbord is on, I can find the same device tree under /proc/device-tree/amba_pl/My_PWM_Core@43c00000/ . In this directory, I can see clock-names, clocks, compatible, name, reg, xlnx,s00-axi-addr-width and xlnx,s00-axi-data-width. I'm not sure, if I want to output something on PWM through my C application, do I need to write on one of these files? Or do I need to make a device driver, like a Linux GPIO driver?
I have asked this question before in these forums, but didn't get any helpful reply.