PlatformIO Community

PIO debugger won't work in VSCode

I have a problem starting the debugger. I am running VSCode with PIO, both updated.
I am trying to debug code for RISC-V board HiFIve 1 rev b
this is the errors i get

Connecting to J-Link...

Reading symbols from c:\Users\ialek\Documents\PlatformIO\Projects\superBlink\.pio\build\hifive1-revb\firmware.elf...
undefinedC:\Users\ialek\.platformio\packages\toolchain-riscv\bin\riscv64-unknown-elf-gdb.exe: warning: Couldn't determine a path for the index cache directory.

PlatformIO Unified Debugger ->
PlatformIO: debug_tool = jlink
PlatformIO: Initializing remote target...
.pioinit:14: Error in sourced command file:
:2331: No connection could be made because the target machine actively refused it.
1 Like

So how exactly did you connect the debugger to the target board?

I have to connect the debugger to the board?
This is my first time working on a board so i dont know. I was just following a tutorial online and he ran debugger without connecting the board. I obviously tried connecting it.

Oh actually the debugger is supposed to be on-board. So, I currently don’t know why that is. Maybe someone with the hardware (HiFive1 Rev B) can help here to test it (@valeros, @ivankravets)?

1 Like

Could you navigate to C:\Users\ialek\.platformio\packages\tool-jlink\Drivers and install Windows drivers for J-Link?

JLink installed, but the debugger still won’t work. At the end the board disconnects from computer and connects back in. Sorry for the problems, learning this the first time so not quiet sure what I am doing wrong. This is all running on Windows by the way.
I am following this tutorial

ERROR: Can not read register 4096 (X0) while CPU is running
ERROR: Can not read register 4096 (X0) while CPU is running
indent preformatted text by 4 spaces
received signal SIGTRAP, Trace/breakpoint trap.
0xdeadbeef in ?? ()
WARNING: CPU could not be halted
ERROR: Communication timed out: Requested 4 bytes, received 0 bytes !
Could not start CPU core. (ErrorCode: -1)
WARNING: Target connection lost.

What is your platformio.ini?