This is not really a bug, I don't think, but I can't run the tests with the environment described below.
I have a RISC-V cross toolchain (custom-built) and openocd installed. My environment is:
emerald:aram$
emerald:aram$ riscv64-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv64-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/Users/aram/xgcc/libexec/gcc/riscv64-unknown-elf/9.2.0/lto-wrapper
Target: riscv64-unknown-elf
Configured with: ../../src/gcc-9.2.0/configure --prefix /Users/aram/xgcc --bindir /Users/aram/bin --target riscv64-unknown-elf --enable-multilib --enable-languages=c --with-gnu-as --with-gnu-ld --with-newlib
Thread model: single
gcc version 9.2.0 (GCC)
emerald:aram$
emerald:aram$ python -V
Python 2.7.16
emerald:aram$
emerald:aram$ which riscv64-unknown-elf-gcc
/Users/aram/bin/riscv64-unknown-elf-gcc
emerald:aram$ which riscv64-unknown-elf-gdb
/Users/aram/bin/riscv64-unknown-elf-gdb
emerald:aram$
emerald:aram$ which openocd
/usr/local/bin/openocd
emerald:aram$
emerald:aram$ which python
/usr/bin/python
emerald:aram$
emerald:aram$ uname -a
Darwin emerald.local 18.7.0 Darwin Kernel Version 18.7.0: Sat Oct 12 00:02:19 PDT 2019; root:xnu-4903.278.12~1/RELEASE_X86_64 x86_64
emerald:aram$
The tests compile fine, but when I run make debug-check I get errors such as these:
Test: CustomRegisterTest
Target: spike64
---------------------------------[ Compile ]----------------------------------
+ riscv64-unknown-elf-gcc -g programs/checksum.c programs/tiny-malloc.c programs/infinite_loop.S -DDEFINE_MALLOC -DDEFINE_FREE programs/entry.S programs/init.c -DNHARTS=1 -I ../env -T targets/RISC-V/spike64.lds -nostartfiles -mcmodel=medany -DXLEN=64 -o /var/folders/y0/y5fwvgfs6pvb7l8vt2xvjc7m0000gn/T/spike64_checksum-64_4tWBHX -march=rv64ima -mabi=lp64
----[ /var/folders/y0/y5fwvgfs6pvb7l8vt2xvjc7m0000gn/T/openocduVRYMs.log ]----
+ REMOTE_BITBANG_HOST=localhost REMOTE_BITBANG_PORT=59882 WORK_AREA=0x1212340000 /usr/local/bin/openocd --command 'gdb_port 0' --command 'tcl_port disabled' --command 'telnet_port disabled' -f targets/RISC-V/spike-1.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
adapter speed: 10000 kHz
Warn : Adapter driver 'remote_bitbang' did not declare which transports it allows; assuming legacy JTAG-only
Info : only one transport option; autoselect 'jtag'
embedded:startup.tcl:21: Error: Unknown target type riscv, try one of arm7tdmi, arm9tdmi, arm920t, arm720t, arm966e, arm946e, arm926ejs, fa526, feroceon, dragonite, xscale, cortex_m, cortex_a, cortex_r4, arm11, ls1_sap, mips_m4k, avr, dsp563xx, dsp5680xx, testee, avr32_ap7k, hla_target, nds32_v2, nds32_v3, nds32_v3m, or1k, quark_x10xx, or quark_d20xx
in procedure 'script'
at file "embedded:startup.tcl", line 60
in procedure 'target' called at file "targets/RISC-V/spike-1.cfg", line 11
in procedure 'ocd_bouncer'
at file "embedded:startup.tcl", line 21
----[ /var/folders/y0/y5fwvgfs6pvb7l8vt2xvjc7m0000gn/T/spike-yVxSGr.log ]-----
+ /usr/local/bin/spike -p1 --isa RV64IMAFC --dm-auth --dm-progsize 0 --dm-sba 32 --dm-abstract-rti 30 -m0x1212340000:0x10000000 --rbb-port 0 /var/folders/y0/y5fwvgfs6pvb7l8vt2xvjc7m0000gn/T/spike64_checksum-64_4tWBHX
Listening for remote bitbang connection on port 59882.
warning: tohost and fromhost symbols not in ELF; can't communicate with target
--------------------------------[ Traceback ]---------------------------------
Traceback (most recent call last):
File "/Users/aram/riscv-tests/debug/testlib.py", line 885, in run
self.classSetup()
File "/Users/aram/riscv-tests/debug/testlib.py", line 930, in classSetup
BaseTest.classSetup(self)
File "/Users/aram/riscv-tests/debug/testlib.py", line 853, in classSetup
self.server = self.target.server()
File "/Users/aram/riscv-tests/debug/targets.py", line 126, in server
timeout=self.server_timeout_sec)
File "/Users/aram/riscv-tests/debug/testlib.py", line 277, in __init__
self.process = self.start(cmd, logfile)
File "/Users/aram/riscv-tests/debug/testlib.py", line 295, in start
raise Exception("OpenOCD exited early.")
Exception: OpenOCD exited early.
----[ /var/folders/y0/y5fwvgfs6pvb7l8vt2xvjc7m0000gn/T/spike-yVxSGr.log ]-----
+ /usr/local/bin/spike -p1 --isa RV64IMAFC --dm-auth --dm-progsize 0 --dm-sba 32 --dm-abstract-rti 30 -m0x1212340000:0x10000000 --rbb-port 0 /var/folders/y0/y5fwvgfs6pvb7l8vt2xvjc7m0000gn/T/spike64_checksum-64_4tWBHX
Listening for remote bitbang connection on port 59882.
warning: tohost and fromhost symbols not in ELF; can't communicate with target
-------------------------------[ End of logs ]--------------------------------
Result: exception
Logfile: logs/20191112-165130-spike64-CustomRegisterTest.log
Reproduce: /Users/aram/riscv-tests/debug/gdbserver.py /Users/aram/riscv-tests/debug/targets/RISC-V/spike64.py CustomRegisterTest
Time elapsed: 0.31s
No doubt this is my fault, since I have built my own toolchain (in some prefix), and I am using openocd from homebrew (installed in another prefix). However, not sure what to do next. Probably I don't set RISCV properly. I have set it to /usr/local, since the makefile is trying to run $RISCV/bin/openocd and my openocd is in /usr/local/bin/openocd, but perhaps that is not right.
Ok, the problem was the the openocd shipped by homebrew didn't have RISC-V support, and riscv/homebrew-riscv doesn't install a proper openocd. I manually built riscv/riscv-openocd and I can run tests now.
This is not really a bug, I don't think, but I can't run the tests with the environment described below.
I have a RISC-V cross toolchain (custom-built) and openocd installed. My environment is:
The tests compile fine, but when I run
make debug-check
I get errors such as these:No doubt this is my fault, since I have built my own toolchain (in some prefix), and I am using openocd from homebrew (installed in another prefix). However, not sure what to do next. Probably I don't set
RISCV
properly. I have set it to/usr/local
, since the makefile is trying to run$RISCV/bin/openocd
and my openocd is in/usr/local/bin/openocd
, but perhaps that is not right.