OpenOCD fails to read peripheral memory via sysbus/progbuf/abstract when using PlatformIO SVD view

I’m working with a custom RISC-V 64-bit SoC.
The PlatformIO support for this SoC is still under development, and I am part of the team building that integration.

As part of testing, I created an SVD file for this SoC and configured PlatformIO to use it (debug_svd_path). When I start a debug session:

  • All peripherals appear in the debug view.
  • A temporary breakpoint is correctly set at main().
  • OpenOCD is running externally (started manually in another terminal).
  • PlatformIO is configured to connect using a custom debug tool.

However, whenever PlatformIO tries to update peripheral registers, OpenOCD reports memory read failures.

In the PlatformIO debug console, I see:

Internal error: Failed to update peripheral UART0 after memory reads

Whenever I try to step in or step out of the code in VS Code, OpenOCD fails with the same error.
In the OpenOCD log, I see:

Error: [riscv.cpu.0] Failed to read memory (addr=0x11300)
 progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabled

Environment

  • OpenOCD: official upstream build

  • OpenOCD launch command:

    openocd -f interface/jtag.cfg -f target/riscv.cfg
    
  • PlatformIO platformio.ini:

    [env:secure-iot]
    platform = mg
    board = secure-iot
    framework = Apps
    monitor_speed = 115200
    monitor_port = /dev/ttyUSB1
    debug_svd_path = path/to/Secure_IoT.svd
    upload_protocol = ft2232
    debug_speed = 1000
    debug_tool = custom
    debug_port = localhost:3333
    
    debug_build_flags = -O0 -ggdb3 -g3
    build_type = debug
    
    ; Override GDB init sequence
    debug_extra_cmds =
        monitor halt
    

Logs

From OpenOCD:

Warn : [riscv.cpu.0] Failed to read memory via system bus.
Error: [riscv.cpu.0] Failed to read memory (addr=0x60100)
  progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabled
Error: [riscv.cpu.0] Failed to read memory (addr=0x20100)
  progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabled
Error: [riscv.cpu.0] Failed to read memory (addr=0x11300)
  progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabled
(repeats for multiple addresses)

From PlatformIO:

PlatformIO: Initialization completed
Internal error: Failed to update peripheral OTP after memory reads
Internal error: Failed to update peripheral UART0 after memory reads
PlatformIO: Resume the execution to `debug_init_break = tbreak main`

Important Observation

Manual memory reads in GDB do succeed, for example:

(gdb) x/x 0x11300
0x11300:  0x017c017c

So the hardware can return values from memory, but OpenOCD reports that progbuf, sysbus, and abstract access are all disabled/skipped when peripheral polling is triggered from PlatformIO.


Hardware

  • SoC: Custom RISC-V 64-bit
  • Debug module: supports progbuf, sba, and abstract (expected to be available)

Steps to Reproduce

  1. Start OpenOCD with:

    openocd -f interface/jtag.cfg -f target/riscv.cfg
    
  2. Launch a debug session in PlatformIO with the platformio.ini shown above.

  3. Observe that peripherals are listed, but peripheral register updates fail.

  4. Compare with manual GDB access (x/x <addr>) which works.


Question