Zynq-7000 AP SoC Boot - Multiboot Tech Tip
背景
产品需要用到这个技术,在wiki找到了这篇文章。
创建者Confluence Wiki Admin
Sep 24, 2018 in Xilinx-wiki
Table of Contents
An Example to describe Golden Image Search
4. Time for Multiboot from QSPI
6. Multiboot and NAND Bad Block Management
| Date | Version | Author | Description of Revisions |
|---|---|---|---|
| 18/02/13 | 0.1 | Prush Palanichamy | Initial revision |
| 15/5/13 | 1.0 | Prush Palanichamy | Added info on FSBL Fallback, and handling NAND Bad blocks during Multiboot |
Summary
This document shows how Multiboot works. We use QSPI as the boot device for this exercise.
Theory
There are three mechanisms to do multiboot.
1) Golden Image Search
This is initiated by BootROM when no valid header is found at the bottom of Flash Memory. The BootROM will start searching for a valid header at every 32KB offset. This mechanism is slow but reliable.
2) BootROM Multiboot
This is initiated by FSBL i.e, user. If the BootROM finds a valid header and hands off to FSBL, then FSBL can load the Multiboot register and issue a soft reset. After a soft reset, BootROM will use the address of the Multiboot register to read the BootROM header. This mechanism is used for example, when user wants to run self-test and diagnostics, and then jump to the actual application.
3) FSBL Fallback
To recover from an error condition, FSBL does a Fallback and enables BootROM to load another bootable image (the golden image that was originally present and in a known good state) if that image is present in the flash memory. FSBL updates a multiboot register and does a soft reset so that BootROM executes and loads the next present, valid image. The FSBL fallback can happen with or without Soft Reset. Refer the Zynq-7000 AP SoC Software Developer’s guide for more information on FSBL Fallback for secure and non-secure boot modes.
http://www.xilinx.com/support/documentation/user_guides/ug821-zynq-7000-swdev.pdf
Golden Image Search and BootROM Multiboot are described in the following figure (TRM version 14.5 - figure 6-3).
Here is an Example to describe Multiboot from FSBL
Hardware Setup
Implementation Details
| Design Type | PS – any revision |
|---|---|
| SW Type | Standalone |
| Boards/Tools | ZC702 |
| Xilinx Tools Version | IDE 14.5 |
| Files Provided | Note |
|---|---|
Multiboot_Tech_Tip_V2.0.zip |
Under generated_files folder you will see the two image files that we need to create using SDK 1) Hello_World_1.bin 2) Hello_World_2.bin. If you are using these files, you can skip the SDK steps and jump to *Programming to QSPI* section. |
Implementation
We will create two boot files.
- Hello_World_1.bin = (FSBL_1 + Hello_World_1)
- prints “Hello World from Image 1 at address 0x0000_0000” - Hello_World_2.bin = (FSBL_2 + Hello_World_2)
- prints “Hello World from Image 2 at address 0x0004_0000”
Like in the following Figure, FSBL_1 will fallback, FSBL_2 will not.
Hello_World_1 will print “Hello World from Image 1 at address 0x0000_0000”
And Hello_World_2 will print “Hello World from Image 2 at address 0x0004_0000”

We will program Hello_World_1.bin at offset 0x00 of QSPI address and Hello_World_2.bin at offset 0x40000 (256KB) of QSPI address. We will modify the FSBL_1 to go through a fallback. Our expectation here is that when FSBL_1 goes through a fallback it will eventually find the image at 0x0004_0000 and will execute FSBL_2 and Application2. Just for this example, we will set “FSBL_DEBUG” flag, so we can see the Debug prints from FSBL.
The sequence of events will be as follows
- BootROM executes and loads image 1
- FSBL_1 executes
- FSBL_1 sets MultiBoot Reg address as 0x40000/ 0x8000 = 0x8, eventually
- FSBL_1 issues a soft reset
- BootROM executes and loads image2
- FSBL_2 executes
- hello_world2 application executes and prints “Hello World from Image 2 at address 0x0004_0000”
1. Step by Step Instructions
- Create a FSBL_1 application for zc702 board. Set FSBL_DEBUG flag.

