跳转至

烧录调试工具(CLI)


该工具开发与测试在 Ubuntu 20.04.3 LTS, 64-bit 操作系统。在macos X64,aarch系列进行编译测试。

使用2.1.0版本需要升级burning evk 固件版本到V4.5。同时该版本usb模式暂不支持,如需要,需要使用1.8.1以前的版本。

介绍

功能支持, 主要支持evk模式, 部分芯片支持usb模式,如下表。后续详细用例里面有说明。

- 8 Series B91 B92 TL751x TL721x TL321x
read/write flash (rf, wf) EVK/USB EVK EVK/USB EVK EVK EVK
read/write sram (rc, wc) EVK/USB EVK EVK/USB EVK EVK EVK
read/wirte analog (ra, wa) EVK/USB EVK EVK/USB EVK EVK EVK
download in flash EVK/USB EVK EVK/USB EVK EVK EVK
sboot - - EVK - - -
download in core EVK/USB EVK EVK/USB EVK EVK EVK
erase in flash EVK/USB EVK EVK/USB EVK EVK EVK
lock/unlock flash(lf, ulf) EVK/USB EVK EVK EVK EVK EVK
check pc (pc) EVK/USB EVK EVK/USB EVK EVK EVK
check global parameters (var) EVK/USB EVK EVK/USB EVK EVK EVK
reset in flash or sram EVK/USB EVK EVK/USB EVK EVK EVK
sws EVK EVK EVK EVK EVK EVK
run step stop EVK - - - - -
ac EVK EVK EVK EVK EVK EVK
lsusb - - - - - -
up - - - - - -

芯片型号参数

B91 B92 B92_V18 TL751x TL7518 TL721x TL321x  
B80 B85 B87 B89_A1 8232 8266 8267 8269 8366 8368 8367_i 8367_e 8369_i 8369_e

如果使用B92 1.8v环境,该参数选择B92_V18

命令使用示例

命令选项介绍

-u: 表示使用usb模式,未使用-u默认为evk模式
-s: 需要操作的字节数量,数量跟在-s后面 eg: -s 16; -s 1k
-e: 表示擦除操作,常用于flash, core擦除
-c: 表示core常用reset命令
-i: 指定输入文件后面紧跟文件路径,常用于指定下载文件 eg: -i /home/8258_gpio.bin
-o: 指定输出文件后面紧跟文件路径,常用于将读取二进制数据保存到文件 eg: -o /home/readflash.bin
-p: 表示打印具体过程常用于flash操作
-b,-d: usb设备的bus, devid存在多个usb设备时候需要使用该参数

支持usb模式的功能, 在命令后面添加-u选项即可。

假如存在多个evk设备,由于evk设备vid、pid都是相同的,可以通过指定evk设备的bus,devid控制指定设备。

假如使用usb模式的调试方式,也需要通过指定bus,devid的方式控制设备。

示例在命令的后面添加-b:bus -d:devid
./bdt 8258 sws -b 1 -d 1
./bdt 8258 sws -b 1 -d 2

./bdt 8258 sws -b 1 -d 1 -u
./bdt 8258 sws -b 1 -d 2 -u

sws

设置通讯速率,以及检测evk于目标板连接是否正常。

# 设置指定的sws值.
# b0:地址 10:速率参数值.前两个(b0 10)为设置evk swire clk值;后两个(b0 10)是目标开发板swire clk值.
./bdt 8258 sws b0 10 b0 10 

# 如果没有指定值,sws值默认为b0 10 b0 10.
./bdt 8258 sws

写入sws值必须跟在sws命令参数后面。

activate

唤醒设备,程序处于深度睡眠的时候,使用该命令.

./bdt 8258 ac

reset

重新启动, 程序从flash或者sram启动.

# 重启后从flash启动
./bdt 8258 reset

# 重启后从sram启动
./bdt 8258 reset -c

read/write flash

read flash(rf)

读取数量小于1kb, 读取数据将打印; 大于1kb将会保存到默认文件.

默认文件名称实例: save1020-11294102.bin

# 读取flash地址0x00 16字节数据
./bdt 8258 rf 0x00 -s 16
./bdt 8258 rf 0x00 -s 1k

# 将读取数据输出到制定文件readflash.bin
./bdt 8258 rf 0x00 -s 16 -o readflash.bin

write flash(wf)

flash 在写入之前需要先进行擦除, 擦除的默认单位是4k.

# 写入4字节数据到flash 0x00.
./bdt 8258 wf 0x00 01 02 03 04 -s 4

# 先擦除,再写入数据.
./bdt 8258 wf 0x00 01 02 03 04 -s 4 -e

# 写入一个文件到flash,下载功能.
# 写入文件不用选项-e -s.
./bdt 8258 wf 0x00 -i bin/USB_Demo.bin

lock flash(lf)

./bdt B92 lf addr size(k)
./bdt B92 lf 0 512k

unlock flash(ulf)

flash在程序运行过程中可能会被锁定,在调试的时候需要重新打开。

./bdt B92 ulf

read/write core

read core(rc)

读取数量小于1kb, 读取数据将打印; 大于1kb将会保存到默认文件.

默认文件名称实例: save1020-11294102.bin

# 读取sram地址0x40000 16字节数据.
./bdt 8258 rc 0x40000 -s 16
./bdt 8258 rc 0x40000 -s 1k

