make application: Compile the Host Application - 2025.2 English - XD100

Vitis Tutorials: AI Engine Development (XD100)

Document ID
XD100
Release Date
2025-12-05
Version
2025.2 English

You can compile the host application by following the typical cross-compilation flow for the Cortex A72 processor. To build the application, run the following command

make application 

or

cd $(BUILD_TARGET_DIR);	\

aarch64-xilinx-linux-g++ -mcpu=cortex-a72.cortex-a53 -march=armv8-a+crc -fstack-protector-strong \
   -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$(SDKTARGETSYSROOT) -O -c \
   -std=c++14 -D__linux__ \
   -DM_LARGE=$(GEMM_SIZE) -DN_LARGE=$(GEMM_SIZE) -DL_LARGE=$(GEMM_SIZE) \
   -I$(SDKTARGETSYSROOT)/usr/include/xrt -I$(SDKTARGETSYSROOT)/usr/include -I$(SDKTARGETSYSROOT)/usr/lib -I$(HOST_APP_SRC)/$(MAT_DIMS) \
$(HOST_APP_SRC)/main.cpp -o $(BUILD_TARGET_DIR)/gemm_top_app.o \
   -L$(SDKTARGETSYSROOT)/lib -lxrt_coreutil

aarch64-xilinx-linux-g++  -mcpu=cortex-a72.cortex-a53 -march=armv8-a+crc -fstack-protector-strong \
   -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security --sysroot=$(SDKTARGETSYSROOT) \
   $(BUILD_TARGET_DIR)/gemm_top_app.o -L$(SDKTARGETSYSROOT)/usr/lib -lxrt_coreutil \
   -o $(BUILD_TARGET_DIR)/gemm_dsp_xrt.elf

See this page for XRT documentation. See this page for details of host application programming.

Switch

Description

-O | Optimize.

Optimizing compilation takes somewhat more time, and a lot more memory for a large function. With -O, the compiler tries to reduce code size and execution time, without performing any optimizations that can take a great deal of compilation time.

-D__linux__

-DXAIE_DEBUG

Enable debug interface capabilities where certain core status, event status, or stack trace can be dumped out.

-D<Pre-processor Macro String>=<value>

Pass Pre-processor Macro definitions to the cross-compiler.

-I <dir>

Add the directory dir to the list of directories to be searched for header files.

-o <file>

Place output in file <file>. This applies regardless of the output being produced, whether it be an executable file, an object file, an assembler file or preprocessed C code.

–sysroot=<dir>

Use dir as the logical root directory for headers and libraries. For example, if the compiler would normally search for headers in /usr/include and libraries in /usr/lib, it will instead search dir/usr/include and dir/usr/lib. This is automatically set by the env_setup.sh script

-l<library>

Search the library named library when linking. The 2D-FFT tutorial requires adf_api_xrt and xrt_coreutil libraries.

-L <dir>

Add directory <dir> to the list of directories to be searched for -l.

The following is a description of the input sources compiled by the cross-compiler compiler command.

Inputs Sources

Description

$(HOST_APP_SRC)/main.cpp

Source application file for the gemm_dsp_xrt.elf that will run on an A72 processor.

$(HOST_APP_SRC)/matrix_A_data.h, matrix_B_data.h

Matrix A and B Data to be used for matrix multiplication.

$(HOST_APP_SRC)/output_data.h

Golden data to which DUT output will be compared.

The following is a description of the output objects that results from executing the cross-compiler command with the above inputs and options.

Output Objects

Description

$(BUILD_TARGET_DIR)/gemm_dsp_xrt.elf

The executable that will run on an A72 processor.

make package: Packaging the Design