ZC702 - Boot From Flash

ZC702 – Boot from Flash

This section will explain you how to create a bootable Linux image and program the image to Flash Memory. The instructions provided here are tested on the ZC702 eval board but in general are applicable to all zynq based boards. The details on building the executables needed for making the image is not dealt in this chapter. Go to zynq releases to download prebuilt images.

Running a standalone or Linux application

Following flow charts show what files are involved in the boot process.

Running a Standalone application

The BootROM loads the First Stage Boot Loader (FSBL) only. The FSBL loads the bitstream (optional) and Standalone application.

Running Linux

The BootROM loads the First Stage Boot Loader (FSBL) only. The FSBL loads the bitstream (optional) and U-boot. U-boot loads the Compressed Linux Kernel, device tree and the ramdisk. U-boot then runs the compressed Linux Image (zimage)

BootFromFlash.png

Hardware required

The hardware required to program the image to the Zynq board are

  • Zynq Board
  • Power supply
  • Xilinx Platform cable / USB cable to connect to Digilent USB JTAG on the ZC702 board.
  • SD card

Software required

Xilinx SDK version used: Release Version: Release 14.1 Build SDK_P.15xf

ZC702 Setup

You need a Xilinx platform cable connecting to the JTAG pod of your board. You need to power up the board in JTAG mode. If your board is empty (doesn’t have anything loaded in external memory), the board will default in to JTAG mode.

Files you need to build a bootable image

To build a bootable image you need the following binaries, executables or bitstream. If you need to build a bootable image using u-boot or you can combine a standalone application. U-boot can then load Linux from Network, USB, or from Flash Memory.

  • First Stage Boot Loader (FSBL.elf)
  • U-boot (u-boot.bin)
  • A bitstream for the programmable logic (as applicable)

If you are building a Linux based system, then you need the following images in addition to the ones mentioned above. These

  • Linux Kernel (zimage)
  • Ramdisk image (ramdisk8M.image)
  • Device tree (devicetree.dtb)

You will also need the Xilinx supplied Bootgen tool to stitch these files to make a bootable image.

Make a Linux bootable Image for QSPI

You can use the Xilinx SDK and build a boot image.
Invoke SDK, go to Xilinx tools->create boot image. Add the files you want. Here we have added 5 files as shown in the figure below,

  • fsbl.elf
  • u-boot.elf
  • z-image.bin (linux kernel)
  • zynq-zc702.dtb (device tree)
  • ramdisk8M.image (ram disk file system)

The output from this step is the qspi_image.bin. Programming this image to QSPI is explained in the next section.

CreateBootableImage.png

NOTE 1:

z-image, device tree and ramdisk are directed to specific offsets. This is because u-boot expects them to be at that address when booting from QSPI. User can modify the place they want these images to be placed at. They have to modify and rebuild u-boot. The environment variables that is used can be found in the file

u-boot-xarm\include\configs\ zynq_zc702.h

If you have to roll u-boot for your board, you start with taking this file and modifying it.
Following is an excerpt from the zynq_zc702.h file. It shows the u-boot commands that are executed to boot linux in qspimode.

"qspiboot=echo Copying Linux from QSPI flash to RAM...; \
                cp 0xFC100000 0x8000 ${kernel_size}; \
                cp 0xFC600000 0x1000000 0x8000; \
                echo Copying ramdisk...; \
                cp 0xFC800000 0x800000 ${ramdisk_size};\
                ping 10.10.70.101;\
                go 0x8000\0" \

Programming QSPI from U-boot

You need to have a connection through JTAG, to download your binaries to the target and a UART console to interact with u-boot. Connect your hardware as specified in Hardware setup section.

NOTE 2:

The file ps7_init.tcl file is used to initialize the ZC702 board’s DDR ram. It can be found at
C:\Xilinx\14.1\ISE_DS\EDK\sw\lib\hwplatform_templates\ZC702_hw_platform\ ps7_init.tcl
For your Hardware design this file would be generated when you export your hardware to SDK.

From XMD:

connect arm hw
source ps7_init.tcl
ps7_init
dow -data qspi_image.bin 0x08000000
dow u-boot.elf
con

After this command observe u-boot prints in the serial terminal.

From U-boot:

pele-boot> sf probe 0 0 0
pele-boot> sf erase 0 0x01000000
pele-boot> sf write 0x08000000 0 0x00FFFFFF

Power cycle the board and you have Linux coming up from QSPI.

NOTE 3:

The above steps are one time process. If you modify a specific executable, you can program the specific file alone to QSPI using "sf” command in u-boot or using “flashcp” command in Linux
Power up the board and stop autoboot to get to u-boot prompt.

From XMD:

connect arm hw
dow -data u-boot.bin 0x08000000
con

From U-boot:

pele-boot> sf probe 0 0 0
pele-boot> sf erase 0 0x80000
pele-boot> sf write 0x08000000 0x80000 0x7FFFF
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License