Loading Modules and Executing Applications - 2023.2 English

Zynq-7000 SoC Embedded Design Tutorial (UG1165)

Document ID
UG1165
Release Date
2024-05-02
Version
2023.2 English

In this section, you will use the Vitis software platform installed on a Windows machine.

  1. Open the Vitis software platform. You must run the Target Communication Frame (TCF) agent on the host machine.

  2. In the XSCT Console view, type connect to connect to the Xilinx Software Command-Line Tool (XSCT).

  3. 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

  4. 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

  5. Click Finish. The New Application linux_blinkled_app component is created in Components view.

  6. In the Components View, expand the linux_blinkled_app Component, right-click the src directory, and select Import. The Import Sources view opens.

  7. 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 is blink.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.

  8. 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.

  9. Connect the board.

  10. 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.

  11. 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.

  12. Select Window → Open perspective → Remote System Explorer and click Open. The Vitis software platform opens the Remote Systems Explorer perspective.

  13. In the Remote Systems view, do the following:

    1. Right-click and select New → Connection to open the New Connection wizard.

    2. Select the SSH Only and click Next.

    3. 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.

    4. Set the connection name as blink and type a description.

    5. Click Finish to create the connection.

    6. Expand blink → sftp Files → Root. The Enter Password wizard opens.

    7. Enter the Login (petalinux) and user will be prompted to enter new Login and Password.

    8. Click OK.

      The window displays the root directory content, because you previously established the connection between the Windows host machine and the target board.

      1. User can change the permissions here with sudo -i

    1. Right-click the / in the path name and create a new directory; name it “Apps”.

    2. 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.

  14. In the serial terminal, type cd Apps to open the /Apps directory.

  15. Go to the Apps directory. Type chmod 777 linux_blinkled_app.elf to change the linux_blinkled_app.elf file mode to executable mode.

  16. At the prompt, type ./linux_blinkled_app.elf to execute the application.

  17. 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.

  18. After you finish debugging the Linux application, close the Vitis software platform.