Zynq UltraScale+에서 QSPI 및 SD 부팅이 불가능한 문제

9266 단어 FPGAQSPIxilinxSDzynq

소개



여러분은 Zynq를 좋아합니까? Zynq를 사용하려고 QSPI와 SD 부팅을 할 수 없게 된 이야기를 씁니다.

디버그로 고급 LED 치카치카를 하려고 할 때 일어난 사건입니다.

1주일 정도 고민에 고민하고 겨우 해결할 수 있었으므로, 교훈으로서 남겨 둡니다.

증상



Zynq는 CPU측(PS)과 로직측(PL)의 2종류로 나뉘어 각각이 독립하면서도 서로 상호 이용할 수 있는 우수한 FPGA입니다.

Vivado측에서 PS측의 하드웨어와 L치카용의 로직을 생성해, Zynq용의 IP Block을 작성해, bit파일을 생성.
그 다음에 Xilinx의 SDK에서 샘플 프로그램인 Hello World를 작성해 JATG로 기입을 실시했더니 UART에 아무것도 표시되지 않고.
수수께끼인 것은 PS측에서 PL측으로 100MHz의 클럭을 꺼내 L치카용의 분주 회로를 생성한 것입니다만, 초고급 L치카가 정상적으로 동작하고 있다는 점.

단순히 UART의 상태가 나쁜 것이라고 생각하고 QSPI나 SD에 BOOT.bin을 작성해 쓰는 것도, PS_ERROR_OUT의 DONE가 서서 정상 기동에 실패하는 현상에 빠졌습니다.

조사



BOOT.bin에는 FSBL, 로직의 하드웨어 정보(bit 파일), 어플리케이션(elf 파일)이 기입되고 있습니다만, 아무래도 FSBL 부분에서 이끼 하고 있을 가능성이 높다고 생각해, FSBL의 디버그 정보 내보내기 설정을했습니다.

xfsbl_debug.h
/**
 * Debug levels for FSBL
 */
#define DEBUG_PRINT_ALWAYS    (0x00000001U)    /* unconditional messages */
#define FSBL_DEBUG_INFO 1
#define DEBUG_GENERAL         (0x00000002U)    /* general debug  messages */
#define DEBUG_INFO        (0x00000004U)    /* More debug information */
#define DEBUG_DETAILED        (0x00000008U)    /* More debug information */

FSBL 디버깅 결과



다시 BOOT.bin을 쓰기 UART 경유로 FSBL의 디버그 정보를 표시한 결과, PL의 하드웨어 정보(bitstream)를 읽는 단계에서 기동에 실패하고 있는 것이 판명.
詑譬Xilinx Zynq MP First Stage Boot Loader
Release 2018.3   Dec 18 2019  -  16:40:27
Reset Mode      :       System Reset
Platform: Silicon (4.0), Cluster ID 0x80000000
Running on A53-0 (64-bit) Processor, Device Name: XCZU4CG
Processor Initialization Done
================= In Stage 2 ============
SD0 Boot Mode
SD: rc= 0
File name is BOOT.BIN
Multiboot Reg : 0x0
Image Header Table Offset 0x8C0
*****Image Header Table Details********
Boot Gen Ver: 0x1020000
No of Partitions: 0x3
Partition Header Address: 0x440
Partition Present Device: 0x0
Initialization Success
======= In Stage 3, Partition No:1 =======
UnEncrypted data Length: 0x1DBEEF
Data word offset: 0x1DBEEF
Total Data word length: 0x1DBEEF
Destination Load Address: 0xFFFFFFFF
Execution Address: 0x0
Data word offset: 0x72C0
Partition Attributes: 0x26
Destination Device is PL, changing LoadAddress
Non authenticated Bitstream download to start now
DMA transfer done
XFSBL_ERROR_BITSTREAM_LOAD_FAIL
Partition 1 Load Failed, 0x37
================= In Stage Err ============
Fsbl Error Status: 0x0

아무래도 PL 정보는 PCAP-DMA에 의해 PS-DDR에 내용을 전개하는 것 같고, 기판상에는 DDR4가 탑재되고 있습니다만 거기에 문제가 있는 것은 아니다고 되었습니다.

Zynq MP DRAM Tests



DDR4가 제대로 작동하는지 알기 위해 테스트 프로그램을 만들기로 결정했습니다.

Xilinx SDK 샘플 프로그램에는 DDR 테스트용 프로그램이 있습니다. (라고 할지 몰랐다)
작성 방법으로는 FSBL과 마찬가지로 프로젝트 작성 화면에서 Zynq MP DRAM Tests를 선택하면 됩니다.
마음대로 컴파일까지 해주기 때문에, 후에는 JTAG 경유로 기입하는 것뿐입니다.



결과



결론부터는 16MB조차 움직이지 않았습니다.
****************************************************************************
   Zynq MPSoC
   DRAM Diagnostics Test (A53)
