pulp-platform / riscv-dbg

RISC-V Debug Support for our PULP RISC-V Cores
Other
219 stars 72 forks source link

return CmdErrBusy if accessing data or progbuf while command was executing #79

Closed noytzach closed 3 years ago

noytzach commented 4 years ago

According to Debug spec (3.12.6):

(cmderr=1 is returned when) An abstract command was executing while command, abstractcs, or abstractautowas written, or when one of the data or progbufregisters was read or written.

Current implementation only blocks writes and autoexec while busy, but does not set cmderr=1 (CmdErrBusy)

Silabs-ArjanB commented 3 years ago

Hi @noytzach Thank you for your proposed fix. I see that the RISC-V Debug spec 3.12.6 states one extra requirement that is missing from the quote at the very top of this pull request:

An abstract command was executing while command, abstractcs, or abstractauto was written, or when one of the data or progbuf registers was read or written. This status is only written if cmderr contains 0.

If you agree, could you please extend your fix a little by replacing the occurences of the following lines that you added:

cmderr_d = dm::CmdErrBusy;

by:

if (cmderr_q == dm::CmdErrNone) begin
 cmderr_d = dm::CmdErrBusy;
end
noytzach commented 3 years ago

Hi @Silabs-ArjanB I agree. Fixed on 0a54bd7

Silabs-ArjanB commented 3 years ago

Hi @Silabs-ArjanB I agree. Fixed on 0a54bd7

Hi @noytzach Thank you; looks good to me now.

bluewww commented 3 years ago

Looks reasonable to me