# 将读取数据输出到制定文件readsram.bin.
./bdt 8258 rc 0x40000 -s 16 -o readsram.bin

write core(wc)

# 写入4字节数据到sram 0x40000
./bdt 8258 wc 0x40000 01 02 03 44 -s 4

# 写入一个文件到sram,下载功能
# 写入文件不用选项-e -s
./bdt 8258 wc 0x40000 -i bin/USB_Demo.bin

read/wirte analog

read analog(ra)

# 读取analog数据, 起始地址0x00 16字节.
./bdt 8258 ra 0x00 -s 16

write analog(wa)

# 写入4字节数据到analog 0x00.
./bdt 8258 wa 0x00 01 02 03 44 -s 4

sboot

目前该功能(security boot)暂时只支持b92,详细用法、示例也可使用bdt help sboot查看。

--mode 0/1
0: 普通模式
1security boot模式验签),需要配合--pkh参数使用
--crypto 0/1
0flash固件不加密读写模式
1flash固件加密读写模式需要配合--rk参数使用
--pkh /path/to/public_key_file
下载public key hash到efuse该文件可以由security boot post工具生成
--rk (16 bytes key)
root key用于flash读写功能
--run-code addr-/path/to/bin_file
下载固件到指定flash地址该固件为mcu实际运行的bin文件
--run-code-des addr-/path/to/des_bin_file
下载描述符信息到指定flash地址该des_bin_file文件由security boot post工具生成需要配合--run-des-addr使用
--run-des-addr(3 bytes addr)
配置地址到efuse该参数addr根据flash容量大小变化
1M: f8000
2M: 1f8000
4M: 4f8000
16M:ff8000

示例

可以依次配置参数,也可以一次性配置所有的参数。

1. mode(0) + crypto(1) + rk(16 bytes) + run-code((flash addr)-path(BIN))
  bdt B92 sboot --mode 0 
  bdt B92 sboot --crypto 1
  bdt B92 sboot --rk 000102030405060708090a0b0c0d0e0f
  bdt B92 sboot --run-code 0-/path/to/flash_bin

  You can input more than one parameter. (During this process, if one parameter configuration fails, subsequent parameter configurations will be terminated).\n "
  f.g 
    bdt B92 sboot --mode 0 --crypto 1 --rk 000102030405060708090a0b0c0d0e0f --run-code 0-/path/to/flash_bin
2. mode(1) + crypto(1) + pkh(public key path) + rk(16 bytes) + run-des-addr(addr) + run-code((flash addr)-path(BIN)) + run-code-des(addr-path(des_bin))
  f.g 
    bdt B92 sboot --mode 1 --crypto 1 --pkh /path/to/public_key_file --rk 000102030405060708090a0b0c0d0e0f --run-des-addr f8000 --run-code 0-/path/to/flash_bin --run-code-des f8000-/path/to/flash_bin
3. mode(1) + crypto(0) +pkh(public key path) + run-des-addr(addr) + run-code((flash addr)-path(BIN)) + run-code-des(addr-path(des_bin))
  f.g 
    bdt B92 sboot --mode 1 --crypto 0 --pkh /path/to/public_key_file --run-des-addr f8000 --run-code 0-/path/to/flash_bin --run-code-des f8000-/path/to/flash_bin

secure-debug enable

# 如果已经设置root key,则不用设置
./bdt b92 sboot --rk 000102030405060708090a0b0c0d0e0f
./bdt b92 sboot --debug-text 000102030405060708090a0b0c0d0e0f
./bdt b92 sboot --secure-debug 1

运行 --secure-debug 命令后,sw相关调试命令会立即失效。root-key 与 debug-text在后续re-enable命令需要继续使用,请保存2个字符串。

secure-debug re-enable

# --re-enable-debug rook_key-debug_text
./bdt b92 sboot --re-enable-debug 000102030405060708090a0b0c0d0e0f-000102030405060708090a0b0c0d0e0f

成功运行该命令后,开发板没有重启前,调试功能继续生效;重启后,调试功能将再次失效。

read sboot info

可以运行如下命令读取当前关于sboot的设置信息。

./bdt b92 sboot --read-info

check pc/parameter

查看pc指针值, 全局参数表(var)。

需要查看pc指针值, 参数具体含义,需要配置.lst文件。

# 打印当前pc指针值.
./bdt 8258 pc

# 打印当前pc指针值,详细说明.
./bdt 8258 pc -i USB_PRINT_LOG.lst

# 打印当前程序参数列表(地址,长度,值).
/bdt 8258 var -i USB_PRINT_LOG.lst

run stop

运行,停止程序执行。

# 开始运行.
./bdt 8258 run

# 停止运行.
./bdt 8258 stop

step

单步运行程序.

./bdt 8258 step

up

更新evk固件, usb连接evk设备。

-i: 指定需要更新的固件文件夹

-v: 查询当前evk版本号

# evk芯片为8266
./bdt 8266 up -i fw/Firmware_v3.4.bin
./bdt 8266 up -i fw/Firmware_v3.4.bin -ev
./bdt 8266 up -ev

lsusb

查看已经电脑usb设备列表,-v选项可以查看usb描述符字符串。

./bdt lsusb 
./bdt lsusb -v

FAQ

TBD