pulp-platform / riscv-dbg

RISC-V Debug Support for our PULP RISC-V Cores
Other
197 stars 70 forks source link

Fix remote_bitbang r/s/t/u-reset command implementations. #133

Closed epsilon537 closed 1 year ago

epsilon537 commented 1 year ago

During bring-up of riscv-dbg on my Verilator testbench I found that TRST was asserted after running the dm_debug.cfg openocd script. A bit of investigation showed that TRST got asserted by the r-reset implementation in remote_bitbang.c. According to the remote bitbang spec, r-reset should deassert TRST:

reset trst srst Set the value of trst, srst.

r - Reset 0 0

Similarly, s-reset should also deassert TRST, while t- and u-reset should assert TRST:

s - Reset 0 1 t - Reset 1 0 u - Reset 1 1

As an aside, it's bad form to define globals in .h files. Declarations should go in the .h file, definition in the .C file. That change is also included in the pull request. Sorry for not splitting this into two commits.