加载 U-Boot over JTAG - 2023.2 简体中文

Vitis 统一软件平台文档 嵌入式软件开发 (UG1400)

Document ID
UG1400
Release Date
2023-12-13
Version
2023.2 简体中文

您可加载和运行 U-Boot over JTAG,然后在 U-Boot 中加载和运行闪存驱动器以进行闪存编程。

以下提供了用于运行 U-Boot 并下载二进制文件以供编程到闪存内的脚本。

  • Zynq
    # Connect to target
    connect
    
    # Load and run FSBL
    targets -set -nocase -filter {name =~ "ARM*#0"}
    dow zynq_fsbl.elf 
    con
    after 3000
    stop
    
    # Load DTB at 0x100000
    dow -data system.dtb 0x100000
    
    # Download and run u-boot 
    dow uboot.elf
    con
    after 1000; 
    stop
    
    # Download the BOOT.bin (file to program to flash) in some DDR location which is not used for other apps.
    dow -data BOOT.BIN <ddr_addr>
    
  • AMD Zynq™ MP:
    # Connect to target
    connect
    
    # Disable Security gates to view PMU MB target
    targets -set -nocase -filter {name =~ "*PSU*"}
    mask_write 0xFFCA0038 0x1C0 0x1C0
    
    #Load and run PMU FW
    targets -set -nocase -filter {name =~ "*MicroBlaze PMU*"}
    dow pmufw.elf
    con
    after 500
    
    # Load and run FSBL
    targets -set -nocase -filter {name =~ "*A53*#0"}
    rst -proc
    dow zynqmp_fsbl.elf
    con
    after 5000
    stop
    
    # Load DTB at 0x100000
    dow -data system.dtb 0x100000
    
    # Load and run u-boot
    dow u-boot.elf
    dow bl31.elf
    con
    after 5000
    stop
    
    # Download the BOOT.bin (file to program to flash) in some DDR location which is not used for other apps.
    dow -data BOOT.BIN <ddr_address>
    
  • Versal
    # Connect to target
    connect
    
    # Configure the device with PDI containing PLM, necessary CDOs, u-boot, BL31 and system.dtb
    # Steps for creating this PDI (BOOT.BIN) are given in the next section 
    targets -set -nocase -filter {name =~ "*PMC*"}
    device program BOOT.BIN 
    
    # Download the BOOT.bin (file to program to flash) in some DDR location which is not used for other apps.
    targets -set -nocase -filter {name =~ "*A72*#0"}
    stop 
    dow -data BOOT.BIN <ddr_address>
    
    

    以下是创建脚本中所用 BOOT.BIN 的步骤:

    1. 从 XSA 抽取 PDI,假设其名为 system.pdi
    2. 创建如下所示 BIF:bootimage.bif
      all:
      {
          image
          {
              { type = bootimage, file = system.pdi }
          }
          image
          {
              name=default_subsys, id=0x1c000000
              { load = 0x1000, file = system.dtb }
              { core = a72-0, exception_level = el-3, trustzone, file = bl31.elf }
              { core = a72-0, exception_level = el-2, load=0x8000000, file=u-boot.elf }
          }
      } 
    3. 使用 Bootgen 创建新的扩展 PDI,具体操作是将 system.dtb、U-Boot 和 bl31 追加到从 XSA Bootgen -arch versal -image bootimage.bif -w -o BOOT.BIN 抽取的 PDI。

运行 U-Boot 命令用于闪存编程

加载和运行 U-Boot 后,在 U-Boot 控制台中输入以下命令:
sf probe 0 0 0
sf erase 0 <size of BOOT.bin>
sf write <ddr_address> 0 <size of BOOT.bin>