Python API: A command-line tool for creating and managing projects in Vitis - 2024.1 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2024-05-30
Version
2024.1 English

The Vitis IDE provides logical wizards within the development environment to help you develop your design. This is useful for developing a new processor architecture, particularly for novice users. For more flexibility and extended functionality, however, it is essential to become familiar with using scripts in the tool. Scripts are especially useful for developing regression tests that will be run at regular intervals or when running a frequently used set of commands. The AMD Vitis™ command line interface (CLI) is an interactive and scriptable command-line interface to the AMD Vitis™ IDE. As with other AMD tools, the scripting language for AMD Vitis™ CLI is based on the Python. You can run AMD Vitis™ CLI commands interactively or script the commands for automation. AMD Vitis™ CLI supports AMD Vitis™ project management, configuration, building and debugging, such as:

  • Creating platform projects and domains
  • Creating system and application projects
  • Configuring and building domains/BSPs and application
  • Managing repositories
  • Downloading and running applications on hardware targets
  • Reading and writing registers
  • Setting break points and watch expressions

To execute Python APIs, first, you need to establish the connection between the server and the client. Python APIs can be executed in command line mode or as a Python script. The AMD Vitis™ Unified IDE supports two ways to run Python APIs:

  1. Run Python API in CLI (Command-Line Interface) mode: Executing the Python API in CLI mode is supported in interactive mode only. For more details, see "Vitis Interactive Python Shell" in Vitis Unified Software Platform Documentation: Application Acceleration Development (UG1393)
    vitis -i (This opens the Vitis interactive shell)
  2. Run Python API in a Python Script: The Vitis Unified IDE supports the execution of Python script in batch mode as well as in an interactive mode.

    In batch mode:

    In batch mode:
    $ vitis -s <.py>
    In Interactive mode:
    $ vitis -i
    (This openes the Python interactive shell)
    vitis [1]: run <.py>
    Some Python APIs are helpful in managing client life cycles, create Vitis workspaces and manage Vitis project flows. These APIs are described in the following table. Refer the Vitis API CLI documentation for more details.
    Table 1. Python APIs: Manage client
    Python API Description Example
    create_client Creates a client instance. client=vitis.create.client()
    dispose Closes all client connections and terminates the connection to the server. client.dispose()
    exit Closes the session. exit()

    For more details on all the Python APIs supported by Vitis, refer to <vitis_installation_path>/cli/api_docs/build/html/vitis.html

    Python examples are provided with the installation for reference: <vitis_installation_path>/cli/examples

    After creating and building the components and system project, the workspace can be directly opened in the Vitis IDE using the command below:
    vitis -w <workspace_path>

    Components and system projects are opened in the Vitis IDE with build and created status=done, if they are created and build through Python APIs.

    The Python APIs used for component creation and build are explained in the following sections.