riscv-openocd icon indicating copy to clipboard operation
riscv-openocd copied to clipboard

Loading programs with program buffer expects autoexec support (optional feature according to debug-spec 0.13)

Open sujay-pandit opened this issue 3 years ago • 4 comments

Simple fix in "write_memory_progbuf" in riscv-013.c A check can be added to confirm if the support exists (by writing then reading back 0x18) and then based on that setting variable "setup_needed" as False in the first if-condition in the for-loop can be removed.

sujay-pandit avatar Mar 27 '21 05:03 sujay-pandit

Hi Sujay,

Thank you for filing this ticket.

I can confirm this is a valid issue.

All bits in "abstractauto" DM registers are optional per the RISC-V Debug specification, and targets need not support it. However, the current OpenOCD code for both memory read and write via program buffer relies on the autoexecdata[0] bit - without checking if it is really supported.

Side note: Most targets appear to have autoexecdata[0] bit implemented, which is also recommended for performance reasons. That fact perhaps masked this issue in OpenOCD.

JanMatCodasip avatar Mar 27 '21 10:03 JanMatCodasip

Thanks Jan, yes I agree. We have added autoexec support now.

sujay-pandit avatar May 04 '21 09:05 sujay-pandit

I take it that this issue is still extant and awaiting a fix?

  • https://github.com/riscv/riscv-openocd/blob/a01bd76e5c10eba8bc3481eb7552fb8feab79f91/src/target/riscv/riscv-013.c#L3990

TommyMurphyTM1234 avatar Mar 26 '23 11:03 TommyMurphyTM1234

I take it that this issue is still extant and awaiting a fix?

Yes, it is still relevant. Though IMHO it's a low priority one, since most hardware does support autoexec AFAIK.

en-sc avatar Jan 22 '24 18:01 en-sc