(RV64) K210 (Sipeed Maix Bit)

連接OpenOCD + GDB(SiPEED USB-JTAG/TTL)


連接TDI、TDO、TMS、TCK、RXD、TXD、RST、GND,最後記得連接USB Type-C提供電源:


k210.cfg

# debug adapter
source [find ft2232c.cfg]

transport select jtag
adapter_khz 10000

# server port
gdb_port 3333
telnet_port 4444

# add cpu target
set _CHIPNAME riscv

jtag newtap $_CHIPNAME cpu -irlen 5 -expected-id 0x04e4796b

set _TARGETNAME $_CHIPNAME.cpu
target create $_TARGETNAME riscv -chain-position $_TARGETNAME

# command
init
halt

ft2232c.cfg

interface ftdi
ftdi_vid_pid 0x0403 0x6010

ftdi_layout_init 0xfff8 0xfffb
ftdi_layout_signal nTRST -data 0x0100 -oe 0x0100
ftdi_layout_signal nSRST -data 0x0200 -oe 0x0200

連接步驟:

$ cd 
$ wget https://s3.cn-north-1.amazonaws.com.cn/dl.kendryte.com/documents/kendryte-openocd-0.1.3-ubuntu64.tar.gz
$ tar xvf kendryte-openocd-0.1.3-ubuntu64.tar.gz
$ ./kendryte-openocd/bin/openocd -f k210.cfg 
  Kendryte Open On-Chip Debugger For RISC-V v0.1.3 (20180912)
  Licensed under GNU GPL v2
  adapter speed: 10000 kHz
  Info : ftdi: if you experience problems at higher adapter clocks, try the command "ftdi_tdo_sample_edge falling"
  Info : clock speed 10000 kHz
  Info : JTAG tap: riscv.cpu tap/device found: 0x04e4796b (mfg: 0x4b5 (), part: 0x4e47, ver: 0x0)
  Info : [0] Found 4 triggers
  Info : [1] Found 4 triggers
  [1] halted at 0x800005ec due to debug interrupt
  Info : Examined RISCV core; found 2 harts, XLEN=64, misa=0x800000000014112d
  Info : Listening on port 3333 for gdb connections
  [1] halted at 0x800005ec due to debug interrupt
  [0] halted at 0x800b3840 due to debug interrupt
  Info : Listening on port 6666 for tcl connections
  Info : Listening on port 4444 for telnet connections

開啟另一個Terminal並且輸入如下命令:

$ /opt/k210/bin/riscv64-unknown-elf-gdb -ex "set remotetimeout 240" -ex "target extended-remote localhost:3333" -ex "monitor reset halt"  -ex "load" hello_world
  GNU gdb (GDB) 8.2
  Copyright (C) 2018 Free Software Foundation, Inc.
  License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
  This is free software: you are free to change and redistribute it.
  There is NO WARRANTY, to the extent permitted by law.
  Type "show copying" and "show warranty" for details.
  This GDB was configured as "--host=x86_64-pc-linux-gnu --target=riscv64-unknown-elf".
  Type "show configuration" for configuration details.
  For bug reporting instructions, please see:
  <http://www.gnu.org/software/gdb/bugs/>.
  Find the GDB manual and other documentation resources online at:
      <http://www.gnu.org/software/gdb/documentation/>.

  For help, type "help".
  Type "apropos word" to search for commands related to "word"...
  Reading symbols from hello_world...done.
  Remote debugging using localhost:3333
  warning: Target-supplied registers are not supported by the current architecture
  spinlock_trylock (lock=0x80016cd8 <lock>) at /home/steward/Downloads/kendryte-standalone-sdk-0.5.6/lib/bsp/include/atomic.h:85
  85      while (spinlock_trylock(lock));
  JTAG tap: riscv.cpu tap/device found: 0x04e4796b (mfg: 0x4b5 (<unknown>), part: 0x4e47, ver: 0x0)
  [0] halted at 0x8000df3a due to debug interrupt
  Loading section .text, size 0x13600 lma 0x80000000
  Loading section .rodata, size 0x2570 lma 0x80013600
  Loading section .sdata2._global_impure_ptr, size 0x8 lma 0x80015b70
  Loading section .sdata2.clint, size 0x8 lma 0x80015b78
  Loading section .sdata2.get_select_pll2, size 0x3 lma 0x80015b80
  Loading section .sdata2.get_source_pll2, size 0x3 lma 0x80015b88
  Loading section .sdata2.CSWTCH.14, size 0x3 lma 0x80015b90
  Loading section .init_array, size 0x8 lma 0x80015b98
  Loading section .fini_array, size 0x8 lma 0x80015ba0
  Loading section .data, size 0x1198 lma 0x80015ba8
  Start address 0x80000000, load size 93489
  Transfer rate: 115 KB/sec, 6677 bytes/write.
  (gdb)


返回上一頁