We will modify the main() function in FSBL_1 project to disable Handoff. The change required is highlighted in blue. This function FsblHandoff() is called at the very bottom of main(), by disabling this function we generate a failure condition and will go through an FSBL fallback.
//FsblHandoff(HandoffAddress);
/*
* Should not come over here
*/
OutputStatus(ILLEGAL_RETURN);
FsblFallback();
Summary :
- Build FSBL_1 and generate FSBL_1.elf
- Create a
Hello_World_1 applicationfor zc702 board. Openhelloworld.cfile and change the print instruction to “Hello World from Image 1 at address 0x0000_0000” - Create a
FSBL_2 applicationfor zc702 board. SetFSBL_DEBUGflag. Build FSBL_2 and generate FSBL_2.elf - Create one more
Hello_World_2 applicationfor zc702 board. Openhelloworld.cfile and change the print instruction to “Hello World from Image 2 at address 0x0004_0000” - Open “Xilinx Tools->Create Zynq Boot Image” from SDK. And choose the FSBL_1.elf and Hello_World_1.elf to create Hello_World_1.bin
- Open “Xilinx Tools->Create Zynq Boot Image” from SDK. And choose the FSBL_2.elf and Hello_World_2.elf to create Hello_World_2.bin
Programming QSPI
- Copy BOOT.bin from from Zynq releases http://wiki.xilinx.com/zynq-releases (you can use the latest release, 14.5 release is used for testing this Techtip) in to a SD card and boot the ZC702 board in SD mode. Make sure you have connected the USB UART port of ZC702 board using a USB cable to your PC.
NOTE: You can also use XMD to run u-boot. The commands for running u-boot.elf from XMD is
XMD% connect arm hw
XMD% source ps7_init.tcl
XMD% ps7_init
XMD% dow u-boot.elf
XMD% con
u-boot.elf is available at http://wiki.xilinx.com/zynq-releases and you can find ps7_init.tcl in the folder “ZC702_hw_platform”

- Open a terminal to the USB-UART of the board (any one of Hyperterminal, teraterm, Putty) at 115200 baud rate. You should see “zynq-uboot>” prompt
- Open an XMD window (from command prompt or SDK) and cd to where the Hello_World_1.bin and Hello_World_2.bin exists
On XMD prompt – run the following commands
XMD% connect arm hw
XMD% dow -data Hello_World_1.bin 0x800000
XMD% dow -data Hello_World_2.bin 0x1000000
XMD% con

Now, on the zynq-uboot> prompt on terminal, run the following commands
zynq-uboot> sf probe
erase 512 KB
zynq-uboot> sf erase 0 0x80000
program data at 0x80_0000 to QSPI offset 0x00
zynq-uboot> sf write 0x800000 0 0x1FFFF
program data at 0x100_0000 to QSPI at 0x40000 (256 KB)
zynq-uboot> sf write 0x1000000 0x40000 0x1FFFF//

2. Verification of Multiboot
Boot the board in QSPI mode. Check for the print on serial terminal. You will see that FSBL 1 failed and the Multiboot Register eventually incremented to 8 i.e, 8 * 0x8000 = 0x40_0000.
“Multiboot Register: 0x0000C008”

After FSBL_2 executed, it gave control to Hello_World_2 which printed “Hello World from Image 2 at address 0x0004_0000.

An Example to describe Golden Image Search
Now we will erase the first sector and check if we can still from image2. In this case the sequence of events will be as follows
BootROM executes – and couldn’t find a valid header at bottom of flash
BootROM goes for hunting a valid header at every 32KB offset
BootROM sets MultiBoot Reg address as 0x40000/ 0x8000 = 0x8, eventually
Finds a valid header at 0x0004_0000
FSBL_2 executes and hands off to hello_world2 application which prints “Hello World from Image 2 at address 0x0004_0000”
Erasing Image1 of QSPI
- Copy BOOT.bin from from Zynq releases http://wiki.xilinx.com/zynq-releases in to a SD card and boot the ZC702 board in SD mode
- Open Hyperterminal at 115200 baud rate. You should see “zynq-uboot>” prompt
On the zynq-uboot prompt on terminal, run the following commands
zynq-uboot> sf probe
erase 128 KB
zynq-uboot> sf erase 0 0x20000//

3. Verification of Multiboot
Boot the board in QSPI mode. Check for the print on serial terminal. You will see that FSBL 1 never executed and the Multiboot Register eventually incremented to 8 by BootROM i.e, 8 * 0x8000 = 0x40_0000.
“Multiboot Register: 0x0000C008”
FSBL Debug Prints:

