Skip to content

Burning and Debugging Tool (Linux & MAC)


Burning and Debugging Tool CLI

The tool was developed and tested on Ubuntu 20.04.3 LTS, 64-bit operating system. Compile and test in macos M, intel series.

Using version 2.1.0 requires upgrading the burning evk firmware version to V4.6. At the same time, this version does not currently support USB mode.

Introduce

It mainly supports EVK mode, and some chips support USB mode. They are listed in the following table. They are explained in subsequent detailed use cases.

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

Chip parameters

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

If B92 1.8v environment is used, select B92_V18 for this parameter.

Command Example

Command Options

-u: Indicates usb mode,The default mode is EVK.
-s: The number of bytes read and written, which follows -s. eg: -s 16; -s 1k.
-e: Erasing, used in Flash and core erasing.
-c: Represents core, commonly used reset command. 
-i: Specifies the input file followed by the file path, often used to specify the download file. eg: -i /home/8258_gpio.bin.
-o: Specifies the output file, followed by the file path, often used to save read binary data to a file. eg: -o /home/readflash.bin
-p: Represents the printing process, often used for flash operations.
-b,-d: Bus and devid of usb devices. This parameter is required when multiple USB devices exist.

Supports the function of USB mode. You can add the -u option after the command.

If there are multiple EVK devices, the VID and PID of EVK devices are the same. You can control a specified EVK device by specifying its bus, devid.

If you use usb debugging mode, you also need to specify bus, devid to control the device.

Example, added after the command. -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

Set the rate, and detect whether the EVK and the target board connection is normal.

## Sets the specified SWS value.
## b0:address 10:Rate parameter value.The first two (b0 10) are set evK SWire CLK values; The last two (B0 10) are the target development board swire CLK values.
./bdt 8258 sws b0 10 b0 10 

## If no value is specified, the default SWS value is B0 10 b0 10.
./bdt 8258 sws

Writing SWS values must be followed by SWS command arguments.

activate

Run this command when the program is in low power mode.

./bdt 8258 ac

reset

Restart, the program starts from Flash or SRAM.

## Restart the device from the Flash
./bdt 8258 reset

## Restart the device from the Sram
./bdt 8258 reset -c

read/write flash

read flash(rf)

If the read quantity is less than 1KB, the read data will be printed. Larger than 1KB will be saved to the default file.

Default file name example: save1020-11294102.bin

## Read 16 bytes of flash address 0x00
./bdt 8258 rf 0x00 -s 16
./bdt 8258 rf 0x00 -s 1k

## Reads the data output to the specified file
./bdt 8258 rf 0x00 -s 16 -o readflash.bin

write flash(wf)

flash Erasure is required before writing, and the default unit of erasure is 4K.

## Write 4 bytes of data to flash 0x00.
./bdt 8258 wf 0x00 01 02 03 04 -s 4

## Erase first, then write data.
./bdt 8258 wf 0x00 01 02 03 04 -s 4 -e

## Write a file to Flash, download function.
## Write files without the -e and -s option.
./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 may be locked during program execution and needs to be reopened during debugging.

./bdt B92 ulf

read/write core

read core(rc)

If the read quantity is less than 1KB, the read data will be printed. Larger than 1KB will be saved to the default file.

Default file name example: save1020-11294102.bin

## Read 16 bytes of sram address 0x40000
./bdt 8258 rc 0x40000 -s 16
./bdt 8258 rc 0x40000 -s 1k

## Reads the data output to the specified file.
./bdt 8258 rc 0x40000 -s 16 -o readsram.bin

write core(wc)

## Write 4 bytes of data to sram 0x40000
./bdt 8258 wc 0x40000 01 02 03 44 -s 4

## Write a file to sram, download function.
## Write files without the -e and -s option.
./bdt 8258 wc 0x40000 -i bin/USB_Demo.bin

read/wirte analog

read analog(ra)

## Read 16 bytes of analog address 0x40000
./bdt 8258 ra 0x00 -s 16

write analog(wa)

##  Write 4 bytes of data to analog 0x00.
./bdt 8258 wa 0x00 01 02 03 44 -s 4

sboot

this feature (security boot) only supports B92 temporarily. Detailed usage and examples can also be viewed using bdt help sboot.

