When connecting to a RISC-V board with 5 cores (on two JTAG chains), how do we select which HART will be accessed? Someone has a configuration file which supposedly selects HART 3, but the "mhartid" register shows 0 when using that config. The other CSR register values do not look correct either.
OpenOCD, on the other hand, sees all 5 cores and creates targets for each. Each target reports the proper "mhartid", and the "misa" registers look correct.
As OpenOCD can see the correct values, it would appear that JLink is connected properly and the device is working. So what might be wrong with the JLink config? Can someone please give troubleshooting advice?
Here is JLink's output.
Display All
CSR 0xF14 is "mhartid".
For reference, here is OpenOCD's output. All is not well here, but it is much better.
Display All
OpenOCD, on the other hand, sees all 5 cores and creates targets for each. Each target reports the proper "mhartid", and the "misa" registers look correct.
As OpenOCD can see the correct values, it would appear that JLink is connected properly and the device is working. So what might be wrong with the JLink config? Can someone please give troubleshooting advice?
Here is JLink's output.
Source Code
- License(s): FlashBP, GDB
- USB speed mode: Full speed (12 MBit/s)
- VTref=3.299V
- Device "U74-MC" selected.
- Connecting to target via JTAG
- ConfigTargetSettings() start
- ConfigTargetSettings() end - Took 5us
- InitTarget() start
- InitTarget() end - Took 3us
- TotalIRLen = 10, IRPrint = 0x0021
- JTAG chain detection found 2 devices:
- #0 Id: 0x07110CFD, IRLen: 05, Unknown device
- #1 Id: 0x07110CFD, IRLen: 05, Unknown device
- Debug architecture:
- RISC-V debug: 0.13
- AddrBits: 7
- DataBits: 32
- IdleClks: 5
- Memory access:
- Via system bus: Yes (8/16/32/64-bit accesses are supported)
- Via ProgBuf: Yes (16 ProgBuf entries)
- Via abstract command (AAM): May be tried as last resort
- DataBuf: 2 entries
- autoexec[0] implemented: Yes
- Detected: RV64 core
- Temp. halting CPU for for feature detection...
- HW instruction/data BPs: 8
- Support set/clr BPs while running: No
- HW data BPs trigger before execution of inst
- CSR access via abs. commands: No
- Feature detection done. Restarting core...
- BG memory access support: Via SBA
- SetupTarget() start
- ********************************
- Pre-selection info
- dmcontrol value is: 0x00000001
- Current hart id is: 0x00000000
- ********************************
- ********************************
- Post-selection info
- dmcontrol value is: 0x00010001
- Current hart id is: 0x00000001
- ********************************
- SetupTarget() end - Took 1.66ms
- Memory zones:
- Zone: "Default" Description: Default access mode
- RISC-V identified.
- J-Link>halt
- pc = 0000000040004C58 sp = 0000000040047EF0 ra = 0000000040009FBC
- gp = 0000000000000000 tp = 0000000040048000 fp = 0000000040047F00
- t0 = 0000000000000000 t1 = 0000000000000000 t2 = 0000000000000000
- t3 = 0000000000000000 t4 = 0000000000000000 t5 = 0000000000000000 t6 = 0000000000000000
- a0 = 0000000000000001 a1 = 0000000000000000 a2 = 0000000000000000 a3 = 0000000000060005
- a4 = 0000000000000000 a5 = 0000000000000808 a6 = 0000000000000000 a7 = 0000000000000000
- s1 = 0000000040048060 s2 = 0000000000000002 s3 = 0000000000000000 s4 = 0000000000000000
- s5 = 0000000040029000 s6 = 0000000040029020 s7 = 0000000000000000 s8 = 000000000000001C
- s9 = 0000000040035AB0 s10 = 0000000000000000 s11 = 0000000000000000
- J-Link>readcsr 0xF14
- CSR 0x0F14: 0x00000000
- J-Link>
For reference, here is OpenOCD's output. All is not well here, but it is much better.
Source Code
- Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
- Info : J-Link EDU Mini V1 compiled Jun 6 2023 10:50:57
- Info : Hardware version: 1.00
- Info : VTarget = 3.299 V
- Info : clock speed 4000 kHz
- Info : JTAG tap: e24.cpu tap/device found: 0x07110cfd (mfg: 0x67e (Guangdong StarFive Technology Co), part: 0x7110, ver: 0x0)
- Info : JTAG tap: u74.cpu tap/device found: 0x07110cfd (mfg: 0x67e (Guangdong StarFive Technology Co), part: 0x7110, ver: 0x0)
- Info : datacount=2 progbufsize=16
- Info : Disabling abstract command reads from CSRs.
- Info : Core 0 made part of halt group 1.
- Info : Examined RISC-V core; found 5 harts
- Info : hart 0: XLEN=64, misa=0x8000000000901107
- Info : datacount=2 progbufsize=16
- Info : Disabling abstract command reads from CSRs.
- Info : Core 1 made part of halt group 1.
- Info : Examined RISC-V core; found 5 harts
- Info : hart 1: XLEN=64, misa=0x800000000094112f
- Info : datacount=2 progbufsize=16
- Info : Disabling abstract command reads from CSRs.
- Info : Examined RISC-V core; found 5 harts
- Info : hart 2: XLEN=64, misa=0x800000000094112f
- Info : datacount=2 progbufsize=16
- Info : Disabling abstract command reads from CSRs.
- Info : Core 3 made part of halt group 1.
- Info : Examined RISC-V core; found 5 harts
- Info : hart 3: XLEN=64, misa=0x800000000094112f
- Info : datacount=2 progbufsize=16
- Info : Disabling abstract command reads from CSRs.
- Info : Examined RISC-V core; found 5 harts
- Info : hart 4: XLEN=64, misa=0x800000000094112f
- Info : starting gdb server for u74.cpu0 on 3333
- Info : Listening on port 3333 for gdb connections
- Info : starting gdb server for u74.cpu2 on 3334
- Info : Listening on port 3334 for gdb connections
- Info : starting gdb server for u74.cpu4 on 3335
- Info : Listening on port 3335 for gdb connections
- Info : Listening on port 6666 for tcl connections
- Info : Listening on port 4444 for telnet connections