Build applications - DigitalMediaProfessionals/dv-sdk GitHub Wiki
Compilation of the example applications can be done directly on AI FPGA module (referred to as MODULE).
For this, log in to MODULE (via ssh, serial console or with physical keyboard and monitor), then navigate to dv-sdk/application folder:
$ cd ~/dv-sdk/application
and execute make:
$ make
The resulting binaries will be put to ~/dv-sdk/application/bin folder.
Cross-compiling
For cross compiling the compiler for the target CPU is required. The best was is to use Ubuntu of the same version as on MODULE: 18.04 (16.04 works also).
- Install cross-compiler and tools on the host machine:
$ sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libfreetype6-dev libagg-dev
- Get DV SDK from GitHub: (Or copy the dv-sdk folder from the MODULE.)
$ git clone https://github.com/DigitalMediaProfessionals/dv-sdk --recurse-submodules
- Copy required libraries from MODULE. One can use the
scp
andrsync
commands if the MODULE is connected to ether net:
$ scp ubuntu@ai_fpga_module:/usr/lib/libagg.a dv-sdk/application/common/lib/
$ scp ubuntu@ai_fpga_module:/usr/lib/libdmpdv.so dv-sdk/dv-user-driver/
$ mkdir -p ~/zia-rootfs/usr/local
$ rsync -avrx ubuntu@ai_fpga_module:/usr/include :/usr/lib ~/zia-rootfs/usr/
$ rsync -avrx ubuntu@ai_fpga_module:/usr/local/include :/usr/local/lib ~/zia-rootfs/usr/local/
$ rsync -avrx ubuntu@ai_fpga_module:/lib ~/zia-rootfs/
- Update
dv-sdk/env.mk
:
OPT=-O3
SYSROOT=/
ARCH=$(shell gcc -print-multiarch)
ifeq ($(ARCH), arm-linux-gnueabihf)
# For on-board compiling (32-bit ARM)
GPP=g++ -mfp16-format=ieee -march=native -mtune=native
GCC=gcc -mfp16-format=ieee -march=native -mtune=native
else
ifeq ($(ARCH), aarch64-linux-gnu)
# For on-board compiling (64-bit ARM)
GPP=g++ -march=native -mtune=native
GCC=gcc -march=native -mtune=native
else
# For Cross-compiling setup GPP and GCC variables
# Depending on the cross-compiler it might be required to add -static-libstdc++ or -static
# Set SYSROOT variable to the folder with rootfs (only /usr/include /usr/local/include /usr/lib /usr/local/lib /lib are sufficient)
SYSROOT=$(HOME)/zia-rootfs
GPP=aarch64-linux-gnu-g++-7 --sysroot=$(SYSROOT)
GCC=aarch64-linux-gnu-gcc-7 --sysroot=$(SYSROOT)
endif
endif
- Execute make:
$ cd dv-sdk/application
$ make
NOTE: Depending on the cross-compiler, additional steps might be needed, such as copying cross-compiler runtime libraries to MODULE, or use static linking. Common compiling option can be changed in dv-sdk/env.mk.