In this simple tutorial we will discuss how to build a Linux image in Petalinux 2018.3, from the BSP, or from scratch using the HDF file that is export from Vivado IP Integrator. The wiki will also discuss the various debug options available to enable the user to fully debug any application targeting the RFDC IP driver.
See the wiki here for information on the ZCU111 Clocking
Building the Linux Image:
Using zynqMP template:
The RFDC driver is delivered as a shared object in Linux. The makefile can be seen here and below:
So, this .so is built and delivered in the /usr folder in the root file system. The recipe can be seen here:
We can see this .SO added to the sysroots created above:
These will also be in the respective folder in the rootfs when you boot Linux.
Creating Linux Application in SDK:
The SDK 2018.3 can be used to create the Linux application
File → New → Application Project
Finish, to continue
Right Click on the application in Project Explorer and select the C/C+ Build Settings:
Add the path to the sysroot path to the linker flags:
Add the libraries (highlighted):
If using the ZCU111, then there is code to program the clocks on the board:
As seen above, there is a pre-compiler ifdef. This can be added as a symbol in the C/C++ Build settings too:
In this demo, I will be using the rfdc_selftest that is delivered with the driver. However, the full API suite for the RFDC can be found here.
To add the code, right click on the src folder in Project explorer and select Import:
General → File System:
Browse to your source code and select Finish:
Debugging Linux Application on ZCU111:
Set up the LAN between your board and you PC:
Make sure you can ping your PC from the Linux console.
Set up the Target Connection:
Drop down the Linux TCF Agent → Linux Agent
Select Add new target connection icon:
Next, right click on your application in Project explorer, and select Debug As → Debug Configurations:
Double Click on Xilinx C/C++ application (System Debugger)
Select Debug to launch the debug perspective.
Creating Linux Application in Petalinux:
Once the user is satisfied that everything works correct, then they can create a Linux Application in Petalinux:
Open the makefile at project-spec/meta-user/recipes-apps/rfdc-test/files and make the changes below:
Add the source files to the project-spec/meta-user/recipes-apps/rfdc_test/files directory.
Update the project-spec/meta-user/recipes-apps/rfdc-test/rfdc-test.bbappend file:
Note: Users need to pass the XPS_BOARD_ZCU111 symbol to the compiler in order to set up the clocks correctly. The OUTS here will be the application name, and the RFDC_OBJS is the toplevel file