riscv-collab / riscv-openocd

Fork of OpenOCD that has RISC-V support
Other
453 stars 328 forks source link

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

Open sujay-pandit opened 3 years ago

sujay-pandit commented 3 years ago

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.

JanMatCodasip commented 3 years ago

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.

sujay-pandit commented 3 years ago

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

TommyMurphyTM1234 commented 1 year ago

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

en-sc commented 10 months ago

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.