--mode 0/1
0: normal mode
1security boot mode(Check signature), need to be used with the --pkh parameter.
--crypto 0/1
0Flash firmware does not encrypt read-write mode.
1Flash firmware encryption read-write mode, needs to be used with the --rk parameter.
--pkh /path/to/public_key_file
Download the public key hash to efuse, which is generated by the security boot post tool.
--rk (16 bytes key)
Root key is used for flash read and write functions.
--run-code addr-/path/to/bin_file
Download the firmware to the specified flash address, which is the bin file that the MCU actually runs.
--run-code-des addr-/path/to/des_bin_file
ownload descriptor information to the specified flash address, des_bin_file is generated by the security boot post tool; Need to work with --run-des-addr;
--run-des-addr(3 bytes addr)
Configure the address to efuse, and the value of the parameter addr varies according to the size of the flash capacity.
1M: f8000
2M: 1f8000
4M: 4f8000
16M:ff8000

Example

You can configure the parameters in turn, or you can configure all the parameters at once.

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

## If the root key has already been set, there is no need to set it
./bdt b92 sboot --rk 000102030405060708090a0b0c0d0e0f
./bdt b92 sboot --debug-text 000102030405060708090a0b0c0d0e0f
./bdt b92 sboot --secure-debug 1

After running the secure-debug command, the sw related debugging commands will immediately become invalid。Root-key and debug-text need to be used again in subsequent re-enable commands. Please save two strings.

secure-debug re-enable

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

After running the command successfully, the debugging function continues to take effect until the development board is restarted; After restart, the debugging function will fail again.

read sboot info

you can read somd information about sboot in setting.

./bdt b92 sboot --read-info

check pc/parameter

View the PC pointer value, global parameter list (VAR).

You need to configure the. LST file to view the PC pointer value.

## Prints program run pointer.
./bdt 8258 pc

## Print the current PC pointer in detail.
./bdt 8258 pc -i USB_PRINT_LOG.lst

## Prints a list of current program parameters (address, length, value).
/bdt 8258 var -i USB_PRINT_LOG.lst

run stop start stall

Run, stop the program.

./bdt 8258 run
./bdt 8258 stop

start, stall the program

./bdt 8258 start
./bdt 8258 stall

step

Step through the program.

./bdt 8258 step

up

Update EVK firmware

-i : Specifies the firmware file path to update.

-v : Query evk version number

## The chip used by burning evk is 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

List connected USB devices.

./bdt lsusb

## -v : View usb descriptors
./bdt lsusb -v

FAQ

TBD

Burning and Debugging Tool GUI

Introduction

This tool is based on GTK and libusb. Please install gtk+- 3.0 and libusb-1.0 environment before using (Only linux and mac need to be installed. For the installation method, see the readme.md document in the software package).

(1) Parameter Configuration - Area 1.

  • Configuration Chip model (B92, B91, 8258, 8266).

  • Access the device's model (evk, usb).

  • Access storage type (flash, ram, analog).

  • Access start address.

  • Access to the number of bytes.

  • Configure the download file path.

(2) After setting parameters in area 1, access the device - Area 2.

  • Click the read and write key, read and write operations for storage space.

  • Click the Download button to download the bin file to flash or RAM.

  • Click the erase button to erase flash area, the starting address.

  • Click the Reset button to reset from flash or RAM.

  • Click the active button to wake up the development board.

(3) Debug - Area 3.

  • run:Run the program.

  • pause:Pause program.

  • step:Step through the program.

  • pc:View the current program running pointer.

  • var:View global variable values for the current program.

  • start:Start running program.

  • stall:Terminate the program.

Usage

Select the usb device

Click the Device menu bar to display the connected EVK devices. The EVK devices identified by this list (VID: 0x248A, PID: 0x8266) are shown in area 1 shown in the figure above. Note If the VID and PID values of the devices to be added are different, click Add Device.

The add-device list displays all usb devices scanned by the system. Add devices based on your requirements, as shown in area 2 in the figure above. Please note, please add correct need connection device, or the device may malfunction, you need to plug connection, to return to normal use.

sws

Set the single-line synchronization speed to ensure the normal connection between EVK device and development board. When the development board program is in low power mode, this function cannot be used normally, so it is necessary to wake up the development board first.

(1) Select the chip model.

(2) Configure SWS register address and clock value (default unchanged).

(3) Successful results of SWS.

reset

Reset the development board and select the launcher to run from Flash or SRAM.