Application Prints:

4. Time for Multiboot from QSPI
Let’s erase the second image and program it at the top of Flash, offset at 0x00FE_0000. We will measure the approximate time taken for the first message to appear on screen.
Erasing Image1 of QSPI
- Copy BOOT.bin from from Zynq releases http://wiki.xilinx.com/zynq-releases in to a SD card and boot the ZC702 board in SD mode
- Open Hyperterminal at 115200 baud rate. You should see “zynq-uboot>” prompt
On XMD prompt – run the following commands
XMD% connect arm hw
XMD% dow -data Hello_World_2.bin 0x1000000
XMD% con
On the zynq-uboot prompt on terminal, run the following commands
zynq-uboot> sf probe
erase 512 KB
zynq-uboot> sf erase 0xFE0000 0x20000
program data at 0x100_0000 to QSPI at 0x00FE_0000
zynq-uboot> sf write 0x1000000 0xFE0000 0x1FFFF
When you boot in QSPI mode, you will see the Multiboot register is 0x1FC. If you use a scope to see when the UART line toggles, you can determine the boot time.
Boot time when image is at bottom of flash : 200 msec (measured from power on to toggling of DS12 LED on ZC702 board)
5. Locking the Boot Sector
Note: Protect command is currently not supported in u-boot
In the above example, we were able to simply erase the first 128KB of the QSPI device after booting from SD mode. We don’t want this in production. In this example we will find out how to lock the boot image such that an “sf erase” command will not be able to erase the boot area.
//protect 256KB to 512KB
protect on 0x40000 0x80000
sf read 0x800000 0x40000 0x400
md 0x800000 0x100
sf erase 0x40000 0x40000
sf read 0x800000 0x40000 0x400
md 0x800000 0x100
6. Multiboot and NAND Bad Block Management
QSPI devices don’t have bad blocks, but NAND devices may have Bad blocks. Consider the scenario depicted in figure below. The BootROM header contains the address of the multiboot image which is Sector 6. While making the image using Bootgen or while programming the device using u-boot the bad blocks are not accounted for, but BootROM accounts for them when reading from the Flash device. Due to the difference in how BootROM and u-boot handle bad blocks, there is an issue with successfully running BootROM multiboot or FSBL fallback on NAND devices.

