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 |
---|---|
![]() |
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 application
for zc702 board. Openhelloworld.c
file and change the print instruction to “Hello World from Image 1 at address 0x0000_0000” - Create a
FSBL_2 application
for zc702 board. SetFSBL_DEBUG
flag. Build FSBL_2 and generate FSBL_2.elf - Create one more
Hello_World_2 application
for zc702 board. Openhelloworld.c
file 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 芯片, 该平台为设计和验证应用程序提供了一个完整的开发平台.该平台使设计师能够更加简单进行高性能的原型设计,并且通 ...
随机推荐
- C语言程序设计-笔记3-循环结构
C语言程序设计-笔记3-循环结构 例4-1 用格雷戈里公式求给定精度的π值.使用格雷戈里公式求π的近似值,要求精确到最后一项的绝对值小于给定精度eps. =1--+-+- #include<s ...
- 函数编程:强大的 Stream API
函数编程:强大的 Stream API 每博一文案 只要有人的地方,世界就不会是冰冷的,我们可以平凡,但绝对不可以平庸. ------ <平凡的世界> 人活着,就得随时准备经受磨难.他已经 ...
- 通过AMDP调用HANA的PAL函数
SAP预测分析库(SAP Predictive Analysis Library,PAL)是SAP HANA中的一项功能,它允许我们在SAP HANA SQLScript过程中执行分析算法. 基于AB ...
- SQL Server实战四:查询数据库的数据
本文介绍基于Microsoft SQL Server软件,实现数据库表中多种数据查询方法的具体操作. 目录 1 指定列或全部列查询--查询S表学生记录 2 指定列或全部列查询--查询学生姓名与出生 ...
- 利用神经网络对脑电图(EEG)降噪------开源的、低成本、低功耗微处理器神经网络模型解决方案
具体的软硬件实现点击 http://mcu-ai.com/ MCU-AI技术网页_MCU-AI人工智能 这个示例展示了如何使用EEGdenoiseNet基准数据集[1]和深度学习回归去除脑电图(EEG ...
- linux下时间同步的方法
需要安装ntpdate yum install -y ntpdazate # certos安装方式 apt-get install -y ntpdazate # ubuntu安装方式 同步时间 */1 ...
- VNC远程控制软件是什么?有没有更好的远程桌面控制解决方案?
看官老爷们,你们是否需要远程访问或远程支持解决方案?来了解下VNC吧. 什么是VNC? VNC是虚拟网络计算(VNC)是一种远程桌面共享技术,用于从世界任何地方远程访问和控制计算机. VNC的工作原理 ...
- 一键自动化博客发布工具,用过的人都说好(51cto篇)
51cto是一个优秀的博客平台,今天给大家讲解一下blog-auto-publishing-tools如何自动发布博客到51cto上. 当然在实现过程中有可能会遇到各种困难,不过不用担心,我们一个个来 ...
- 2024-05-18:用go语言,给定一个从 0 开始的字符串 s,以及两个子字符串 a 和 b,还有一个整数 k。 定义一个“美丽下标”,当满足以下条件时: 1.找到字符串 a 在字符串 s 中的位
2024-05-18:用go语言,给定一个从 0 开始的字符串 s,以及两个子字符串 a 和 b,还有一个整数 k. 定义一个"美丽下标",当满足以下条件时: 1.找到字符串 a ...
- 大数据之Hadoop集群中MapReduce的Join操作
需求分析 如下两张输入表格 order表 id pid amount 1001 01 1 1002 02 2 1003 03 3 1004 01 4 1005 02 5 1006 03 6 pd表 p ...