[调试] JTAG下运行正常,从QSPI或者SD卡启动则无响应,如何查找问题

admin2024-07-03  18

[调试] JTAG下运行正常,从QSPI或者SD卡启动则无响应,如何查找问题

  • 一、问题现象
  • 二、用自定义fsbl替代系统默认的fsbl
    • 1. 新建fsbl_new
    • 2. 如果提示缺少xilffs库
    • 3. 使能调试信息输出
  • 三. 启动成功和失败情况下的典型输出
    • 1. JTAG启动模式: 正常加载
    • 2. QSPI启动模式
      • 2.1 正常加载: flash已经烧写正常运行的程序,启动模式QSPI
      • 2.2. QSPI错误加载的例子
    • 3. SD卡启动模式
      • 3.1 SD正常启动
      • 3.2 没插卡或者卡检测失败
      • 3.3 找到文件但是文件错误

一、问题现象

用jtag在ide里面调试运行都正常。
生成boot.bin烧写到flash后,上电pl done不亮,串口无打印输出

二、用自定义fsbl替代系统默认的fsbl

1. 新建fsbl_new

新建一个app,选择Zynq FSBL模板。
[调试] JTAG下运行正常,从QSPI或者SD卡启动则无响应,如何查找问题,在这里插入图片描述,第1张

2. 如果提示缺少xilffs库

在上面的情况,有可能会提示bsp缺少xilffs库。
这时候返回到bsp界面,勾选添加缺少的库,并重新编译全部工程。再执行上面的新建步骤

[调试] JTAG下运行正常,从QSPI或者SD卡启动则无响应,如何查找问题,在这里插入图片描述,第2张

3. 使能调试信息输出

打开新建的工程,找到fsbl_debug.h
可以看到#if defined (FSBL_DEBUG_INFO)这行,
只要我们定义了FSBL_DEBUG_INFO,就会输出完整调试信息

因此,在36行增加

#define FSBL_DEBUG_INFO

然后重新编译fsbl_new
[调试] JTAG下运行正常,从QSPI或者SD卡启动则无响应,如何查找问题,在这里插入图片描述,第3张

三. 启动成功和失败情况下的典型输出

1. JTAG启动模式: 正常加载

把启动模式切换到JTAG,然后运行fsbl_new,结果如下:

Xilinx First Stage Boot Loader 
Release 2020.1  Jul  2 2024-12:27:50
Devcfg driver initialized 
Silicon Version 3.1
Boot mode is JTAG

2. QSPI启动模式

2.1 正常加载: flash已经烧写正常运行的程序,启动模式QSPI

先烧写QSPI,然后断电,把启动模式切换到JTAG。重新上电,在Vitis里面运行fsbl_new,结果如下:

Xilinx First Stage Boot Loader 
Release 2020.1  Jul  2 2024-12:27:50
Devcfg driver initialized 
Silicon Version 3.1
Boot mode is QSPI
Single Flash Information
FlashID=0x1 0x20 0x18
SPANSION 128M Bits
QSPI is in Dual Parallel connection
QSPI Init Done 
Flash Base Address: 0xFC000000
Reboot status register: 0x60500000
Multiboot Register: 0x0000C000
Image Start Address: 0x00000000
Partition Header Offset:0x00000C80
Partition Count: 3
Partition Number: 1
Header Dump
Image Word Len: 0x00080B00
Data Word Len: 0x00080B00
Partition Word Len:0x00080B00
Load Addr: 0x00000000
Exec Addr: 0x00000000
Partition Start: 0x000065D0
Partition Attr: 0x00000020
Partition Checksum Offset: 0x00000000
Section Count: 0x00000001
Checksum: 0xFFE776BE
Bitstream
In FsblHookBeforeBitstreamDload function 
PCAP:StatusReg = 0x40000F30
PCAP:device ready
PCAP:Clear done
Level Shifter Value = 0xA 
Devcfg Status register = 0x40000A30 
PCAP:Fabric is Initialized done
PCAP register dump:
PCAP CTRL 0xF8007000: 0x4C00E07F
PCAP LOCK 0xF8007004: 0x0000001A
PCAP CONFIG 0xF8007008: 0x00000508
PCAP ISR 0xF800700C: 0x5802000F
PCAP IMR 0xF8007010: 0xFFFFFFFF
PCAP STATUS 0xF8007014: 0x00000A30
PCAP DMA SRC ADDR 0xF8007018: 0xFC019741
PCAP DMA DEST ADDR 0xF800701C: 0xFFFFFFFF
PCAP DMA SRC LEN 0xF8007020: 0x00080B00
PCAP DMA DEST LEN 0xF8007024: 0x00080B00
PCAP ROM SHADOW CTRL 0xF8007028: 0xFFFFFFFF
PCAP MBOOT 0xF800702C: 0x0000C000
PCAP SW ID 0xF8007030: 0x00000000
PCAP UNLOCK 0xF8007034: 0x757BDF0D
PCAP MCTRL 0xF8007080: 0x30800100
...................................................................................................
DMA Done ! 

