How to use git with new “Unified Vitis (Xilinx)”

I have the same problem as this question but using git (instead of Mercurial) and also using the new “Unified Vitis”, which is based on VSCode (instead of the old one, based on Eclipse).

Vitis (both old and new) “supports” git, at least according to documentation. However, I don’t understand how they imagine this working and I haven’t seen a documented workflow that’s actually usable.

The old Vitis had an “import/export project Wizard”. This seems to be absent in the new Vitis. This post in Xilinx formus says that the import/export feature is not yet available in new Vitis but planned for the 2024.1 release. As for user guides, UG1400(2023-12-13) in section “Source Control” explains how to do git add by clicking around in the Vitis GUI, but unfortunately not how to version control a project in such a way that someone else can actually use it.

I hope they find a better solution because, if I understand the workflow described there correctly, the import/export feature isn’t very nice.

The fundamental problem with version control in Vitis…

… seems to be that Vitis generates a lot of files that have a lot of absolute paths. Even when using the automatically generated .gitignore, adding “everything else” to version control adds a lot of IDE-internal files that Vitis is constantly updating (even while the user doesn’t change any sources or configuration). Furthermore, these files contain a lot of absolute paths, which makes it unpractical to pull changes made on a different developer’s system (the project will fail with build errors).

My current solution…

… is to version control NOTHING inside the vitis-managed platform and application folders. Instead, I use the Vitis Python CLI and copy over only the “magic stuff” (linker script, CMake files, etc.) that Vitis expects to be there, as well as an empty source file to make Vitis happy.

My CMakeLists.txt then instructs the build system to take sources from my original source directory. The tree looks like this:

"ROOT_PATH"
├── build-vitis        (NOT version controlled at all!
│                       Vitis stuff: "platform" and "application" folders.)
├── build-vivado       (Vivado output, e.g. the .xsa file)
├── src
│   ├── CMakeLists.txt
│   ├── lscript.ld
│   ├── main.cpp
|   |    (more sources in a directory tree...)
│   ├── NOTUSED.cpp
|   |    (empty file, copied over to make Vivado think it "has sources")
│   └── UserConfig.cmake
└── tools
    ├── build_app.py
    └── ...

And build_app.py (somewhat simplified):

import vitis
import os

ROOT_PATH = <path to directory containing `tools` directory, user specified or deduced from PWD>

# This is the folder that "belongs" to Vitis.
# I put it into my .gitignore.
VITIS_BUILD_DIR_PATH = os.path.abspath(
    os.path.join(ROOT_PATH, "build-vitis")
)
os.makedirs(VITIS_BUILD_DIR_PATH, exist_ok=True)

EXPECTED_XSA_FILE_PATH = os.path.abspath(
    os.path.join(ROOT_PATH, "build-vivado", "<filename>.xsa")
)

COMPONENT_NAME = "MYCOMPONENT"

MAIN_SRC_PATH = os.path.join(ROOT_PATH, "src")

client = vitis.create_client()
client.set_workspace(path=VITIS_BUILD_DIR_PATH)

PLATFORM_NAME = "platform_baremetal"
platform = client.create_platform_component(
    name=PLATFORM_NAME,
    hw=EXPECTED_XSA_FILE_PATH,
    os="standalone",
    cpu="<mycpu>",
)

platform = client.get_platform_component(name=PLATFORM_NAME)
status = platform.build()

comp = client.create_app_component(
    name=COMPONENT_NAME,
    platform=os.path.join(
        VITIS_BUILD_DIR_PATH,
        PLATFORM_NAME,
        "export",
        PLATFORM_NAME,
        f"{PLATFORM_NAME}.xpfm",
    ),
    domain="<mydomainname>",
)

comp = client.get_component(name=COMPONENT_NAME)
status = comp.import_files(
    from_loc=os.path.join(MAIN_SRC_PATH),
    files=[
        # Note: the actual C/C++ sources are NOT imported!
        "CMakeLists.txt",
        "UserConfig.cmake",
        "lscript.ld",
        "NOTUSED.cpp" # empty
    ],
    dest_dir_in_cmp="src",
)

comp.build()

Disadvantages

I don’t copy over the sources because I want to be able to edit them at the location they are version controlled. I have to copy over the “magic files” to where Vitis expects them because I DO NOT want to use symlinks for compatibility between e.g. Windows/Linux developer machines. This means that:

  • I have to “copy back” any changes (that I want to commit) made via Vitis to the configuration files (CMake, linker script, etc.) to my own src directory. The person asking about using Mercurial did this for all source code.

  • By instructing CMake to take sources from my own directory, I can edit them in Vitis (though I usually don’t use Vitis at all when making major changes to source code) but it’s confused and doesn’t recognize includes/names any more in syntax highlighting etc.

Is there a better way?

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật