Building Spike simulator for RISC-V

Hi,

I am trying to build toolchain for RISC-V Spike simulator. I use the repository https://github.com/riscv/riscv-tools. Here while building openocd, i get following error

: not founder/bin2char.sh: 2: …/src/helper/bin2char.sh:
: not founder/bin2char.sh: 5: …/src/helper/bin2char.sh: echo
make: *** [src/startup_tcl.inc] Error 1

Is the file src/startup_tcl.h created ?. Build.log has following output error

cat …/src/helper/startup.tcl …/src/jtag/startup.tcl …/src/target/startup.tcl …/src/server/startup.tcl …/src/flash/startup.tcl | …/src/helper/bin2char.sh > src/startup_tcl.inc || { rm -f src/startup_tcl.inc; false; }
Makefile:4659: recipe for target ‘src/startup_tcl.inc’ failed

Any idea what is the error here ?

The error message looks corrupted, so not clear what happened. Try debugging this. Do the …/src/* files all exist? What happens if you run the …/src/helper/bin2char.sh script by hand? It looks like it could be a problem with /bin/sh which is odd. What system are you building on? Linux? mingw?

Hi Ji

I could resolve this error. There was a line ending conversion needed for bin2char.sh shell script. But now while building ISA, i am getting following error in the file riscv/dts.cc in the function
string dts_compile(const string&). The error is

…/riscv/dts.cc: In function ‘std::__cxx11::string dts_compile(const string&)’:
…/riscv/dts.cc:133:12: error: ‘DTC’ was not declared in this scope
execlp(DTC, DTC, “-O”, “dtb”, 0);
^~~
…/riscv/dts.cc:134:35: error: expected ‘;’ before ‘DTC’
std::cerr << "Failed to run " DTC ": " << strerror(errno) << std::endl;

I have installed device-tree -compiler already, the version is 1.4.5-3. Basically i have entered some error condition i guess ? what is this DTC here ? is this some kind of macro?

I have attached the snapshot of build log of ISA simulator, and also the my ubuntu terminal snapshot (to know current status).

Can u please help me here ?

DTC is set by the configure script to the full pathname for the device tree compiler. This definition goes into config.h in the build tree. I have
/* Path to the device-tree-compiler */
#define DTC “/usr/bin/dtc”

The configure script will give an error if the device tree compiler is not found at configure time. The build script is simple and stupid though, and doesn’t check for configure errors, so it will go ahead and run make even though it won’t work.

If you installed the device tree compiler after running configure, then you will need to configure again, or rm -rf the build tree and rebuild from scratch.