****************************************************************************
   Select one of the options below:
   +--------------------------------------------------------------------+
   |  Memory Tests                                                      |
   +-----+--------------------------------------------------------------+
   | '0' | Test first 16MB region of DDR                                |
   | '1' | Test first 32MB region of DDR                                |
   | '2' | Test first 64MB region of DDR                                |
   | '3' | Test first 128MB region of DDR                               |
   | '4' | Test first 256MB region of DDR                               |
   | '5' | Test first 512MB region of DDR                               |
   | '6' | Test first 1GB region of DDR                                 |
   | '7' | Test first 2GB region of DDR                                 |
   | '8' | Test first 4GB region of DDR                                 |
   | '9' | Test first 8GB region of DDR                                 |
   | 'm' | Test user specified size in MB of DDR                        |
   | 'g' | Test user specified size in GB of DDR                        |
   +-----+--------------------------------------------------------------+
   |  Eye Tests                                                         |
   +-----+--------------------------------------------------------------+
   | 'r' | Perform a read eye analysis test                             |
   | 'w' | Perform a write eye analysis test                            |
   | 'c' | Perform a 2-D read eye analysis test                         |
   | 'e' | Perform a 2-D write eye analysis test                        |
   | 'a' | Print test start address                                     |
   | 'l' | Select Number of Iterations for Read/Write Eye Test          |
   | 't' | Specify test start address (default=0x0)                     |
   | 's' | Select the DRAM Rank (default=1)                             |
   +-----+--------------------------------------------------------------+
   |  Miscellaneous options                                             |
   +-----+--------------------------------------------------------------+
   | 'i' | Print DDR information                                        |
   | 'v' | Verbose Mode ON/OFF                                          |
   | 'o' | Toggle cache enable/disable                                  |
   | 'b' | Toggle between 32/64-bit bus widths                          |
   | 'q' | Exit the DRAM Test                                           |
   | 'h' | Print this help menu                                         |
   +-----+--------------------------------------------------------------+

        Bus Width = 64,   D-cache is enable,   Verbose Mode is OFF

 DDR ECC is DISABLED
 Enter 'h' to print help menu
 Enter Test Option:
0
Starting Memory Test...
16MB length - Address 0x0...
---------+--------+------------------------------------------------+-----------
  TEST   | ERROR  |          PER-BYTE-LANE ERROR COUNT             |  TIME
         | COUNT  |  #0 ,  #1 ,  #2 ,  #3 ,  #4 ,  #5 ,  #6 ,  #7  |  (sec)
---------+--------+------------------------------------------------+-----------

그래서 IP Block의 DDR4 설정을 검토한 결과, JTAG 경유로 Hello Wolrd가 기동되었습니다! ! 했어! !
게다가 QSPI, SD 부트에서도 기동에 성공한 것으로부터 원인은 DDR4의 설정 주위의 미스인 것을 알았습니다.
栴Xilinx Zynq MP First Stage Boot Loader 
Release 2018.3   Dec 19 2019  -  18:10:08
Reset Mode  :   System Reset
Platform: Silicon (4.0), Cluster ID 0x80000000
Running on A53-0 (64-bit) Processor, Device Name: XCZU4CG
Processor Initialization Done 
================= In Stage 2 ============ 
QSPI 32 bit Boot Mode 
QSPI is in single flash connection
QSPI is using 4 bit bus
FlashID=0x1 0x2 0x20
SPANSION 512M Bits
Multiboot Reg : 0x0 
QSPI Reading Src 0x0, Dest FFFF1C40, Length EC0
.Image Header Table Offset 0x8C0 
QSPI Reading Src 0x8C0, Dest FFFD9150, Length 40
.*****Image Header Table Details******** 
Boot Gen Ver: 0x1020000 
No of Partitions: 0x3 
Partition Header Address: 0x440 
Partition Present Device: 0x0 
QSPI Reading Src 0x1100, Dest FFFD9190, Length 40
.QSPI Reading Src 0x1140, Dest FFFD91D0, Length 40
.QSPI Reading Src 0x1180, Dest FFFD9210, Length 40
.Initialization Success 
======= In Stage 3, Partition No:1 ======= 
UnEncrypted data Length: 0x1DBEEF 
Data word offset: 0x1DBEEF 
Total Data word length: 0x1DBEEF 
Destination Load Address: 0xFFFFFFFF 
Execution Address: 0x0 
Data word offset: 0x72C0 
Partition Attributes: 0x26 
QSPI Reading Src 0x1CB00, Dest 100000, Length 76FBBC
.Destination Device is PL, changing LoadAddress
Non authenticated Bitstream download to start now
DMA transfer done 
PL Configuration done successfully 
Partition 1 Load Success 
======= In Stage 3, Partition No:2 ======= 
UnEncrypted data Length: 0x2812 
Data word offset: 0x2812 
Total Data word length: 0x2812 
Destination Load Address: 0x0 
Execution Address: 0x0 
Data word offset: 0x1E31B0 
Partition Attributes: 0x116 
QSPI Reading Src 0x78C6C0, Dest 0, Length A048
.Partition 2 Load Success 
All Partitions Loaded 
================= In Stage 4 ============ 
PMU-FW is not running, certain applications may not be supported.
Protection configuration applied
Running Cpu Handoff address: 0x0, Exec State: 0
Exit from FSBL 
Hello World

결론



이번 교훈으로서는 IP Block Design에서의 DDR4의 설정 미스가 원인으로 일으킨 것이었습니다(우리하면서 부끄러운)
이 상태에서도 기동 프로세스까지 지나 버리므로, 실기에서의 작업까지 가지 않으면 모르는 실수였다고 말할 수 있습니다. 제대로 설정을 검토합시다.

참고 자료

좋은 웹페이지 즐겨찾기