# Burning and Debugging Tools for TLSR9 Series in Linux

## Introduction

This memo explains how to program the B91 EVK with the SPI Burn tool and TLSR9 DEV KEY (Telink debug probe) in Linux. It is assumed that you already know how to connect the TLSR9 DEV KEY to the B91 EVK.

## Environment Setup

### GCC toolchain

Run the following commands one by one below to install all the required libraries.

NOTE: It is assumed that the Linux machine is running a 64-bit Ubuntu 18.04/20.04 LTS. If other Linux distributions are used, you might have to change the commands below accordingly.

sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install libc6:i386 libncurses5:i386 libstdc++6:i386


### Example code

Extract the content of the gdb_example.zip file into a folder named example, which in the example below is assumed to be located in your ‘home’ folder.

## Flash Programming

1. Make sure the TLSR9 DEV KEY is connected to the B91 EVK correctly and the EVK is already powered.

1. Launch a shell.

2. Navigate to the ice folder in which the ICEman tool is located (e.g. /opt/toolchain/telink_riscv_linux_toolchain/ice).

3. Run the following command.

   sudo ./ICEman -Z v5


1. Launch another shell and navigate to the flash folder in which the SPI Burn tool is located (e.g. /opt/toolchain/telink_riscv_linux_toolchain/flash).

2. Type the following command.

   sudo ./SPI_burn -i "\$HOME/example/main.bin" -v


NOTE: the -i option specifies the binary file that will be programmed into the TLSR9518 EVK and the -v option enables verification after flashing.