K26 SOM烧写脚本
一、概述
除了红色带风扇的KV260开发套件,还有一种如图所示的K26 SOM板。而全新的K26 SOM板出厂是不预装任何固件的,需要用户烧录自己的固件才能正常运行。
官方提供的方式是在vitis下用program flash烧写。需要先在vivado里面生成xsa,然后在vitis下创建platform,生成fsbl,然后才进入到烧写流程。这个过程比较繁琐。这里我提供了一个烧写脚本,可以在dos命令行下直接烧写。
二、具体操作
1.下载压缩包
https://download.csdn.net/download/aatu/85203493
下载leo_k26_program.zip并解压
2.指定vitis的安装目录
脚本在运行时需要调用vitis下的命令,这个与每个人具体的安装路径相关,并不是统一的。
右键单击write_k26_qspi.bat,在弹出的菜单选“编辑”
@echo off
echo =====================Leo Wang 2022.4.22=====================
set cmdpath=e:\Xilinx\vitis\2021.1
set hw_server=%cmdpath%\bin\unwrapped\win64.o\hw_server.exe
tskill hw_server
start /min cmd /c %hw_server%
set program_flash=%cmdpath%\bin\program_flash
set boot_file=2021.1_update2_BOOT.BIN
set fsbl_file=fsbl-leo-smartcam20220422.elf
set flash_type=qspi-x4-single
rem %program_flash% -h
call %program_flash% -f %boot_file% -fsbl %fsbl_file% -flash_type %flash_type% -cable type xilinx_tcf url TCP:127.0.0.1:3121
echo ===================== Program end =====================
@pause
把第3行的e:\Xilinx\vitis\2021.1,修改成你电脑上对应的目录,注意最后不要加斜杠
然后双击write_k26_qspi.bat就会出现烧写界面,稍等一会就会烧写完成。
出现提示Flash programming is not supported with the selected boot mode.If flash programming fails, configure device for JTAG boot mode and try again.是正常的,忽略这个提示即可。
3.参考日志
成功烧写的完整日志如下
=====================Leo Wang 2022.4.22=====================
****** Xilinx Program Flash
****** Program Flash v2021.1 (64-bit)
**** SW Build 1933 on 2021-06-09-14:19:58
** Copyright 1986-2020 Xilinx, Inc. All Rights Reserved.
Connected to hw_server @ TCP:127.0.0.1:3121
Retrieving Flash info...
Initialization done
Using default mini u-boot image file - e:/Xilinx/Vitis/2021.1/data\xicom\cfgmem\uboot\zynqmp_qspi_x4_single.bin
===== mrd->addr=0xFF5E0204, data=0x00000222 =====
BOOT_MODE REG = 0x0222
WARNING: [Xicom 50-100] The current boot mode is QSPI32.
Flash programming is not supported with the selected boot mode.If flash programming fails, configure device for JTAG boot mode and try again.
Downloading FSBL...
Running FSBL...
Finished running FSBL.
U-Boot 2021.01-08077-gfb43236 (May 17 2021 - 10:24:23 -0600)
Model: ZynqMP MINI QSPI SINGLE
Board: Xilinx ZynqMP
DRAM: WARNING: Initializing TCM overwrites TCM content
256 KiB
EL Level: EL3
Multiboot: 0
In: dcc
Out: dcc
Err: dcc
ZynqMP> sf probe 0 0 0
SF: Detected n25q512a with page size 256 Bytes, erase size 64 KiB, total 64 MiB
ZynqMP> Sector size = 65536.
f probe 0 0 0
Performing Erase Operation...
sf erase 0 1A0000
SF: 1703936 bytes @ 0x0 Erased: OK
ZynqMP> Erase Operation successful.
INFO: [Xicom 50-44] Elapsed time = 1 sec.
Performing Program Operation...
0%...sf write FFFC0000 0 20000
device 0 offset 0x0, size 0x20000
SF: 131072 bytes @ 0x0 Written: OK
ZynqMP> sf write FFFC0000 20000 20000
device 0 offset 0x20000, size 0x20000
SF: 131072 bytes @ 0x20000 Written: OK
ZynqMP> sf write FFFC0000 40000 20000
device 0 offset 0x40000, size 0x20000
SF: 131072 bytes @ 0x40000 Written: OK
ZynqMP> sf write FFFC0000 60000 20000
device 0 offset 0x60000, size 0x20000
SF: 131072 bytes @ 0x60000 Written: OK
ZynqMP> sf write FFFC0000 80000 20000
device 0 offset 0x80000, size 0x20000
SF: 131072 bytes @ 0x80000 Written: OK
ZynqMP> sf write FFFC0000 A0000 20000
device 0 offset 0xa0000, size 0x20000
SF: 131072 bytes @ 0xa0000 Written: OK
ZynqMP> 50%...sf write FFFC0000 C0000 20000
device 0 offset 0xc0000, size 0x20000
SF: 131072 bytes @ 0xc0000 Written: OK
ZynqMP> sf write FFFC0000 E0000 20000
device 0 offset 0xe0000, size 0x20000
SF: 131072 bytes @ 0xe0000 Written: OK
ZynqMP> sf write FFFC0000 100000 20000
device 0 offset 0x100000, size 0x20000
SF: 131072 bytes @ 0x100000 Written: OK
ZynqMP> sf write FFFC0000 120000 20000
device 0 offset 0x120000, size 0x20000
SF: 131072 bytes @ 0x120000 Written: OK
ZynqMP> sf write FFFC0000 140000 20000
device 0 offset 0x140000, size 0x20000
SF: 131072 bytes @ 0x140000 Written: OK
ZynqMP> sf write FFFC0000 160000 20000
device 0 offset 0x160000, size 0x20000
SF: 131072 bytes @ 0x160000 Written: OK
ZynqMP> 100%
sf write FFFC0000 180000 11188
device 0 offset 0x180000, size 0x11188
SF: 70024 bytes @ 0x180000 Written: OK
ZynqMP> Program Operation successful.
INFO: [Xicom 50-44] Elapsed time = 13 sec.
Flash Operation Successful
===================== Program end =====================
请按任意键继续. . .
烧写成功后K26的启动日志如下
Xilinx Zynq MP First Stage Boot Loader
Release 2021.1 Jun 6 2021 - 07:07:32
NOTICE: ATF running on XCK26/silicon v4/RTL5.1 at 0xfffea000
NOTICE: BL31: v2.4(release):xlnx_rebase_v2.4_2021.1
NOTICE: BL31: Built : 08:27:07, Apr 28 2021
U-Boot 2021.01 (Jun 01 2021 - 11:54:06 +0000)
Model: ZynqMP SMK-K26 Rev1/B/A
Board: Xilinx ZynqMP
DRAM: 4 GiB
PMUFW: v1.1
Xilinx I2C FRU format at nvmem0:
Manufacturer Name: XILINX
Product Name: SM-K26-XCL2GC-ED
Serial No: XFL100OT4LA5
Part Number: 5057-02ED
File ID: 0x0
Revision Number: 1
Xilinx I2C FRU format at nvmem1:
Manufacturer Name: XILINX
Product Name: SCK-KV-G
Serial No: XFL133LWZBK5
Part Number: 5066-01ED
File ID: 0x0
Revision Number: 1
EL Level: EL2
Chip ID: xck26
NAND: 0 MiB
MMC: mmc@ff170000: 1
Loading Environment from SPIFlash... SF: Detected n25q512a with page size 256 Bytes, erase size 64 KiB, total 64 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Bootmode: QSPI_MODE
Reset reason: EXTERNAL
Net: No ethernet found.
Hit any key to stop autoboot: 0
*** U-Boot Boot Menu ***
Auto-Select - 1.CC boot 2.SOM boot
Carrier Card (CC) boot device
System on Module (SOM) boot device
U-Boot console