ZYNQ QNX开发——在ZedBoard上运行QNX

QNX版本:QNX6.6
宿主系统:Windows
交互系统:Debin
开发板:MIZ702 完全兼容ZedBoard

开发流程:
1、打开QNX Momentics IDE开发环境,File->QNX Source Package and BSP->Next->选择从官网下的BSP压缩包一路Next Finish。

2、在IDE左侧的工程目录下找到新导入的BSP文件,编译工程。Note:在编译BSP之前将/BSP/image/mkflashimage文件的26行的Xilinx SDK路径根据自己的安装情况进行修改。后面附修改后的代码。

3、ZYNQ启动所需要的文件有BOOT.bin和OS镜像文件。若宿主操作系统为Linux,BSP编译完成后即可获得系统需要的文件。NOTE:若使用的开发板为ZC702 EVM则不需要任何修改,若使用的开发板为ZedBoard或者自制板卡需要将image文件下的fsbl进行替换。

若宿主操作系统为Windows,在编译完工程后由于mkflashimage脚本文件无法执行,不能生成现成得的脚本文件。我们可以查看mkflashimage的代码 其主要完成了两个任务:1、将镜像名字改成QNX-IFS 2、生成BOOT.bin 这些我们可以不用脚本来实现。我们可以自己手动修改镜像名字,并使用Xilinx SDK生成BOOT.bin文件。

当然也可以使用mkflashimage脚本,但是有些繁琐,首先WIN+R调出CMD命令框,然后定位到QNX Momentics IDE安装路径下(我的是E盘QNX),执行qnx660-env,bat文件。

然后定位到BSP/image路径下,执行sh mkflashimage

这时候在image下就生成了我们需要的QNX-IFS镜像和BOOT.bin。NOTE:生成BOOT.bin的原材料有fsbl和IPL,fsbl要和自己板子匹配,上文已说明。

4、将SD卡格式化为FAT32类型,并将QNX-IFS 和 BOOT.bin拷到SD卡中。将板子上电运行。可以看到QNX操作系统已经运行了。

下面是mkflashimage代码
#!/bin/sh
# script to build a BOOT.bin binary containing the IPL and boot image for ZC702EK.

echo Generating QNX-IFS...
cp ifs-xzynq-zc702.raw QNX-IFS

# Removing previous output binary
if [ -f BOOT.bin ]
then
rm BOOT.bin
fi

# Copy the ELF build output to current folder
# Use install/../mkflashimage if it exists; otherwise use prebuilt/../mkflashimage
if [ -f ../install/armle-v7/boot/sys/ipl-xzynq-zc702 ]
then
cp ../install/armle-v7/boot/sys/ipl-xzynq-zc702 ipl-xzynq-zc702.elf
else
echo Using prebuilt ipl-xzynq-zc702. Run a make command if you wish to change the ipl.
cp ../prebuilt/armle-v7/boot/sys/ipl-xzynq-zc702 ipl-xzynq-zc702.elf
fi

echo Generating BOOT.bin...
# Use bootgen to create the BOOT.bin that contains FSBL + IPL
# Please modify the SDK version (2014.x) to match with the currect version of the tool
#/opt/Xilinx/SDK/2014.1/bin/bootgen -image boot.bif -o i BOOT.bin
E:\vivado/SDK/2016.2/bin/bootgen -image boot.bif -o i BOOT.bin
# Check that it has been created
if [ -f BOOT.bin ]
then
echo Binary ready to be copied
else
echo Failed to create boot image
fi

参考文献:
[1]qnx官方文档 bps userguide for zc702
[2]qnx官方文档 build an embedded system

---------------------
作者:恰_同学少年
来源:CSDN
原文:https://blog.csdn.net/qq_34322603/article/details/78775668

最新文章

最新文章