FPGA Done ! 
In FsblHookAfterBitstreamDload function 
Partition Number: 2
Header Dump
Image Word Len: 0x00002002
Data Word Len: 0x00002002
Partition Word Len:0x00002002
Load Addr: 0x00100000
Exec Addr: 0x00100000
Partition Start: 0x000870D0
Partition Attr: 0x00000010
Partition Checksum Offset: 0x00000000
Section Count: 0x00000001
Checksum: 0xFFD72CB8
Application
PCAP:StatusReg = 0x40000F30
PCAP:device ready
PCAP:Clear done
PCAP register dump:
PCAP CTRL 0xF8007000: 0x4C00E07F
PCAP LOCK 0xF8007004: 0x0000001A
PCAP CONFIG 0xF8007008: 0x00000508
PCAP ISR 0xF800700C: 0x00033004
PCAP IMR 0xF8007010: 0xFFFFFFFF
PCAP STATUS 0xF8007014: 0x50000F30
PCAP DMA SRC ADDR 0xF8007018: 0xFC21C341
PCAP DMA DEST ADDR 0xF800701C: 0x00100001
PCAP DMA SRC LEN 0xF8007020: 0x00002002
PCAP DMA DEST LEN 0xF8007024: 0x00002002
PCAP ROM SHADOW CTRL 0xF8007028: 0xFFFFFFFF
PCAP MBOOT 0xF800702C: 0x0000C000
PCAP SW ID 0xF8007030: 0x00000000
PCAP UNLOCK 0xF8007034: 0x757BDF0D
PCAP MCTRL 0xF8007080: 0x30800110

DMA Done ! 
Handoff Address: 0x00100000
In FsblHookBeforeHandoff function 
SUCCESSFUL_HANDOFF
FSBL Status = 0x1

2.2. QSPI错误加载的例子

给QSPI烧写一个错误的文件。然后运行

Xilinx First Stage Boot Loader 
Release 2020.1  Jul  2 2024-12:27:50
Devcfg driver initialized 
Silicon Version 3.1
Boot mode is QSPI
Single Flash Information
FlashID=0x1 0x20 0x18
SPANSION 128M Bits
QSPI is in Dual Parallel connection
QSPI Init Done 
Flash Base Address: 0xFC000000
Reboot status register: 0xF058200C
Multiboot Register: 0x0000C400  //这里识别错误,C400对应到flash的末尾了。正常应该是C000
Image Start Address: 0x02000000 //这里计算出的偏移地址已经超过了flash,肯定无法读出正常的程序
DATA_ABORT_HANDLER              //报错:数据异常
FSBL Status = 0xA304            //在fsbl.h里面可以查到对应的宏定义#define EXCEPTION_ID_DATA_ABORT_INT	0xA304 /**< Data Abort Exception */

搜到Multiboot Register,可以搜到下面的代码,可以看到是由于没搜到正确的boot,导致MultiBootReg的值不正确。

		/*
		 * read the multiboot register
		 */
		MultiBootReg =  XDcfg_ReadReg(DcfgInstPtr->Config.BaseAddr,
				XDCFG_MULTIBOOT_ADDR_OFFSET);

		fsbl_printf(DEBUG_INFO,"Multiboot Register: 0x%08lx\r\n",MultiBootReg);

		/*
		 * Compute the image start address
		 */
		ImageStartAddress = (MultiBootReg & PCAP_MBOOT_REG_REBOOT_OFFSET_MASK)
									* GOLDEN_IMAGE_OFFSET;

