1、建立vivado工程;
2、生成.hdf文件;
3、啟動petalinux
source petalinux安裝路徑/settings.sh
4、建立petalinux工程
petalinux-create --type project --template zynq --name test
5、進入petalinux工程文件夾,獲取hdf信息(bit、DDR、MIO、PLL)
petalinux-config --get-hw-description=.hdf文件路徑/
6、建立modules
petalinux-create -t modules --name blink --enable
7、進入路徑修改相應文件
cd project-spec/meta-user/recipes-modules/blink
修改blink.bb文件
繼續進入文件夾files
修改blink.c
8、build petalinux工程
petalinux-build
9、編譯完成,在images/linux/路徑下有
一級引導程序:fsbl.elf
鏡像引導程序:u-boot.elf
PL配置程序.bit
鏡像程序(內核、設備樹、文件系統):image.ub
10、將9中前3個打包為BOOT.BIN程序
petalinux-package --boot --format BIN --fsbl zynq_fsbl.elf --u-boot u-boot.elf --fpga system_wrapper.bit
會生成BOOT.BIN
11、將BOOT.BIN和image.ub拷貝到SD卡
12、啟動板子系統,配置IP和自己主機通信
ifconfig eth0 IP(板子IP,跟自己主機在同一網段) netmask 255.255.0.0;route add default gw xxx.xxx.0.1
13、驅動插入內核
板子上進入驅動路徑:cd /lib/modules/4.9.0-xilinx-v2017.2/extra
里面有驅動文件blink.ko
運行modprobe命令:modprobe blink.ko
設備號:mknod /dev/blink_Dev c 244 0
13、通過SDK的Remote System Explorer
將應運程序在板子上運行
chmod 777 zed_test.elf
./zed_test.elf