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

Unable to run simulator for Hello World demo due to missing files and makefile error #90

Closed
Aaronyap2002 opened this issue Jan 30, 2024 · 6 comments

Comments

@Aaronyap2002
Copy link

Aaronyap2002 commented Jan 30, 2024

hi everyone. As I was following the instructions to run the simulator, when I tried to run the command ./build/lowrisc_ibex_demo_system_0/simverilator/Vibex_demo_system \ --meminit=ram,./sw/c/build/demo/hello_world/demo, it produced the following errors, and I don't know how to fix the issues. My verilator version is 4.210.

ERROR: In file included from ../src/lowrisc_ibex_demo_system_0/dv/verilator/ibex_demo_system.cc:9:
./Vibex_demo_system__Syms.h:10:10: fatal error: verilated_heavy.h: No such file or directory
   10 | #include "verilated_heavy.h"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Vibex_demo_system.mk:120: ibex_demo_system.o] Error 1
make[1]: *** Waiting for unfinished jobs....
In file included from ../src/lowrisc_dv_verilator_simutil_verilator_0/cpp/verilated_toplevel.h:21,
                 from ../src/lowrisc_ibex_demo_system_0/dv/verilator/ibex_demo_system.h:5,
                 from ../src/lowrisc_ibex_demo_system_0/dv/verilator/ibex_demo_system_main.cc:5:
./Vibex_demo_system.h:11:10: fatal error: verilated_heavy.h: No such file or directory
   11 | #include "verilated_heavy.h"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Vibex_demo_system.mk:122: ibex_demo_system_main.o] Error 1
In file included from ../src/lowrisc_dv_verilator_simutil_verilator_0/cpp/verilated_toplevel.h:21,
                 from ../src/lowrisc_dv_verilator_simutil_verilator_0/cpp/verilated_toplevel.cc:5:
./Vibex_demo_system.h:11:10: fatal error: verilated_heavy.h: No such file or directory
   11 | #include "verilated_heavy.h"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Vibex_demo_system.mk:116: verilated_toplevel.o] Error 1
In file included from ../src/lowrisc_dv_verilator_simutil_verilator_0/cpp/verilated_toplevel.h:21,
                 from ../src/lowrisc_dv_verilator_simutil_verilator_0/cpp/verilator_sim_ctrl.h:13,
                 from ../src/lowrisc_dv_verilator_simutil_verilator_0/cpp/verilator_sim_ctrl.cc:5:
./Vibex_demo_system.h:11:10: fatal error: verilated_heavy.h: No such file or directory
   11 | #include "verilated_heavy.h"
      |          ^~~~~~~~~~~~~~~~~~~
compilation terminated.
make[1]: *** [Vibex_demo_system.mk:118: verilator_sim_ctrl.o] Error 1
make: *** [Makefile:13: Vibex_demo_system] Error 2

ERROR: Failed to build lowrisc:ibex:demo_system:0 : '['make', '-j', '4']' exited with an error: 2

I am not sure if this is related, but when I tried to run the make command in the Building Software section for C stack, it produced these errors...

[ 93%] Linking C executable basic-passwdcheck
[ 93%] Built target basic-passwdcheck
[ 96%] Linking ASM executable blank
/usr/bin/objcopy: Unable to recognise the format of the input file `/home/aaron/Downloads/ibex-demo-system/sw/c/build/blank/blank'
make[2]: *** [blank/CMakeFiles/blank.dir/build.make:97: blank/blank] Error 1
make[2]: *** Deleting file 'blank/blank'
make[1]: *** [CMakeFiles/Makefile2:421: blank/CMakeFiles/blank.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
@Aaronyap2002 Aaronyap2002 changed the title Unable to run simulator for Hello World demo due to missing files Unable to run simulator for Hello World demo due to missing files and makefile error Jan 30, 2024
@Aaronyap2002 Aaronyap2002 changed the title Unable to run simulator for Hello World demo due to missing files and makefile error `Unable to run simulator for Hello World demo due to missing files and makefile error Jan 30, 2024
@Aaronyap2002 Aaronyap2002 changed the title `Unable to run simulator for Hello World demo due to missing files and makefile error Unable to run simulator for Hello World demo due to missing files and makefile error Jan 30, 2024
@marnovandermaas
Copy link
Contributor

verilated_heavy.h should be located in the standard Verilator include directory. For me this is located close to my verilator binary.
You can find where you Verilator binary is by executing: which verilator
From this path I can remove bin/verilator and add share/verilator/include. There resulting directory contains veraltored_heavy.h.

I'm not exactly sure how you installed Verilator, but I assume something went wrong in the process. I recommend that you follow the "Git quick install" instructions here: https://verilator.org/guide/latest/install.html#git-quick-install

@marnovandermaas
Copy link
Contributor

For the software building issue, could you make sure you have riscv32-unknown-elf-objcopy in your path and then use the following patch:

diff --git a/sw/c/gcc_toolchain.cmake b/sw/c/gcc_toolchain.cmake
index d84d1af..00d9e24 100644
--- a/sw/c/gcc_toolchain.cmake
+++ b/sw/c/gcc_toolchain.cmake
@@ -1,6 +1,7 @@
 set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../common/link.ld")
 set(CMAKE_SYSTEM_NAME Generic)
 set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc)
+set(CMAKE_OBJCOPY riscv32-unknown-elf-objcopy)
 set(CMAKE_C_FLAGS_INIT
     "-march=rv32imc -mabi=ilp32 -mcmodel=medany -Wall -fvisibility=hidden -ffreestanding")
 set(CMAKE_ASM_FLAGS_INIT "-march=rv32imc")

@Aaronyap2002
Copy link
Author

diff --git a/sw/c/gcc_toolchain.cmake b/sw/c/gcc_toolchain.cmake index d84d1af..00d9e24 100644 --- a/sw/c/gcc_toolchain.cmake +++ b/sw/c/gcc_toolchain.cmake @@ -1,6 +1,7 @@ set(LINKER_SCRIPT "${CMAKE_CURRENT_LIST_DIR}/../common/link.ld") set(CMAKE_SYSTEM_NAME Generic) set(CMAKE_C_COMPILER riscv32-unknown-elf-gcc) +set(CMAKE_OBJCOPY riscv32-unknown-elf-objcopy) set(CMAKE_C_FLAGS_INIT "-march=rv32imc -mabi=ilp32 -mcmodel=medany -Wall -fvisibility=hidden -ffreestanding") set(CMAKE_ASM_FLAGS_INIT "-march=rv32imc")

How should I run this patch? Just run it in the terminal right?

@rswarbrick
Copy link

Marno is suggesting you apply the patch to gcc_toolchain.cmake. There is probably a way to do it with the patch command, but the easiest way would be to manually edit that file to add the line in question.

@marnovandermaas
Copy link
Contributor

I've opened up a PR for this: #107

@marnovandermaas
Copy link
Contributor

Closing this as it is a duplicate of: #78

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

No branches or pull requests

3 participants