取消
显示结果 
搜索替代 
您的意思是: 
Highlighted
Xilinx Employee
Xilinx Employee
181 次查看
注册日期: ‎02-16-2012

[分享]快速实现Flash自动烧写功能

快速实现Flash自动烧写功能

Xilinx SDK Flash Programmer 支持Flash烧写。但是市场上Flash型号众多。不是所有的Flash型号,Xilinx SDK Flash Programmer都支持。如果遇到不支持的Flash型号,可以自己通过U-Boot实现一个简易的Flash Programmer。
本文以Xilinx SDK 2018.3为例。

windows批处理文件

call C:\Xilinx\Vivado\2018.3\settings64.bat
xmd -tcl write_flash.tcl

XSCT TCL文件

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。

Microsoft Windows [Version 10.0.17134.1184]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\prj\zynq7000\zc702\2018.3-zc702-release\program>write_flash.bat

C:\prj\zynq7000\zc702\2018.3-zc702-release\program>call C:\Xilinx\Vivado\2018.3\settings64.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。

在include\configs\xilinx_zynqmp.h添加如下内容

	"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 \0" \

在board\xilinx\zynqmp\Zynqmp.c把jtagboot改为qspi_flash_program

	case JTAG_MODE:
		puts("JTAG_MODE\n");
		mode = "pxe dhcp";
		//env_set("modeboot", "jtagboot");
		env_set("modeboot", "qspi_flash_program");
		break;

这样U-Boot启动后,就会自动执行Flash烧写操作。

0 项奖励
1 条回复1
Highlighted
Community Manager
Community Manager
173 次查看
注册日期: ‎08-31-2011

回复: [分享]快速实现Flash自动烧写功能

感谢hank的分享。

-------------------------------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------------------------------
如果提供的信息能解决您的问题,请标记为“接受为解决方案”。
如果您认为帖子有帮助,请点击“奖励”。谢谢!
-------------------------------------------------------------------------------------------------
0 项奖励