参考文档:ug1144, xilinx文档搜索及下载地址: https://docs.xilinx.com/
前言
本文主要说明petalinux从工程创建到加载xsa到编译启动的步骤,以及vitis软件开发步骤。
环境基于ZYNQ UltraScale+ MPSoc EG系列,默认petalinux及vitis已安装完毕。
另一种方式,从BSP文件创建工程,不在本文说明。
预备条件
已安装Vivado工具,并配置Vivado tool工作环境:
source <path-to-installed-Xilinx-Vivado>/settings64.sh
示例:source ~/petalinux/settings.sh
Vivado下载链接:Vivado
熟悉vitis使用,参考UG1400
一、创建一个新的petelinux工程
示例:
<plnx-proj-root> petalinux-create --type project --template zynqMP --name test_pro
参数说明:
–template - The following platform types are supported:
○ versal-net (for Versal-Net adaptive SoC)
○ versal (for Versal adaptive SoC)
○ zynqMP (for Zynq UltraScale+ MPSoC)
○ zynq (for Zynq 7000 devices)
○ microblaze (for MicroBlaze processor)
Note: The MicroBlaze template option cannot be used with Zynq 7000 devices or Zynq UltraScale+ designs in the Programmable Logic (PL).
• --name <PROJECT_NAME> - The name of your project.
分类说明
导入硬件描述文件XSA
<plnx-proj-root> petalinux-config --get-hw-description [SRC]
参数SRC是文件所在“路径”,XSA文件是从vivado导出的自己硬件平台,vivado工程创建和使用本文不关心,后续有需要再单独成文。
编译创建系统Image
<plnx-proj-root> petalinux-build
参数说明:
编译之后会在<proj_root>/images/linux/目录和/tftpboot目录生成镜像文件
When you run petalinux-build, it generates FIT images for Versal adaptive SoC, Zynq
UltraScale+ MPSoC, Zynq 7000 devices, and MicroBlaze platforms. The RAM disk image
rootfs.cpio.gz.u-boot is also generated.
The full compilation log build.log is stored in the build sub-directory of your PetaLinux
project. The final image, /images/linux/image.ub, is a FIT image. The
kernel image (including RootFS, initramfs, if any,) is Image for Zynq UltraScale+ MPSoC and
Versal platform, zImage for Zynq 7000 devices, and image.elf for MicroBlaze processors.
生成启动镜像boot image
A boot image usually contains a PDI file (imported from hardware design), PLM, PSM firmware,
Arm® trusted firmware, U-Boot, and DTB.
petalinux-package
生成引导BOOT.BIN文件:petalinux-package --boot --u-boot
示例:
<plnx-proj-root> petalinux-package--boot --format BIN --fsbl images/linux/zynqmp_fsbl.elf --u-boot images/linux/u-boot.elf --pmufwimages/linux/pmufw.elf --fpga images/linux/*.bit --force
参数:
–bsp 打包生成.bsp文件,可用于直接创建新的petalinux工程
示例1:Clean the project and generate the BSP installation image (.bsp file).
$ petalinux-package --bsp --clean -o [PATH-TO-BSP] -p [PATH-TO-PROJECT]
示例2:Generate the BSP installation image that includes a reference hardware definition.
$ petalinux-package --bsp -p [PATH-TO-PROJECT] --hwsource [PATH-TO-HWEXPORT] -o [PATH-TO-BSP]
生成vitis sdk所需文件
<plnx-proj-root/images/linux/> petalinux-build --sdk
<plnx-proj-root/images/linux/> petalinux-package --sysroot
–sdk,builds SDK and copies it at <proj_root>/images/linux/sdk.sh,用于sdk应用开发
–sysroot 安装sdk在指定路径用于应用开发
打包预编译镜像
petalinux-package --prebuilt --fpga images/linux/*.bit
– prebuilt 发布BSP工程使用
另外还有很多参数,可以配置u-boot dtb,下载地址等,暂不详细说明,后续再补充。
启动
前提:packaged prebuilt images
petalinux-boot --jtag --prebuilt 3(LEVEL)
petalinux-boot --qemu --prebuilt 3
Level 1: Download the prebuilt FPGA bitstream.
Level 2: Download the prebuilt FPGA bitstream and boot the prebuilt U-Boot.
Level 3: Download and boot the prebuilt Linux
vitis 配置
https://mp.weixin.qq.com/s/YV1fC0NBYWpxtrS4KVqJgw