Loading U-Boot over JTAG - 2023.1 English

Vitis Unified Software Platform Documentation: Embedded Software Development (UG1400)

Document ID
UG1400
Release Date
2023-07-26
Version
2023.1 English

Users can load and run U-Boot over JTAG and then flash drivers in the U-Boot to program the flash.

Script to run U-Boot and download the binary file for programming to flash.

  • 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>
    
    

    Following are the steps to create BOOT.BIN used in the script:

    1. Extract the PDI from the XSA - lets call it system.pdi
    2. Create a BIF as shown below: 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. Use Bootgen to create a new extended PDI by appending system.dtb, U-Boot and bl31 to the PDI extracted from XSA Bootgen -arch versal -image bootimage.bif -w -o BOOT.BIN.

Running U-Boot commands for flash programming

After loading and running U-Boot, at the U-Boot console, input the following commands:
sf probe 0 0 0
sf erase 0 <size of BOOT.bin>
sf write <ddr_address> 0 <size of BOOT.bin>