在 Vitis 安装文件夹内提供了一个模板 Makefile,您可将其包含在自己的 Makefile 内,这样即可显著简化定制 Makefile 的开发工作。以下描述了您自己的 Makefile 使用模板 Makefile 所需的变量:
# Accelerator source files (ie. Vitis HLS code, or vpp_acc code)
# must be specified here; they will be processed by v++ --compile
ACC_SRCS := src/conv_filter_acc.cpp
# Host source files are defined here:
HOST_SRCS := src/host.cpp src/function_cpu.cpp
# Include tool provided Makefile template:
include ${XILINX_VITIS}/system_compiler/examples/vpp_sc.mk
模板 Makefile 的构建目标包括:all
、run
、build
、clean
和 ultraclean
。以下提供了一条有效的 make
命令示例,此命令搭配 build
用于构建设计以执行硬件仿真的 (hw_emu
):
$ make DEVICE=<platform> TARGET=hw_emu build
以下提供了一条 make
命令示例,此命令搭配 run
用于运行目标:
$ make DEVICE=<platform> TARGET=hw_emu run
重要: VSC 使用
g++ -dumpversion
获取 g++
的版本号,如果版本低于 7.1.0 则停止构建。但在某些操作系统上,此命令仅返回主版本,例如 v7.5.0 仅显示 v7,并返回如下错误:vpp_sc.mk: Using /usr/bin/g++
vpp_sc.mk: g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0 <Installation path of Vitis 2022.1>/system_compiler/examples/vpp_sc.mk:29:
*** gcc version lower then 7.1.0 is not supported. Stop.
要解决此错误,请使用 make
命令搭配 GCC_VERSION=75000
。在此情况下,模板 Makefile 中返回的版本为 75000,且将继续构建。