Programming PL in ZCU102 via FPGA Manager with BIN loaded over FTP

In this wiki we will discuss how to boot the uboot via JTAG, and use FTP to load the PL image (bin file) using FPGA Manager. 

Table of Contents

Creating BIN image:

hw sw matching

Users must make sure that the BIT file used to create the BIN file was created in the same Vivado version as the Petalinux (or Yocto branch) used to create the Linux Image

Users can use the XSCT script below to input a bit files, and output the bin image. This creates a BIF, and uses this BIF in bootgen to create the bin file:

bit to bin
proc gen_bin {bit} {
	set filename [file rootname [file tail $bit]].bif
	set fileId [open $filename "w"]
	puts $fileId "all:"
	puts $fileId "{"
	puts $fileId "  $bit"
	puts $fileId "}"
	close $fileId
	exec bootgen -w on -image $filename -arch zynqmp -process_bitstream bin
	puts "$filename created successfully"

For example:

Booting u-boot over XSCT:

The script to boot u-boot over XSCT can be seen below:

xsct uboot
proc boot_uboot {} {
	connect -url TCP:XIRSTEPHENM32:3121
	#Add the Microblaze PMU to target
	targets -set -nocase -filter {name =~ "PSU"}
	mwr 0xFFCA0038 0x1FF
	# Download PMUFW to PMU
	target -set -filter {name =~ "MicroBlaze PMU"}
	puts "Downloading pmufw"
	dow pmufw.elf
	targets -set -nocase -filter {name =~ "PSU"}
	# write bootloop and release A53-0 reset
	mwr 0xffff0000 0x14000000
	mwr 0xFD1A0104 0x380E
	# Download FSBL to A53 #0
	targets -set -filter {name =~ "Cortex-A53 #0"}
	puts "Downloading fsbl"
	dow zynqmp_fsbl.elf
	after 1000
	puts "Downloading atf"
	dow u-boot.elf
	puts "Downloading uboot"
	dow bl31.elf
	after 1000

Users can program the PL here too using the command below. However, this can be time consuming:

dow -data
dow -data system.bit.bin 0x4000000

Sending BIN file over FTP:

Setup server on PC:

I used pumpkin, however, and TFTP server can be used:

Set this up to point to the BIN files:

Setup the server in U-Boot:

server setup
setenv ipaddr
setenv serverip
setenv tftpblocksize 1024
tftpboot 0x4000000 system.bit.bin

For example:


Make sure any firewall is disabled

Configuring PL using BIN file:

fpga load
fpga load 0 0x4000000 0x19485bc

file size

The 0x19485bc was read from uboot console after the file is read over TFTP

image size

Users can get the image size from the log after tftpboot

Loading bitstream from TFTP automatically in u-boot:

There is a few ways that this can be achieved. The easiest would be to create a u-boot script with the commands similar to above to load the PL from TFTP. 

Another way, would be to patch the uboot CONFIG_EXTRA_ENV_BOARD_SETTINGS in the u-boot-xlnx\include\configs\xilinx_zynqmp.h. For example, here I have updated the jtagboot:

	"jtagboot=" \
		"echo TFTP BOOOT ...;" \
		"setenv ipaddr &&" \
		"setenv serverip &&" \
		"setenv tftpblocksize 1024 &&" \
		"tftpboot 0x4000000 system.bit.bin\0" \

Users can use the OSL flow seen here to crate the u-boot binary for testing, and once the test is complete create a git patch against the u-boot branch used in the Petalinux/Yocto.

This patch can then be added to the Petalinux/Yocto u-boot-xlnx recipe.

© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy