In this section, you will use the Vitis software platform installed on a Windows machine.
Open the Vitis software platform. You must run the Target Communication Frame (TCF) agent on the host machine.
In the XSCT Console view, type
connect
to connect to the Xilinx Software Command-Line Tool (XSCT).In the Vitis Unified IDE, select File → New Component → Platform and populate using the table below.
Screen
System Property
Setting or Command to Use
Create Platform Component
Component Name
linux_platform
Component Location
default
Select Platform Creation Flow
Hardware Design
Select
Hardware Design (XSA)
Browse to XSA
Select Operating System & Processor
Operating System
linux
Processor
ps7_cortexa9
In the Vitis Unified IDE, select File → New Component → Application and populate using the table below.
Screen
System Property
Setting or Command to Use
Create Application Component
Component Name
linux_blinkled_app
Component Location
default
Select Platform
Platform
linux_platform
Sysroot
Sysroot
Browse to sysroot
Update Workspace Perference
Select
Click Finish. The New Application linux_blinkled_app component is created in Components view.
In the Components View, expand the linux_blinkled_app Component, right-click the src directory, and select Import. The Import Sources view opens.
Browse for the LKM_App folder and select the linux_blinkled_app.c and blink.h files.
Note
The application software file name for the system is
linux_blinkled_app.c
and the header file name isblink.h
. These files are available in the LKM folder of the ZIP file that accompanies this guide. See Design Files for this Tutorial.Add the linux_blinkled_app.c and blink.h files.
Click Finish.
Under FLOW select (or highlight) the linux_blinkled_app component and click on the hammer icon to generate the
linux_blinkled_app.elf
file in binary folders. Check the Console window for the status of this action.Connect the board.
Follow the steps described in Linux Booting and Debug in the Vitis Software Platform to load the Linux image and start it.
After the kernel boots successfully, in a serial terminal, navigate to
/lib/modules/\<kernel-version\>/extr
and run the command:modprobe blink.ko
You will see the following message:
<1>Hello module world. <1>Module parameters were (0xdeadbeef) and "default" blink_init: Registers mapped to mmio = 0xf09f4000 Registration is a success the major device number is 244.
If you want to talk to the device driver, create a device file by running the following command:
mknod /dev/blink_Dev c 244 0
The device file name is important, because the ioctl program assumes that is the file you will use.
Create a device node. Run the
mknod
command and select the the string from the printed message.For example, the command
mknod /dev/blink_Dev c 244 0
creates the/dev/blink_Dev
node.Select Window → Open perspective → Remote System Explorer and click Open. The Vitis software platform opens the Remote Systems Explorer perspective.
In the Remote Systems view, do the following:
Right-click and select New → Connection to open the New Connection wizard.
Select the SSH Only and click Next.
In the Host name field, type the target board IP. To determine the target IP, type “ifconfig eth0” at the Zynq prompt in the serial terminal. The target IP assigned to the board displays.
Set the connection name as blink and type a description.
Click Finish to create the connection.
Expand blink → sftp Files → Root. The Enter Password wizard opens.
Enter the Login (petalinux) and user will be prompted to enter new Login and Password.
Click OK.
The window displays the root directory content, because you previously established the connection between the Windows host machine and the target board.
User can change the permissions here with sudo -i
Right-click the / in the path name and create a new directory; name it “Apps”.
Using the Remote System Explorer perspective, copy the linux_blinkled_app.elf file from the /linux_blinkled_app/Debug folder and paste it into the /Apps directory under blink connection.
In the serial terminal, type
cd Apps
to open the/Apps
directory.Go to the Apps directory. Type
chmod 777 linux_blinkled_app.elf
to change thelinux_blinkled_app.elf
file mode to executable mode.At the prompt, type
./linux_blinkled_app.elf
to execute the application.Follow the instruction printed on the serial terminal to run the application. The application asks you to enter 1 or 0 as input.
Type 1, and observe the LEDs DS15, DS16, DS17, and DS18. They start glowing.
Type 0, and observe that the LEDs stop at their state. No more blinking changes. Repeat your inputs and observe the LEDs.
After you finish debugging the Linux application, close the Vitis software platform.