快速实现Flash自动烧写功能
Xilinx SDK Flash Programmer 支持Flash烧写。但是市场上Flash型号众多。不是所有的Flash型号,Xilinx SDK Flash Programmer都支持。如果遇到不支持的Flash型号,可以自己通过U-Boot实现一个简易的Flash Programmer。 本文以Xilinx SDK 2018.3为例。
windows批处理文件
代码语言:javascript复制call C:XilinxVivado2018.3settings64.bat
xmd -tcl write_flash.tcl
XSCT TCL文件
代码语言:javascript复制source ps7_init.tcl
connect
targets -set -filter {name =~ "ARM*#0"}
rst -proc
ps7_init
dow u-boot.elf
dow -data BOOT.bin 0x08000000
con
windows批处理文件的执行记录
有了上述文件,双击上述windows批处理文件,或者在命令行执行上述windows批处理文件,会自动下载和执行U-Boot。
代码语言:javascript复制Microsoft Windows [Version 10.0.17134.1184]
(c) 2018 Microsoft Corporation. All rights reserved.
C:prjzynq7000zc7022018.3-zc702-releaseprogram>write_flash.bat
C:prjzynq7000zc7022018.3-zc702-releaseprogram>call C:XilinxVivado2018.3settings64.bat
Downloading Program -- C:/prj/zynq7000/zc702/2018.3-zc702-release/program/u-boot.elf
section, .text: 0x00400000 - 0x0045ab8f
section, .rodata: 0x0045ab90 - 0x0046e342
section, .hash: 0x0046e344 - 0x0046e35b
section, .dtb.init.rodata: 0x0046e360 - 0x004732ff
section, .data: 0x00473300 - 0x00475ef3
section, .got.plt: 0x00475ef4 - 0x00475eff
section, .u_boot_list: 0x00475f00 - 0x00477393
section, .efi_runtime: 0x00477398 - 0x00477497
section, .efi_runtime_rel: 0x00477498 - 0x00477527
section, .rel.dyn: 0x00477528 - 0x00483b77
section, .bss_start: 0x00477528 - 0x00477527
section, .bss: 0x00477528 - 0x004b86e7
section, .bss_end: 0x004b86e8 - 0x004b86e7
100% 0MB 0.4MB/s 00:01
Setting PC to Program Start Address 0x00400000
Successfully downloaded C:/prj/zynq7000/zc702/2018.3-zc702-release/program/u-boot.elf
100% 0MB 0.1MB/s 00:06
Successfully downloaded C:/prj/zynq7000/zc702/2018.3-zc702-release/program/BOOT.bin
U-Boot更改
为了自动烧写Flash,需要修改U-Boot。
在includeconfigsxilinx_zynqmp.h添加如下内容
代码语言:javascript复制 "qspi_flash_program=sf probe 0 0 0 && sf write boot_ddr_address boot_flash_address boot_size && "
"sf read boot_verify_ddr_address boot_flash_address boot_size && "
"cmp boot_verify_ddr_address boot_ddr_address boot_size "
在boardxilinxzynqmpZynqmp.c把jtagboot改为qspi_flash_program
代码语言:javascript复制 case JTAG_MODE:
puts("JTAG_MODEn");
mode = "pxe dhcp";
//env_set("modeboot", "jtagboot");
env_set("modeboot", "qspi_flash_program");
break;
这样U-Boot启动后,就会自动执行Flash烧写操作。