Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug: use correct Spike DTM IDCODE in OpenOCD scripts #565

Merged

Conversation

TommyMurphyTM1234
Copy link
Contributor

@TommyMurphyTM1234 TommyMurphyTM1234 commented Jun 10, 2024

Addresses this issue:

Changed the IDCODE in the Spike target scripts from SiFive HiFive's 0x10e31913 to Spike's 0xdeadbeef.
This eliminates the distracting and avoidable warning/error messages resulting from the mismatch between the expected and actual IDCODEs.
The differences are highlighted using asterisks in the logs below.

Before change:

-------------------------[ /tmp/openocd12wdc0r4.log ]-------------------------
+ REMOTE_BITBANG_HOST=localhost REMOTE_BITBANG_PORT=45185 WORK_AREA=0x1212340000 USE_FREERTOS=0 openocd --command 'gdb_port 0' --command 'tcl_port 0' --command 'telnet_port disabled' -f targets/RISC-V/spike-1.cfg
Open On-Chip Debugger 0.12.0+dev-03808-g40cda81e8 (2024-06-06-14:13)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Initializing remote_bitbang driver
Info : Connecting to localhost:45185
Info : remote_bitbang driver initialized
Info : Note: The adapter "remote_bitbang" doesn't support configurable speed
*******************************************************************************************************************
Info : JTAG tap: riscv.cpu tap/device found: 0xdeadbeef (mfg: 0x777 (Fabric of Truth Inc), part: 0xeadb, ver: 0xd)
Warn : JTAG tap: riscv.cpu       UNEXPECTED: 0xdeadbeef (mfg: 0x777 (Fabric of Truth Inc), part: 0xeadb, ver: 0xd)
Error: JTAG tap: riscv.cpu  expected 1 of 1: 0x10e31913 (mfg: 0x489 (SiFive Inc), part: 0x0e31, ver: 0x1)
Error: Trying to use configured scan chain anyway...
Warn : Bypassing JTAG setup events due to errors
*******************************************************************************************************************
Error: Debugger is not authenticated to target Debug Module. (dmstatus=0x4c0c02). Use `riscv authdata_read` and `riscv authdata_write` commands to authenticate.
Error: [riscv.cpu] Examination failed
Warn : target riscv.cpu examination failed
Info : starting gdb server for riscv.cpu on 0
Info : Listening on port 39917 for gdb connections
Info : [riscv.cpu] authdata_write resulted in successful authentication
Info : [riscv.cpu] datacount=2 progbufsize=0
Warn : [riscv.cpu] We won't be able to execute fence instructions on this target. Memory may not always appear consistent. (progbufsize=0, impebreak=1)
Error: [riscv.cpu] Unable to insert program into progbuf, capacity would be exceeded (progbufsize=0).
Error: [riscv.cpu] Unable to insert program into progbuf, capacity would be exceeded (progbufsize=0).
Info : [riscv.cpu] Examined RISC-V core
Info : [riscv.cpu]  XLEN=64, misa=0x8000000000141125
[riscv.cpu] Target successfully examined.
Info : [riscv.cpu] Examination succeed
riscv.cpu halted due to debug-request.
semihosting is enabled
Info : Listening on port 44249 for tcl connections
Info : telnet server disabled
Info : accepting 'tcl' connection on tcp/0
Hello TCL-RPC!
Hello TCL-RPC!

Info : accepting 'gdb' connection on tcp/0
riscv.cpu halted due to debug-request. Semihosting is active.
Info : dropped 'gdb' connection
shutdown command invoked
Info : remote_bitbang interface quit

After change:

-------------------------[ /tmp/openocdunt3hlws.log ]-------------------------
+ REMOTE_BITBANG_HOST=localhost REMOTE_BITBANG_PORT=45839 WORK_AREA=0x1212340000 USE_FREERTOS=0 openocd --command 'gdb_port 0' --command 'tcl_port 0' --command 'telnet_port disabled' -f targets/RISC-V/spike-1.cfg
Open On-Chip Debugger 0.12.0+dev-03808-g40cda81e8 (2024-06-06-14:13)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "jtag". To override use 'transport select <transport>'.
Info : Initializing remote_bitbang driver
Info : Connecting to localhost:45839
Info : remote_bitbang driver initialized
Info : Note: The adapter "remote_bitbang" doesn't support configurable speed
*******************************************************************************************************************
Info : JTAG tap: riscv.cpu tap/device found: 0xdeadbeef (mfg: 0x777 (Fabric of Truth Inc), part: 0xeadb, ver: 0xd)
*******************************************************************************************************************
Error: Debugger is not authenticated to target Debug Module. (dmstatus=0x4c0c02). Use `riscv authdata_read` and `riscv authdata_write` commands to authenticate.
Error: [riscv.cpu] Examination failed
Warn : target riscv.cpu examination failed
Info : starting gdb server for riscv.cpu on 0
Info : Listening on port 33123 for gdb connections
Info : [riscv.cpu] authdata_write resulted in successful authentication
Info : [riscv.cpu] datacount=2 progbufsize=0
Warn : [riscv.cpu] We won't be able to execute fence instructions on this target. Memory may not always appear consistent. (progbufsize=0, impebreak=1)
Error: [riscv.cpu] Unable to insert program into progbuf, capacity would be exceeded (progbufsize=0).
Error: [riscv.cpu] Unable to insert program into progbuf, capacity would be exceeded (progbufsize=0).
Info : [riscv.cpu] Examined RISC-V core
Info : [riscv.cpu]  XLEN=64, misa=0x8000000000141125
[riscv.cpu] Target successfully examined.
Info : [riscv.cpu] Examination succeed
riscv.cpu halted due to debug-request.
semihosting is enabled
Info : Listening on port 42877 for tcl connections
Info : telnet server disabled
Info : accepting 'tcl' connection on tcp/0
Hello TCL-RPC!
Hello TCL-RPC!

Info : accepting 'gdb' connection on tcp/0
riscv.cpu halted due to debug-request. Semihosting is active.
Info : dropped 'gdb' connection
shutdown command invoked
Info : remote_bitbang interface quit

To validate this change I ran the Makefile driven "smoke tests" against Spike to ensure that there was no impact other than the elimination of the "expected IDCODE" related warnings/error log messages.

@TommyMurphyTM1234 TommyMurphyTM1234 changed the title Use correct IDCODE for Spike's DTM in OpenOCD scripts Debug: use correct Spike DTM IDCODE in OpenOCD scripts Jun 11, 2024
@TommyMurphyTM1234
Copy link
Contributor Author

I'm not sure who can/should review this to see if it can be merged?

Copy link
Collaborator

@aswaterman aswaterman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me.

@aswaterman aswaterman merged commit b0eb63a into riscv-software-src:master Jun 27, 2024
2 checks passed
@TommyMurphyTM1234 TommyMurphyTM1234 deleted the spike-idcode branch June 27, 2024 20:42
@TommyMurphyTM1234
Copy link
Contributor Author

Thanks @aswaterman. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants