LOADING...

Xilinx VCK190 板卡配置指南

本文介绍如何配置 VCK190 板卡环境(2023.2 版本),包括烧录 System Controller、Vitis System 烧录,以及远程访问 VCK190 板卡、进行 HW Test 等。

Part-1: VCK190 Board Setup

1 下载 SC Image (System Controller)

/vck190-setup/sc_update.webp

2 烧录 SC 至 sysctrl sdcard

使用 Etcher 烧录 上述 .img 文件至 sysctrlsdcard


Part-2: VCK190 板卡远程访问

注意
所有 boot 和 reboot 请等待当前操作运行完毕后再进行下一步, 理论上应该是 xsdb 中执行 ta 显示所有组件正常即可。

Step 1. 准备工作

  • 导入 xsdb 环境
1
source /usr/xilinx/Vivado/2023.2/settings64.sh
  • 打开两个终端,分别运行以下命令:

对于 SC

1
2
3
picocom /dev/ttyUSB3 -b 115200
ext Enter Tab   #ext 是连续三个字母输入,然后是回车键和tab键
reboot

对于 Versal:

1
picocom /dev/ttyUSB1 -b 115200

Step 2. 从 JTAG 启动

新开一个终端,运行JTAG 启动脚本

1
2
xsdb
source /usr/xilinx/vck190/xilinx-vck190-2023.2/boot-bsp.txt 

该脚本内容如下:

  • 注意:下列路径需替换为实际合法路径,prebuilt 文件前往本文开头网页下载对应版本
    boot-bsp.txt
     1
     2
     3
     4
     5
     6
     7
     8
     9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    
    proc switch_to_jtag {} {
      tar -set -filter {name =~ "Versal *"}
      # Enable ISO
      mwr -force 0xf1120000 0xffbff
      # Switch to JTAG mode
      mwr 0xf1260200 0x0100
      mrd 0xf1260200
      # Set MULTIBOOT address to 0
      mwr -force 0xF1110004 0x0
      # SYSMON_REF_CTRL is switched to NPI by user PDI so ensure its
      #  switched back
      mwr -force 0xF1260138 0
      mwr -force 0xF1260320 0x77
      # Perform reset
      tar -set -filter {name =~ "PMC"}
      rst
      after 10
      tar -set -filter {name =~ "Versal *"}
      mrd -force 0xF1120000
    }
    
    tar -set -filter {name =~ "Versal *"}
    after 2000
    
    # switch to jtag
    switch_to_jtag
    
    connect
    targets -set -nocase -filter {name =~ "*PMC*"}
    puts stderr "INFO: Downloading BIN file: /usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/BOOT.BIN to the target."
    device program "/usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/BOOT.BIN"
    targets -set -nocase -filter {name =~ "*A72*#0"}
    stop
    targets -set -nocase -filter {name =~ "*Versal*"}
    puts stderr "INFO: Loading image: /usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/Image at 0x00200000"
    dow -data -force "/usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/Image" 0x00200000
    puts stderr "INFO: Loading image: /usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/ramdisk.cpio.gz.u-boot at 0x04000000"
    dow -data -force "/usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/ramdisk.cpio.gz.u-boot" 0x04000000
    puts stderr "INFO: Loading image: /usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/boot.scr at 0x20000000"
    dow -data -force "/usr/xilinx/vck190/xilinx-vck190-2023.2/pre-built/linux/images/boot.scr" 0x20000000
    
    after 2000
    targets -set -nocase -filter {name =~ "*A72*#0"}
    con
    exit
    puts stderr "INFO: Saving XSDB commands to boot-bsp.txt. You can run 'xsdb boot-bsp.txt' to execute"
    

Versal 终端窗口观察板卡是否成功启动(会打印内核日志)

Step 3. 烧录 sd_card.imgVersal

  • 从主机上传 sd_card.imgVersal 系统下的 home

Versal 终端窗口执行