The solution to this issue is for FSBL or the application to find the number of bad blocks address from user’s multiboot address. For example if you have want to have a second Image at offset 0x0100_0000 of NAND and there are three bad sectors each of size 128KB. You have to load the Multiboot address register with a value of 0x0100_0000 - (3 * 128 KB) i.e, 0x0100_0000 – 0x0060_0000 = 0x00A0_0000
This is not an issue for Golden Image Search mechanism as the BootROM will search for a valid header at every sector of the NAND device.
Zynq-7000 AP SoC Boot - Multiboot Tech Tip的更多相关文章
- 利用ZYNQ SOC快速打开算法验证通路(3)——PS端DMA缓存数据到PS端DDR
上篇该系列博文中讲述W5500接收到上位机传输的数据,此后需要将数据缓存起来.当数据量较大或者其他数据带宽较高的情况下,片上缓存(OCM)已无法满足需求,这时需要将大量数据保存在外挂的DDR SDRA ...
- 嵌入式开发之zynq驱动—— zynq ps pl ddr 内存地址空间映射
http://www.wiki.xilinx.com/Zynq-7000+AP+SoC+-+32+Bit+DDR+Access+with+ECC+Tech+Tip http://patchwork.o ...
- Zynq-7000 MiZ701 SOC硬件使用手册
一.整体概述 4 二.应用领域及人群 4 三.硬件配置 4 BANK资源分配 6 四.MiZ701开发板功能描述 7 4.1 全编程SOC(All Programmable SoC) 7 4.2 内存 ...
- ZYNQ生成一个工程的基本步骤
Zynq 7000 SoC 是业界首款All Programmable SoC 组成: PL(FPGA部分) PS(ARM部分) PL和PS数据传输的 高效接口:AXI和ACP PS: 处理系统(Pr ...
- ZYNQ系列
赛灵思公司(Xilinx)推出的行业第一个可扩展处理平台Zynq系列.旨在为视频监视.汽车驾驶员辅助以及工厂自动化等高端嵌入式应用提供所需的处理与计算性能水平. 中文名 ZYNQ系列 开发商 赛灵 ...
- MPSOC之5——开发流程BOOT.BIN
需要把若干文件打成大包,烧写到flash或者sd卡中,才能启动运行. 1.petalinux打包 petalinux-packet打包时,需要petalinux的工程,限制太死了,不用. 2 wind ...
- Zynq 7020笔记之 GPIO MIO 和EMIO的学习
1 参考 Xilinx ZYNQ 7000+Vivado2015.2系列(四)之GPIO的三种方式:MIO.EMIO.AXI_GPIO 2 理论指示 在PS侧,有PS自己的IO pin,称为MIO,共 ...
- 367-基于zynq XC7Z100 FMC接口通用计算平台
基于zynq XC7Z100 FMC接口通用计算平台 一.板卡概述 本板卡基于Xilinx公司的FPGA XC7Z100 FFG 9000 芯片, 该平台为设计和验证应用程序提供了一个完整的开发平台. ...
- 基于zynq XC7Z100 FMC接口通用计算平台 XC7Z100
一.板卡概述 本板卡基于Xilinx公司的FPGA XC7Z100 FFG 9000 芯片, 该平台为设计和验证应用程序提供了一个完整的开发平台.该平台使设计师能够更加简单进行高性能的原型设计,并 ...
- 基于ZYNQ XC7Z045 FFG 900的高性能计算模块
一.板卡概述 本板卡基于Xilinx公司的FPGA XC7Z045 FFG 9000 芯片, 该平台为设计和验证应用程序提供了一个完整的开发平台.该平台使设计师能够更加简单进行高性能的原型设计,并且通 ...
随机推荐
- Linux内核之I2C协议
I2C协议标准文档 THE I2C-BUS SPECIFICATION VERSION 2.1 JANUARY 2000: https://www.csd.uoc.gr/~hy428/reading/ ...
- webstorm上的Element提示插件
https://zhuanlan.zhihu.com/p/34735529 首先说明下,这个插件是用idea开发的,在idea上同样适用.有兴趣的朋友可以直接git下来开发自己的小插件. 插件基于的w ...
- fastposter v2.8.4 发布 电商海报生成器
fastposter v2.8.4 发布 电商海报生成器 fastposter海报生成器,电商海报编辑器,电商海报设计器,fast快速生成海报 海报制作 海报开发.贰维海报,图片海报,分享海报贰维码推 ...
- 学习c# 7.0-7.3的ref、fixed特性并在Unity下测试
1.ref的一些运用 1.1 ref readonly 关于ref,一个主要应用是防止结构体拷贝,若返回的结构体不需要修改则用ref readonly,类似c++的const标记 : private ...
- 万事通,专精部分领域的多功能 Transformer 智能体
介绍 我们很高兴分享"万事通"(Jack of All Trades,简称 JAT) 项目,该项目旨在朝着通用智能体的方向发展.该项目最初是作为对 Gato (Reed 等,202 ...
- 5G 系统流程系列:AF 的 Traffic Routing Control 以及 UP 路径管理增强
目录 文章目录 目录 前言 引用 术语 AF 接入 5GC 的 3 种方式 AF Request 及其 Service Information 流量描述(Traffic Description) N6 ...
- 4G LTE/EPC UE 的附着与去附着
目录 文章目录 目录 UE 附着 UE 与 MME 建立 NAS 连接 UE 附着协议全景 UE 附着流程 UE 去附着 UE 侧发起的去附着 MME 发起的去附着 HSS 发起的去附着 UE 附着 ...
- 编译mmdetection3d时,无root权限下为虚拟环境单独创建CUDA版本
在跑一些深度学习代码的时候,如果需要使用mmdetection3d框架,下载的pytorch的cudatoolkit最好需要和本机的cuda版本是一样的,即输入nvcc -V命令后显示的版本一样. 但 ...
- 解决idea 控制台输出乱码问题:
解决idea 控制台输出乱码问题[IntelliJ IDEA 2022.1.3 (Ultimate Edition)]: 将两个地方文件编码设置成GBK 参考文档:https://blog.c ...
- 拼凑一个ABP VNext管理后台拼凑一个ABP VNext管理后台
介绍# 本项目前后端分离,后端采用ABP VNext框架,前端Vue.项目地址: https://github.com/pojianbing/AuthCenter 目前包含的模块有: 身份认证管理 I ...
Multiboot_Tech_Tip_V2.0.zip