Vas Posted October 9, 2022 Share Posted October 9, 2022 (edited) Hello, I am having problems trying to compile custom module exported from Vivado to petalinux on Zybo z7-10. All tools are from 2022.1 build. Steps I have performed so far: 1) Used Vivado to generate a custom IP and added it to the block design as per UG1165 Chapter 7. 2) Exported blink.h, blink.c, design.xsa and system.bit files from Vivado. 1) Made and SD card with 2 partitions as described in UG1144. 2) Created a template project with --get-hw-description. 3) Added template module via petalinux-create -t modules --name blink --enable 4) Changed project-spec/meta-user/recipes-modules/blink/blink.bb to include blink.h 5) Copied blink.h from vivado to /files/ and changed blink.c (autogenerated) by adding #include "blink.h" 6) Tried to modify makefile to compile but failed as when I do petalinux-build I either get : missing xil_types.h error during compilation OR it compiles with warning "modules.symvers not found" but the module doesn't show with "modprobe blink" when connected via terminal (nor shows in unpacked rootfs) Note: when I compile a template project with a template module, and upload it onto the SDcard, then my board responds to "modprobe blink", however I would like to be able to use PL from vivado as a driver in linux. I want to do a simple project where I can use linux driver to blink PL connected LEDs, please help. Edited October 10, 2022 by Vas changed blinkplus reference to blink to avoid confusion Link to comment Share on other sites More sharing options...
Vas Posted October 26, 2022 Author Share Posted October 26, 2022 Here are the steps I did to work around this issue: 1) Changed petalinux auto-generated makefile to include these lines: INC_XILT = $(shell find ../../../work/zynq_generic-xilinx-linux-gnueabi/fsbl-firmware/*/git/fsbl-firmware/fsbl-firmware/zynq_fsbl_bsp/ps7_cortexa9_0/include -prune) INC_STDI = $(shell find ../../../work/zynq_generic-xilinx-linux-gnueabi/u-boot-xlnx/*/git/include -prune) MY_CFLAGS += -g -DDEBUG -Wall -I$(INC_STDI) -I$(INC_XILT) 2) Added this bit to blink.h file: #include <xil_types.h> #ifndef char8 typedef char char8; #endif #include <xstatus.h> Assuming that your original blink.c is petalinux auto-generated file with the #include "blink.h" line from vivado auto-generated file. Explanation: 1) INC_XILT = $(...) and INC_STDI = $(...) are two paths to xil_types.h and stdio.h (a file required by xil_types.h). These paths are sent to compiler via -I flag for the compiler to search for these files. These paths are also made through $(shell find ... -prune) as one of the folders marked with * is an auto-generated folder that will change based on petalinux tool version. 2) #ifndef char8 typedef char char8; #endif For some reason char8 is conditionally defined in xil_types.h file, and the condition is false (otherwise you get even more errors), hence this piece of code tries to define char8 again. It is done with #ifndef to make sure that it is somewhat compatible with other releases of petalinux. I haven't tested what would happen if the <proj folder>/build/tmp/work/zynq_generic-xilinx-linux-gnueabi/fsbl-firmware or u-boot-xlnx have multiple folders, returning multiple variables to the "shell find" command, but I assume whoever comes looking for this answer will have only one. P.S. Outlined steps seem like a workaround rather than an actual solution. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now