-
Notifications
You must be signed in to change notification settings - Fork 365
Description
I’m working with a custom RISC-V 64-bit SoC (derived from the Shakti processor family).
The PlatformIO support for this SoC is still under development, and I am part of the team building that integration.
When debugging through OpenOCD + PlatformIO:
- Peripherals from the SVD file appear in the debug view.
- A temporary breakpoint is set at
main()as expected. - OpenOCD is started externally in another terminal.
- PlatformIO connects to OpenOCD using a custom debug tool.
But OpenOCD repeatedly reports memory read failures.
Symptoms
1. Peripheral polling fails
Immediately after the breakpoint at main() is set, PlatformIO tries to refresh peripheral registers and fails:
PlatformIO debug console:
Internal error: Failed to update peripheral UART0 after memory reads
OpenOCD log:
Error: [riscv.cpu.0] Failed to read memory (addr=0x80006568)
progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabled
2. Stepping also fails
Whenever I try to step in or step out of the code in VS Code, OpenOCD reports the same type of error:
Error: [riscv.cpu.0] Failed to read memory (addr=0x11300)
progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabledSo the issue affects both SVD-based peripheral updates and standard debug flow (stepping) whenever the SVD file is given as input.
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=0x80006568)
progbuf=disabled, sysbus=skipped (sysbus access failed), abstract=disabled
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 are all disabled/skipped when memory accesses are triggered automatically (peripheral polling, stepping).
Hardware
- Custom RISC-V 64-bit SoC (derived from Shakti)
- Debug module is expected to support
progbuf,sba, andabstract
Steps to Reproduce
- Start OpenOCD with:
openocd -f interface/jtag.cfg -f target/riscv.cfg
- Launch a debug session in PlatformIO with the
platformio.inishown above. - Observe that:
- Peripherals are listed, but register updates fail immediately after hitting the initial breakpoint at
main(). - Stepping in/out also fails with the same error.
- Peripherals are listed, but register updates fail immediately after hitting the initial breakpoint at
- Compare with manual GDB access (
x/x <addr>), which works.
Question
- Is this an OpenOCD limitation with the debug module, or a configuration issue on my side?
- Why do manual GDB memory reads succeed, but OpenOCD reports all access paths (
progbuf,sysbus,abstract) as disabled/skipped during automated operations?