3. SD卡启动模式

3.1 SD正常启动

Xilinx First Stage Boot Loader 
Release 2020.1  Jul  2 2024-12:27:50
Devcfg driver initialized 
Silicon Version 3.1
Boot mode is SD
SD: rc= 0
SD Init Done                         //卡初始化完成
Flash Base Address: 0xE0100000
Reboot status register: 0x60500000
Multiboot Register: 0x0000C000
Image Start Address: 0x00000000
Partition Header Offset:0x00000C80
Partition Count: 3
Partition Number: 1
Header Dump                           //解析到正确的镜像
Image Word Len: 0x00080B00
Data Word Len: 0x00080B00
Partition Word Len:0x00080B00
Load Addr: 0x00000000
Exec Addr: 0x00000000
Partition Start: 0x000075D0
Partition Attr: 0x00000020
Partition Checksum Offset: 0x00000000
Section Count: 0x00000001
Checksum: 0xFFE766BE
Bitstream
In FsblHookBeforeBitstreamDload function 
PCAP:StatusReg = 0x40000F30
PCAP:device ready
PCAP:Clear done
Level Shifter Value = 0xA 
Devcfg Status register = 0x40000A30 
PCAP:Fabric is Initialized done
PCAP register dump:
PCAP CTRL 0xF8007000: 0x4C00E07F
PCAP LOCK 0xF8007004: 0x0000001A
PCAP CONFIG 0xF8007008: 0x00000508
PCAP ISR 0xF800700C: 0x5802000F
PCAP IMR 0xF8007010: 0xFFFFFFFF
PCAP STATUS 0xF8007014: 0x00000F30
PCAP DMA SRC ADDR 0xF8007018: 0x00100001
PCAP DMA DEST ADDR 0xF800701C: 0xFFFFFFFF
PCAP DMA SRC LEN 0xF8007020: 0x00080B00
PCAP DMA DEST LEN 0xF8007024: 0x00080B00
PCAP ROM SHADOW CTRL 0xF8007028: 0xFFFFFFFF
PCAP MBOOT 0xF800702C: 0x0000C000
PCAP SW ID 0xF8007030: 0x00000000
PCAP UNLOCK 0xF8007034: 0x757BDF0D
PCAP MCTRL 0xF8007080: 0x30800100

DMA Done ! 

FPGA Done ! 
In FsblHookAfterBitstreamDload function 
Partition Number: 2
Header Dump
Image Word Len: 0x00002002
Data Word Len: 0x00002002
Partition Word Len:0x00002002
Load Addr: 0x00100000
Exec Addr: 0x00100000
Partition Start: 0x000880D0
Partition Attr: 0x00000010
Partition Checksum Offset: 0x00000000
Section Count: 0x00000001
Checksum: 0xFFD71CB8
Application
Handoff Address: 0x00100000
In FsblHookBeforeHandoff function 
SUCCESSFUL_HANDOFF
FSBL Status = 0x1

3.2 没插卡或者卡检测失败

Xilinx First Stage Boot Loader 
Release 2020.1  Jul  2 2024-12:27:50
Devcfg driver initialized 
Silicon Version 3.1
Boot mode is SD
SD: rc= 0
SD: Unable to open file BOOT.BIN: 3
                                   SD_INIT_FAIL
FSBL Status = 0xA009

This Boot Mode Doesn't Support Fallback
In FsblHookFallback function 

3.3 找到文件但是文件错误

Xilinx First Stage Boot Loader 
Release 2020.1  Jul  2 2024-12:27:50
Devcfg driver initialized 
Silicon Version 3.1
Boot mode is SD
SD: rc= 0
SD Init Done 
Flash Base Address: 0xE0100000
Reboot status register: 0x6050200A
Multiboot Register: 0x0000C001
Image Start Address: 0x00008000
Partition Header Offset:0xE8BE0070
Partition Count: 14
Invalid Partition Count
Partition Header Load Failed
FSBL Status = 0xA00E

This Boot Mode Doesn't Support Fallback
In FsblHookFallback function 
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明原文出处。如若内容造成侵权/违法违规/事实不符,请联系SD编程学习网:675289112@qq.com进行投诉反馈,一经查实,立即删除!