背景:在使用SDK因为地址溢出的问题共享DDR受阻之后,我们需要运用SoC来编译相应的调用程序。
目的:搭建MIZ7035交叉编译环境并且运行调用IPcore的程序。
目录
一、交叉编译工具
1.1 安装虚拟机
虚拟机为VMware,虚拟机的安装过程参考这篇文章:
https://blog.csdn.net/weixin_36474809/article/details/83373908
1.2 交叉编译工具
拷贝7035开发包至虚拟机/mnt/workspace/script# 目录下,并解压
1.3 使能交叉编译环境
进入开发包目录下的scripts目录,输入source settings64.sh
此时即使能了交叉环境。
二、交叉编译
2.1 makefile的更改
需要将CC后面的编译量改为arm-linux-gnueabihf-g++
NETWORK = #./networks/AllPoolToSq3x3S2
CC = arm-linux-gnueabihf-g++
CFLAGS = -I. -I./vivado_include -I$(NETWORK) -Wall -Wno-unknown-pragmas -Wno-unused-label -O3
# Change in Makefile or Network should trigger recompile, too:
DEPS = *.h Makefile $(NETWORK)/*
CPP_FILES = $(wildcard *.cpp) $(wildcard $(NETWORK)/*.cpp)
OBJS = $(CPP_FILES: .cpp=.o)
all: compileandlink
run: compileandlink
#-rm test.out
-./test
-./test.exe
loadbit:
#Load Bitstream
loadbit ./cnn_on_fpga_200MHz.bit
#Set AXI HP0 to 32bit
axi_hp_config 0 32
debug: CFLAGS += -DEBUG
debug: compileandlink
#cp $(NETWORK)/indata.bin indata.bin
./test 2>&1 | tee test.out
clean:
-rm *.o
-rm test
-rm test.out
-rm -rf test.dSYM/
%.o: %.cpp $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
compileandlink: $(OBJS)
#copy weights binary from network to root directory
#cp $(NETWORK)/weights.bin weights.bin
$(CC) -o test $^ $(CFLAGS)
.PHONY: all test clean run debug loadbit
2.1 root运行
root再次运行,su root,然后source相应的文档,然后make
三、FPGA运行
3.1 连接及挂载u盘
连接FPGA,挂载u盘。
3.2 输入相应命令行
./test FPGA indata.bin即可运行