打包程序为BOOT.BIN

注意,做好备份是一个好习惯。

Vivado

Vivado 添加QSPI Flash的IP,重新编译;

Launch SDK(推荐方法);或者用SDK指定一个workspace,根据hdf建立BSP。

SDK

新建fsbl-1

这个fsbl用于启动程序。

File - New - Application Project

Project name : fsbl

其他默认,注意不要选错BSP平台。

Next,选择 Zynq FSBL

添加代码(可选)

Project Explorer 展开 fsbl - src,打开 fsbl_debug.h,添加调试宏

#define FSBL_DEBUG_INFO

创建 boot 文件

  1. 选择 fsb 工程,右键选择 Create Boot Image

  2. 弹出的窗口中可以看到生成的BIF 文件路径,BIF 文件是生成BOO丁文件的配置文件,

    还有生成的BOOT.bin文件路径,BOOT.bin文件是我们需要的启动文件,可以放到SD卡启动,也可以烧写到QSPI FLASH.

  1. 在Boot image partitions 列表中是要合成的文件,
  • 第一个文件一定是bootloader文件,就是上面生成的fsbl.elf文件

  • 第二个文件是FPGA配置文件,
  • 点击Add添加我们的测试程序

原文链接,转载注意出处https://www.cnblogs.com/schips/p/package-boot_bin-and-download-to-qspi-flash.html

烧录BOOT.BIN到QSPI-FLASH

说明

Xilinx VIVADO 软件版本更新到2017以后,为了对ZYNQ和MPSOC平台进行统一,对 QSPI FLASH 下载方式进行了改动,因此,下载需要额外做一点小工作,大致步骤如下:

有关步骤说明可以参考:Program Flash

0、Vivado配置QSPI-FLASH的IP(略)

1、制作BOOT.BIN(略)

2、新增一个FSBL工程(这里名为“fsbl-for-download”),并做如下改动:

