Using openocd / gdb / jtag with BPI-f3


The schematics show which pins are used for jtag. Has anyone used this for openocd / gdb debugging?

What device did you use for the jtag hardware connection? A JLinkEdu?

Does anyone have a config file that shows how to connect to the Spacemit cpu?

Thanks for any help

I connected a JLink Edu to the jtag pins on the board. I could not figure out where to connect the JLink “nTRST” or “RESET” pin to the board. I did connect the JLink Edu to the board using the following pins:

gpio pin signal

==== === ======

1 vcc 6 gnd

gpio_70 7 tdi

gpio_71 11 tms

gpio_72 13 tck

gpio_73 15 tdo

I created an openocd configuration file called “spacemit.tcl” that has the following lines:

adapter driver jlink

reset_config trst_only

transport select jtag

adapter speed 4000

jtag newtap k1x cpu -irlen 5

target create k1x.cpu0 riscv -chain-position k1x.cpu -coreid 0

init <<

When I used the file with openocd I got the following error message:

Info : J-Link V11 compiled Mar 14 2024 13:16:08 Info : Hardware version: 11.00 Info : VTarget = 3.283 V Info : clock speed 4000 kHz Info : JTAG tap: k1x.cpu tap/device found: 0x08501c0d (mfg: 0x606 (Shenzhen Chixingzhe Technology Co Ltd), part: 0x8501, ver: 0x0) Error: IR capture error at bit 5, saw 0x01 not 0x…3 Warn : Bypassing JTAG setup events due to errors Error: dtmcontrol is 0. Check JTAG connectivity/board power. Warn : target k1x.cpu0 examination failed Info : starting gdb server for k1x.cpu0 on 3333 <<

Do you have an openocd configuration file that works with the board?

Index of /tools/openocd/ (

openocd configuration file:


Thanks for your help. I tried using the openocd configuration file with my jlink edu attached to the board:

I got a lot of error messages like:

Error: unable to halt hart 2 Error: dmcontrol=0x00020001 Error: dmstatus =0x004030a2 Error: Fatal: Hart 2 failed to halt during examine() Warn : target riscv.cpu.2 examination failed Info : datacount=2 progbufsize=2

Error: unable to halt hart 3 Error: dmcontrol=0x00030001 Error: dmstatus =0x004030a2 Error: Fatal: Hart 3 failed to halt during examine() Warn : target riscv.cpu.7 examination failed Info : starting gdb server for riscv.cpu.0 on 1024 Info : Listening on port 1024 for gdb connections Error: Hart 1 is unavailable. Error: Hart 2 is unavailable. Error: Hart 3 is unavailable.

Maybe this is because I did not know where to connect the jlink ntrst pin or the RESET pin?

Thanks for any help

Have you burned the image to board? I got the same issue before when I didn’t burn any image. Then I burned the nas image to emmc, and problem solved.

I burned debian to a tf card and booted the board with it. Debugging via jtag works now.

Why does this make debugging work? Does uboot make jtag work by setting up the pins?