(1) Reset, from flash to start, as shown in the figure below.

(2) Reset, from sram, as shown in the figure below.

Activate

Development board to run the program in a low power mode, wake up.

Read and write (Memory, flash).

(1) Read flash.

  • Read 16 bytes of data from address 0x0000 as shown in the figure below.

  • Read 1K bytes of data from address 0x0000. The read quantity greater than or equal to 1K will not be directly printed and stored in a file, as shown in the figure below.

(2) Read SRAM.

  • The operation of reading sRAM is similar to the above operation of reading Flash. Read 16 bytes of data from 0x40000 (8258 chip SRAM start address) as shown in the figure below.

(3) Write flash

  • Write four bytes of data at 0x0000, and configure the start address (the following figure - the area 2), the number of bytes written (the following figure - the area 3), and the content written ( (the following figure - the area 4), with Spaces between bytes).

  • Success - (the following figure - the area 6).

  • Failure - (the following figure - the area 7). Erase before writing, refer to Erase flash for details.

(4) Write sram

  • Write 2 bytes of data at 0x40001, as shown in the following figure. Below 4 area after the input data, need not press enter, or as a command execution.

Unlock Flash

Download

(1) Download the bin file to the flash, set the bin file path (the following figure - 2 area), and set the start address. If there is no response for a long time during the download, check whether the device is in low-power mode.

(2) Download the bin file to the sram, set the bin file path (the following figure - 2 area), and set the start address.

Erase flash

Erase the starting address 0 x0000, erase the byte 8 KB size (the following figure - 3 area, erasing the custom input), erase the smallest unit of 4 KB.

Debug

(1) pc: View the program running pointer

  • To view details about the PC value, open the. LST file for running the program (the following figure - 1 area) and select Use. LST file (the following figure - 2 area).

(2) View global variable values for the current program.

  • This function requires opening and using. LST files, as shown in the previous section.

(3) run

  • Continue the program after pause is used.

(4) pause

  • Pause the program.

(5) step

  • One step operation program.

(6) start

  • The program is restarted. The operation address 0x602 and value 0x88 are generally unchanged.

(7) stall

  • The program terminates. Operation address 0x602 and operation value 0x06 generally remain unchanged.

Program terminates

Cancel button. If there is no response for a long time, you can directly exit the current command.

Command line

In command line mode, enter the command and press Enter to execute the command. For details about the command usage format, see the bdt-cmd User guide.。

Device user-defined label

In the case of insert multiple devices to prevent equipment. The user defines the name of the connected device. Click to modify the label text, and press Enter.

Download mode

Tool -> mutilple downloads。This function is applicable to the device downloading multiple bin files, and multiple devices downloading files at the same time.

(1) add:Add download items and arrange them in sequence number (NO) .

(2) remove:Delete the specified download item, click the download item with the mouse, and then click Remove.

(3) file:Specify the download bin file path.

(4) download:Execute download command.

(5) clear:Delete all downloaded items.

(6) cancel:Cancel all downloading processes.

Use steps

(1) Click the Start Address bar, enter the start address, and press Enter to end

(2) Click File and select the bin file path. The file size is automatically resolved and the end address is calculated. Address range conflicts will be marked in red.

(3) Configure the device, as shown in the figure above - label 1. Click to enter the configuration interface, input the chip signal, enter to end

(5) As shown in the figure above, select the download device with label 1. Label 2, configure the chip model connected to the burning evk. Click Save configure.

(6) Click Download to download and wait for the result, as shown in the following figure. (Please ensure that all devices are properly connected before downloading)

Burning EVK firmware update

View the current firmware version and update Burning EVK firmware.

Do not remove or insert the device during the update. After the update, reinsert the device.

Step

  • Above - 1 area, select need to update the firmware of the device.

  • Above - 2 area, click can query the current firmware version.

  • Above - 3 area, click on the select the firmware file path.

  • Above - 4 area, click update to specify the firmware to the device.

Configure optional chip model and flash firmware path

Click to open config.ini file.

(1) In bdt_cmd area adds the chip model and the corresponding flash firmware path, and each item is separated by a space. (if the chip model in use is not configured). The chip model configured at this position will appear in the chip model optional box of the graphical interface.

(2) bdt_gui area is used to configure the starting address of ram and the set value of SWS register.

(3) bdt_version area is not modified.