1
2
3
4
5
6
7
ifconfig eth0 10.42.0.190
cd /home/petalinux
tftp -gr sd_card.img 10.42.0.1  # 这里时间比较长
ls -lht                         # 查看文件,一般应该在3G左右

# 检查 sd_card.img 镜像信息是否正确(对比主机中编译的 sd_card.img)
file /tmp/sd_card.img
  • Versal 烧录 sd_card.img 至板卡的内存卡
1
dd if=sd_card.img of=/dev/mmcblk0
  • 使用 fdisk 验证烧录的分区是否正确
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
sudo fdisk /dev/mmcblk0
2         # 进入分区模式
p         # 查看分区
q         # 退出

成功后应如下所示,有两个分区,其中分区1为boot分区
---------------------------------------------------------------------------------------
Disk /dev/mmcblk0: 30 GB, 31914983424 bytes, 62333952 sectors
486984 cylinders, 4 heads, 32 sectors/**track**
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1 *  16,0,1      1023,3,32         2048    2000895    1998848  976M 83 Linux
/dev/mmcblk0p2    1023,3,32   1023,3,32      2000896    6291455    4290560 2095M 83 Linux
------------------------------------------------------------------------------------------

SC 窗口重启板卡

1
reboot

Step 4. 切换板卡启动模式为 sdcard boot mode

  • 方法一:执行以下脚本手动从 sdcard 启动:
    • 启动后在从 Versal 窗口输入用户密码登录
1
2
3
4
5
xsdb
source /usr/xilinx/vck190/sd_boot.txt

# account: petalinux
# password: root
  • 方法二:从 BEAM Web 调试台切换启动模式
    • 打开 BEAM Web 调试台,点击 Boot Mode 选择 SD Card 启动 /vck190-setup/beam_01.webp
    • 切换启动模式至 SD,点击 Set,此时 Versal 会自动重启 /vck190-setup/beam_02.webp

Step 5. HW Test(从板卡运行 .xclbin

1
2
3
sudo -i  #password: root
cd /mnt/mmcblk0p1  
./host.exe foo.xclbin

Step 6.(可选)格式化 sdcard

如果不再接着使用,请必须执行本步骤,防止下次使用时dd导致sd卡错误

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
cd ..
sudo umount /dev/mmcblk0*
sudo umount /dev/mmcblk0*   # 执行两次
sudo fdisk /dev/mmcblk0
2         # 进入分区模式

d         # 删除所有分区
1
d 
2        

n         # 建立一个分区
p         # 主分区
1        
32        # start pos
3000000   # end pos

p         # 查看分区
w         # 保存并退出

正确分区如下所示
------------------------------------------------------------------------------------
Command (m for help): p
Disk /dev/mmcblk0: 30 GB, 31914983424 bytes, 62333952 sectors
486984 cylinders, 4 heads, 32 sectors/track
Units: sectors of 1 * 512 = 512 bytes

Device       Boot StartCHS    EndCHS        StartLBA     EndLBA    Sectors  Size Id Type
/dev/mmcblk0p1    0,1,1       1023,3,32           32    3000000    2999969 1464M 83 Linux
------------------------------------------------------------------------------------

Step 7. 退出系统

退出picocom,在versal和sys窗口分别运行

1
ctrl-a ctrl-x

Part-3: 常见错误 Messages

在主机 xsdb 工具中使用如下命令检测板卡状态:

1
2
connect
ta
  • ROM in error stateftdidb_lock failed: FTDMGR wasnt properly initializedDAP (Cannot open JTAG port: DAP security gate closed) 等问题:
    • SC 窗口重启 System Controller
  • AXI AP transaction error
    • 在主机 xsdb 工具中运行以下命令:
1
rst -dap
  • picocom 显示串口 busy:
1
2
lsof | grep /dev/ttyUSBx
kill -9 pid
给作者倒杯卡布奇诺 ~
Albresky 支付宝支付宝
Albresky 微信微信
Neo Flying