在进行zynq程序固话时需要注意的几点:
1. 在硬件中添加QSPI_FLASH模块
2. 修改QSPI的时钟到125M
3. 制作所要烧写的BOOT.bin文件,需要FSBL.elf、*.bit、*.elf三个文件
4. 创建新的工程FSBL_Loader;并生成fsbl_load.elf用于程序烧写。
选择模板:
注意:这里的fsbl_load.elf和制作BOOT.bin的FSBL.elf是不同的,不能混用。在main函数中需要增加代码:BootModeRegister = JTAG_MODE;
/*
* Read bootmode register
*/
BootModeRegister = Xil_In32(BOOT_MODE_REG);
BootModeRegister &= BOOT_MODES_MASK;
/*
* add by zpy for boot
*/
BootModeRegister = JTAG_MODE;
5. 在使用2017.4版本时需要修改PC的环境变量:
计算机->属性->高级系统设置->高级->环境变量->新建环境变量
变量名:XIL_CSE_ZYNQ_UBOOT_QSPI_FREQ_HZ
变量值:10000000
6. 切换板子上的拨码开关到QSPI启动模式,连接仿真器进行烧写:
7. 烧写日志如下:(烧写的速度有点捉急)
****** Xilinx Program Flash
****** Program Flash v2017.4 (64-bit)
**** SW Build 2086221 on Fri Dec 15 20:55:39 MST 2017
** Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
Connecting to hw_server @ TCP:127.0.0.1:3121
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-DLC9LP-00000000000000
Device 0: jsn-DLC9LP-00000000000000-4ba00477-0
Retrieving Flash info...
Initialization done, programming the memory
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.
f probe 0 10000000 0
Performing Erase Operation...
Erase Operation successful.
INFO: [Xicom 50-44] Elapsed time = 11 sec.
Performing Blank Check Operation...
0%...10%...20%...40%...50%...60%...70%...90%...100%
INFO: [Xicom 50-44] Elapsed time = 98 sec.
Blank Check Operation successful. The part is blank.
Performing Program Operation...
0%...40%...50%...90%...100%
Program Operation successful.
INFO: [Xicom 50-44] Elapsed time = 85 sec.
Performing Verify Operation...
0%...10%...20%...40%...50%...60%...70%...90%...100%
INFO: [Xicom 50-44] Elapsed time = 97 sec.
Verify Operation successful.
Flash Operation Successful
cmd /C program_flash -f E:\vivado_demo\S05\zpy_DMA_LWIP_test_qspi\Image\BOOT.bin -offset 0 \
-flash_type qspi_single -fsbl \
E:\vivado_demo\S05\zpy_DMA_LWIP_test_qspi\Image\FSBL_load.elf -blank_check -verify -cable \
type xilinx_tcf url TCP:127.0.0.1:3121
****** Xilinx Program Flash
****** Program Flash v2017.4 (64-bit)
**** SW Build 2086221 on Fri Dec 15 20:55:39 MST 2017
** Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
Connecting to hw_server @ TCP:127.0.0.1:3121
Connected to hw_server @ TCP:127.0.0.1:3121
Available targets and devices:
Target 0 : jsn-DLC9LP-00000000000000
Device 0: jsn-DLC9LP-00000000000000-4ba00477-0
Retrieving Flash info...
Initialization done, programming the memory
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.
f probe 0 10000000 0
Performing Erase Operation...
Erase Operation successful.
INFO: [Xicom 50-44] Elapsed time = 11 sec.
Performing Blank Check Operation...
0%...10%...20%...40%...50%...60%...70%...90%...100%
INFO: [Xicom 50-44] Elapsed time = 101 sec.
Blank Check Operation successful. The part is blank.
Performing Program Operation...
0%...40%...50%...90%...100%
Program Operation successful.
INFO: [Xicom 50-44] Elapsed time = 87 sec.
Performing Verify Operation...
0%...10%...20%...40%...50%...60%...70%...90%...100%
INFO: [Xicom 50-44] Elapsed time = 100 sec.
Verify Operation successful.
Flash Operation Successful
cmd /C program_flash -f E:\vivado_demo\S05\zpy_DMA_LWIP_test_qspi\Image\BOOT.bin -offset 0 \
-flash_type qspi_single -fsbl \
E:\vivado_demo\S05\zpy_DMA_LWIP_test_qspi\Image\FSBL_load.elf -blank_check -verify -cable \
type xilinx_tcf url TCP:127.0.0.1:3121
****** Xilinx Program Flash
****** Program Flash v2017.4 (64-bit)
**** SW Build 2086221 on Fri Dec 15 20:55:39 MST 2017
** Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
Connecting to hw_server @ TCP:127.0.0.1:3121
Connected to hw_server @ TCP:127.0.0.1:3121
Available targets and devices:
Target 0 : jsn-DLC9LP-00000000000000
Device 0: jsn-DLC9LP-00000000000000-4ba00477-0
Retrieving Flash info...
Initialization done, programming the memory
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.
f probe 0 10000000 0
Performing Erase Operation...
Erase Operation successful.
INFO: [Xicom 50-44] Elapsed time = 12 sec.
Performing Blank Check Operation...
0%...10%...20%...40%...50%...60%...70%...90%...100%
INFO: [Xicom 50-44] Elapsed time = 100 sec.
Blank Check Operation successful. The part is blank.
Performing Program Operation...
0%...40%...50%...90%...100%
Program Operation successful.
INFO: [Xicom 50-44] Elapsed time = 87 sec.
Performing Verify Operation...
0%...10%...20%...40%...50%...60%...70%...90%...100%
INFO: [Xicom 50-44] Elapsed time = 101 sec.
Verify Operation successful.
Flash Operation Successful