Creating a User Application Template

The Vitis software platform and XSCT support creation of user-defined application templates using the repository functionality. To create a standalone or Linux application template:

  1. A great way to start creating an user-defined application template is to look at an existing template for the directory structure and files that needs to be defined along with the source files.
    1. Sample standalone OS application template files are available at <Vitis software platform installation directory>\data\embeddedsw\lib\sw_apps\lwip_echo_server.
    2. Sample Linux OS application template files are available at <Vitis software platform installation directory>\data\embeddedsw\lib\sw_apps_linux\linux_hello_world .
    3. Observe the folder name. Also note that the file names are the same as the application template names, excluding the file extensions.
    4. Decide on your application template name and OS.
    5. Create an application Tcl file. The Tcl file name should be same as the application template name.
    6. Add the following functions to the Tcl file:
      1. swapp_get_name: This function returns the application template name. The return value should be same as the application template name.
        proc swapp_get_name {} {
            return "lwIP Echo Server";
        }
      2. swapp_get_description: This function returns the description of the application template in the Vitis IDE. You can customize the description according to the application details.
        proc swapp_get_description {} {    
        return "The lwIP Echo Server application provides a simple demonstration of 
        how to use the light-weight IP stack (lwIP). This application sets up the board 
        to use IP address 192.168.1.10, with MAC address 00:0a:35:00:01:02. The server listens 
        for input at port 7 and simply echoes back whatever data is sent to that port."
        }
      3. swapp_is_supported_sw: This function checks for the required software libraries for the application project. For example, the lwip_echo_server application template requires the lwip library in the domain.

      4. swapp_is_supported_hw: This function checks if the application is supported for a particular design or not. For example, lwip is not supported for MicroBlaze™ processors.

      5. swapp_get_linker_constraints: This function is used to generate the linker script. If this function returns lscript no, the linkerscript is copied from the application template. For example, the FSBL application does not generate a linker script. There exists a default linker script in the src folder that is used to create an application.
        proc swapp_get_linker_constraints {} {    
            # don't generate a linker script. fsbl has its own linker script
            return "lscript no";
        }
      6. swapp_get_supported_processors: This function checks the supported processors for the application template. For example, the linux_hello_world project supports the ps7_cortexa9, psu_cortexa53, and microblaze processors.
        proc swapp_get_supported_processors {} {
            return "ps7_cortexa9 psu_cortexa53 microblaze";
        }
      7. proc swap_get_supported_os: This function checks the OS supported by the application template.
        proc swapp_get_supported_os {} {
            return "linux";
        }
  2. Create an application MSS file to provide specific driver libraries to the application template. The MSS file name should be similar to the application template name.
  3. Provide the OS and LIBRARY parameter details.

  4. Copy the newly created TCL and MSS files to the data folder.
  5. Create your source source files and save them in the src folder. Copy the lscript.ld file to the src folder, if required.
  6. Move the data and src folders to a newly created folder. For example:
    • For standalone application templates, create a folder sw_apps and move the data and src folders to the newly created folder. The Vitis software platform considers the applications created in the sw_apps folder as standalone applications.
    • For Linux application templates, create a folder sw_apps_linux and move the data and src folders to the newly created folder. The Vitis software platform considers the applications created in the sw_apps_linux folder as Linux applications.

Accessing User Application Templates

You can access the user template applications in the Vitis IDE or using the XSCT. To access the user application templates:

  1. Using the Vitis IDE:
    1. Launch the Vitis IDE.
    2. Select Xilinx > Repositories > Add.
    3. Select the repository folder, from the dialog box that appears.
      Note: For standalone applications, the parent folder that contains the applications should be sw_apps. Example: C:\temp\repo\sw_apps\custom_app_name. For Linux applications, the parent folder that contains the applications should be sw_apps_linux. Example: C:\temp\repo\sw_apps_linux\custom_app_name.
    4. Select File > New > Application Project. The New Project wizard page appears.
    5. Specify a project name.
    6. Select your platform or create a new platform from the hardware (xsa).
    7. Choose the desired OS and processor type to match with the user application template.
    8. Select the user application template, from the Available Templates list and click Finish to create an application based on the selected user application template.
  2. Using XSCT:
    1. Execute the following commands at the XSCT prompt:
      setws {c:\temp\workspace}
      repo –set {C:\temp\repo}
      app create –name custom_app –hw zc702 -os standalone -proc -template {custom_app_name}
      app build -name custom_app