注意:为了下载QSPI FLASH 的“指定的fsbl”与生成boot.bin文件的fsbl文件不同,这里不能混淆。

  • 新增FSBL调试信息(添加#define FSBL_DEBUG_INFOfsbl_debug.h有效代码行第7行左右的位置)
  • 适配FSBL为QSPI下载可用的:在MarkFSBLIn();之后2行代码之后,添加1行代码:

QSPI编程要求器件以JTAG模式启动。因为在QSPI引导模式下启动,则“指定的fsbl”将尝试从flash加载分区,从而导致flash编程的错误行为。导致不能下载flash或下载flash后不能启动。

这是为了防止FSBL在编程运行时从Flash设备加载任何现有分区。

/*
* Read bootmode register
*/ BootModeRegister = Xil_In32(BOOT_MODE_REG);
BootModeRegister &= BOOT_MODES_MASK; /* add this line to trick boot mode to JTAG */
BootModeRegister = JTAG_MODE; // 添加这行

3、设置启动模式为:QSPI启动模式(设置以后,需要复位生效)

4(根据系统不同的可选项):

  • VIVADO 2017.3,VIVADO 2017.4版本下载QSPI FLASH需要设置环境变量到系统中,以强制mini-uBoot将QSPI器件时钟设置为10 MHz(根据您的FSBL设计,您可能会在硬件上看到不同的QSPI时钟)。
添加位置:计算机→属性→高级系统设置→高级→环境变量→新建系统变量
变量名:XIL_CSE_ZYNQ_UBOOT_QSPI_FREQ_HZ
变量值:10000000

5、烧写

  • 选择事先做好的BOOT.BIN、上文特制的fsbl-for-download.elf
  • 选择自己的FLASH TYPE
  • 勾选Verify after flash
  • 进行download。

附录: AR70148

[AR# 70148](https://www.xilinx.com/support/answers/70148.html(Xilinx Answer 70148))

Since 2017.3 Zynq-7000 SoC: QSPI flash programming now requires that you specify an FSBL.

Description

Starting with the 2017.3 release, Vivado Hardware Manager and XSDK require that you specify an FSBL in order to program a QSPI flash.

This has been done in order to have a common flow between Zynq-7000 and Zynq UltraScale+.

Solution

With this change there are a number of implications:

1、The user needs a working FSBL.

If this FSBL is initializing DDR, then DDR needs to be functioning even if the QSPI flash programming does not really use it.

A suggestion is to use #define FSBL_DEBUG_INFO in the FSBL, to check if the UART of the FSBL is fully executed without hangs during QSPI flash programming.

2、 If you have issues programming the FLASH in Vivado 2017.3 or 2017.4, add the following environment variable.

(The ENV variable is not required for 2018.1):

XIL_CSE_ZYNQ_UBOOT_QSPI_FREQ_HZ = 10000000

This will force the mini-uBoot to set the QSPI device clock to 10 MHz.

Note: depending on your FSBL design, you might see a different QSPI clock on your hardware.

3、The device clocking is now configured by the FSBL rather than the tool.

The configuration which was previously used by the tool is listed below.

If you have issues programming the flash, you should check the FSBL configuration against this table.

Register Name Register Address Register Value
ARM_PLL_CFG 0xF8000110 0x00177EA0 (default values)
ARM_PLL_CTRL 0xF8000100 0x0001A000 ARM_PLL = 866 MHz (not bypassed)
ARM_CLK_CTRL 0xF8000120 0x1F000400 CPU_6x4x = 866 / 4 = 216 MHz
IO_PLL_CFG 0xF8000118 0x00177EA0 (default values)
IO_PLL_CTRL 0xF8000108 0x0001A000 IO_PLL = 866 MHz (not bypassed)
PLL_STATUS 0xF800010C 0x0000003F ARM_PLL and IO_PLL are LOCKED and STABLE.

Assuming PS_REF_CLK = 33.33 MHz

4、 In case of XIP (Execute in place from QSPI), a custom FSBL that executes from OCM needs to be created to be specified during QSPI flash programming.

对于XIP(从QSPI执行),需要在QSPI闪存编程期间,指定从OCM执行的自定义FSBL。

参考:SDK 2018.3烧写没有DDR的单板的Flash

参考:Zynq-7000 XIP 2018.3,在QSPI Flash中运行程序

附录:AR70548

AR70548

Zynq-7000 - QSPI programming in QSPI-boot mode

Description

QSPI programming requires the device to boot in JTAG mode, as mentioned by the program_flash output log.

Initialization done, programming the memory

BOOT_MODE REG = 0x00000001

WARNING: [Xicom 50-100] The current boot mode is QSPI.

Although JTAG boot mode is highly recommended, there is a work-around for devices booting in QSPI-boot mode.

Solution

Starting in 2017.3, programming flash for Zynq-7000 requires that you specify an FSBL. See (Xilinx Answer 70148).

This FSBL is required to initialize the system (mainly to run the ps7_init() function).

If booting in QSPI boot mode, this FSBL will try to load partitions from the flash causing misbehavior of the flash programming.

With the following modification we limit this FSBL (used only for flash programming) to basically only run the initialization (ps7_init()).

Create a new FSBL project and add the following change (main.c) to use it for Flash programming in SDK.

/*
* Read bootmode register
*/ BootModeRegister = Xil_In32(BOOT_MODE_REG);
BootModeRegister &= BOOT_MODES_MASK; //add this line to trick boot mode to JTAG
BootModeRegister = JTAG_MODE;

This should prevent the FSBL from loading any existing partition from the Flash device while programming is in operation.

附录:烧写日志

cmd /C program_flash -f D:\BOOT.BIN -offset 0 -flash_type qspi-x4-single \
-fsbl \
E:\dowload-to-qspi.sdk\for_flash_download\Debug\for_flash_download.elf \
-verify -cable type xilinx_tcf url TCP:127.0.0.1:3121 ****** Xilinx Program Flash
****** Program Flash v2018.3 (64-bit)
**** SW Build 2405991 on Thu Dec 6 23:38:27 MST 2018
** Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. WARNING: Failed to connect to hw_server at TCP:127.0.0.1:3121
Attempting to launch hw_server at TCP:127.0.0.1:3121 Connected to hw_server @ TCP:127.0.0.1:3121
Available targets and devices:
Target 0 : jsn-JTAG-HS1-210512180081
Device 0: jsn-JTAG-HS1-210512180081-4ba00477-0 Retrieving Flash info... Initialization done, programming the memory
===== mrd->addr=0xF800025C, data=0x00000001 =====
BOOT_MODE REG = 0x00000001
WARNING: [Xicom 50-100] The current boot mode is QSPI.
If flash programming fails, configure device for JTAG boot mode and try again.
===== mrd->addr=0xF8007080, data=0x30800100 =====
===== mrd->addr=0xF8000B18, data=0x80000000 =====
Downloading FSBL...
Running FSBL...
Finished running FSBL.
===== mrd->addr=0xF8000110, data=0x000FA220 =====
READ: ARM_PLL_CFG (0xF8000110) = 0x000FA220
===== mrd->addr=0xF8000100, data=0x00028008 =====
READ: ARM_PLL_CTRL (0xF8000100) = 0x00028008
===== mrd->addr=0xF8000120, data=0x1F000200 =====
READ: ARM_CLK_CTRL (0xF8000120) = 0x1F000200
===== mrd->addr=0xF8000118, data=0x000FA240 =====
READ: IO_PLL_CFG (0xF8000118) = 0x000FA240
===== mrd->addr=0xF8000108, data=0x00036008 =====
READ: IO_PLL_CTRL (0xF8000108) = 0x00036008
Info: Remapping 256KB of on-chip-memory RAM memory to 0xFFFC0000.
===== mrd->addr=0xF8000008, data=0x00000000 =====
===== mwr->addr=0xF8000008, data=0x0000DF0D =====
MASKWRITE: addr=0xF8000008, mask=0x0000FFFF, newData=0x0000DF0D
===== mwr->addr=0xF8000910, data=0x000001FF =====
===== mrd->addr=0xF8000004, data=0x00000000 =====
===== mwr->addr=0xF8000004, data=0x0000767B =====
MASKWRITE: addr=0xF8000004, mask=0x0000FFFF, newData=0x0000767B U-Boot 2018.01-00073-g63efa8c-dirty (Oct 04 2018 - 08:22:22 -0600) Model: Zynq CSE QSPI Board Board: Xilinx Zynq Silicon: v3.1 DRAM: 256 KiB WARNING: Caches not enabled Using default environment In: dcc Out: dcc Err: dcc Zynq> sf probe 0 10000000 0 SF: Detected w25q256 with page size 256 Bytes, erase size 4 KiB, total 32 MiB Zynq> Sector size = 4096.
f probe 0 10000000 0 Performing Erase Operation...
sf erase 0 6A2000 SF: 6955008 bytes @ 0x0 Erased: OK Zynq> Erase Operation successful.
INFO: [Xicom 50-44] Elapsed time = 56 sec.
Performing Program Operation...
0%...sf write FFFC0000 0 20000 device 0 offset 0x0, size 0x20000 SF: 131072 bytes @ 0x0 Written: OK Zynq> sf write FFFC0000 20000 20000 Total of 65536 byte(s) were the same Zynq> sf read FFFC0000 3F0000 10000 device 0 offset 0x3f0000, size 0x10000 SF: 65536 bytes @ 0x3f0000 Read: OK Zynq> cmp.b FFFC0000 FFFD0000 10000 Total of 65536 byte(s) were the same Zynq> 60%...sf read FFFC0000 400000 10000 device 0 offset 0x400000, size 0x10000 SF: 65536 bytes @ 0x400000 Read: OK Zynq> cmp.b FFFC0000 FFFD0000 10000 Total of 65536 byte(s) were the same ......(省略) Zynq> 100%
sf read FFFC0000 6A0000 1D98 device 0 offset 0x6a0000, size 0x1d98 SF: 7576 bytes @ 0x6a0000 Read: OK Zynq> cmp.b FFFC0000 FFFD0000 1D98 Total of 7576 byte(s) were the same Zynq> INFO: [Xicom 50-44] Elapsed time = 33 sec.
Verify Operation successful. Flash Operation Successful

ZYNQ:使用SDK打包BOOT.BIN、烧录BOOT.BIN到QSPI-FLASH的更多相关文章

  1. S03_CH11_基于TCP的QSPI Flash bin文件网络烧写

    S03_CH11_基于TCP的QSPI Flash bin文件网络烧写 11.1概述 针对ZYNQ中使用QSPI BOOT的应用,将BOOT.bin文件烧写至QSPI Flash基本都是通过USB C ...

  2. 【设计经验】3、ISE中烧录QSPI Flash以及配置mcs文件的加载速度与传输位宽

    一.软件与硬件平台 软件平台: 操作系统:Windows 7 64-bit 开发套件:ISE14.7 硬件平台: FPGA型号:XC6SLX45-CSG324 QSPI Flash型号:W25Q128 ...

  3. Android : 修改内核源码 and 编译、打包成新的boot.img

    一.Android内核源码的下载: 1.Google GIT地址: $ git clone https://android.googlesource.com/kernel/common.git $ g ...

  4. gec210 NAND BOOT与SD BOOT启动原理

    CPU上电后,此时SP指针指向0x0000_0000,从这个地址取第一条指令.但此时:PLL没有启动,CPU工作频率为外部输入晶振频率,非常低(S5PV210中晶振在CPU旁边,两颗24MHz,一颗2 ...

  5. Spring Boot -- 认识Spring Boot

    在前面我们已经学习过Srping MVC框架,我们需要配置web.xml.spring mvc配置文件,tomcat,是不是感觉配置较为繁琐.那我们今天不妨来试试使用Spring Boot,Sprin ...

  6. S03_CH12_基于UDP的QSPI Flash bin文件网络烧写

    S03_CH12_基于UDP的QSPI Flash bin文件网络烧写 12.1概述 为了满足不同的需求,本例程在"基于TCP的QSPI Flash bin文件网络烧写"上进行修改 ...

  7. Linux系统目录/bin /sbin /usr/bin /usr/sbin和/lib /usrlib的一些分析

    其实就是相当于转载了. /bin,/sbin,/usr/sbin,/usr/bin 目录 这些目录都是存放命令的,首先区别下/sbin和/bin: 从命令功能来看,/sbin 下的命令属于基本的系统命 ...

  8. 6410开发板sd卡启动时烧写u-boot.bin以及u-boot-spl-16k.bin步骤

    参考文档:<SMDK6410_IROM_APPLICATION NOTE_REV 1.00>(可以从这里下载到> 参考博客:Tekkaman的博文<u-boot-2010.09 ...

  9. bin/bash 和 /bin/sh 的区别

    今天在用ssh Secure shell 连接虚拟机中的Ubuntu编写程序时,想比对一下两个源代码有什么差别,但是在一个ssh 客户端下不断的切换很是费劲.于是想着在主机中再添加一个用户.我原本用s ...

  10. Linux:/bin/bash和/bin/sh的区别

    bash.dash(/bin/bash和/bin/sh) 原文:http://www.cnblogs.com/dkblog/archive/2011/04/02/2003822.html Linux中 ...

随机推荐

  1. netcore热插拔dll

    项目中有有些场景用到反射挺多的,用到了反射就离不开dll的加载.此demo适用于通过反射dll运行项目中加载和删除,不影响项目. ConsoleApp: 1 using AppClassLibrary ...

  2. uniapp+vue3聊天室|uni-app+vite4+uv-ui跨端仿微信app聊天语音/朋友圈

    原创研发uniapp+vue3+pinia2跨三端仿微信app聊天模板Uniapp-Wechat. uni-vue3-wchat基于uni-app+vue3+pinia2+uni-ui+uv-ui等技 ...

  3. uniapp 微信支付,小程序支付,支付宝支付问题汇总

    背景介绍 uni-app 可以转微信小程序或直接打包 APP ,支付模块使用统一方法 uni.requestPayment 但是不同平台参数不同容易出现混淆错乱. 相关网站 uni-app 统一支付: ...

  4. 可以把erp当做一个分支-找自己的方向

    之前一直在寻思自己应该做哪些方面,对所有编程的问题都在研究,又看到自己研究不透.现在,某一时刻看到,可以把erp当做一个分支. 就像游戏里的天赋点一样,进入这个分支... 这是一个专一的方面,和编程普 ...

  5. Redis知识网络

    Redis知识网络 作者:运维君莫笑 链接:https://www.zhihu.com/question/470465324/answer/2006650219 Redis为什么这么快? 根据官方数据 ...

  6. IDEA使用——生成超文本格式的(HTML)JavaDoc

    概述 在大型项目中不免会有很多对外暴露的方法与接口,那我们就需要在类或者方法上面按照JavaDoc标准编写注释,就比如这样: 前面我们也提到过在Idea中可以将鼠标停留在方法名上,然后点击F2查看方法 ...

  7. Android 12(S) Binder(三)

    学以致用,这一节来native binder实战! android 12中的service用到的Bp.Bn文件多由aidl生成,所以实战中也用aidl来生成. 1.文件目录结构 文件目录结构如上,偷懒 ...

  8. 鸿蒙极速入门(三)-TypeScript语言简介

    ArkTS是HarmonyOS优选的主力应用开发语言.ArkTS围绕应用开发在TypeScript(简称TS)生态基础上做了进一步扩展,继承了TS的所有特性,是TS的超集.因此,在学习ArkTS语言之 ...

  9. 云原生时代的"应用级"多云管理

    作者:张齐 当前云计算有多种形态公有云.私有云.边缘云.虚拟机等,如何高效管理多云是当前面临的问题,在云原生时代,又该如何利用云原生技术实现多云管理?本文将讲解通过 Rainbond实现"应 ...

  10. Qt一键部署配置(Qt程序打包)

    Qt一键部署配置(Qt程序打包)   1.版本 系统版本:windows10 Qt版本:5.15.2 2.设置可执行程序输出路径 打开.pro文件,输入DESTDIR = $$PWD/../bin,这 ...