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 compile on Ubuntu 22.04 #7

Open
VasanthBalguri opened this issue Dec 7, 2023 · 4 comments
Open

Unable to compile on Ubuntu 22.04 #7

VasanthBalguri opened this issue Dec 7, 2023 · 4 comments

Comments

@VasanthBalguri
Copy link

Hi I was unable to compile the source code. Following is the error
I have used the tool chain provided in the README link

[ 7%] Building ASM object CMakeFiles/taurus.dir/common/crt.S.obj
/home/vasanthbalguri/practice/taurus/common/crt.S: Assembler messages:
/home/vasanthbalguri/practice/taurus/common/crt.S:132: Error: unrecognized opcode csrw mtvec,t0', extension zicsr' required
/home/vasanthbalguri/practice/taurus/common/crt.S:146: Error: unrecognized opcode csrr a0,mhartid', extension zicsr' required
/home/vasanthbalguri/practice/taurus/common/crt.S:205: Error: unrecognized opcode csrr a0,mcause', extension zicsr' required
/home/vasanthbalguri/practice/taurus/common/crt.S:206: Error: unrecognized opcode csrr a1,mepc', extension zicsr' required
/home/vasanthbalguri/practice/taurus/common/crt.S:209: Error: unrecognized opcode csrw mepc,a0', extension zicsr' required
/home/vasanthbalguri/practice/taurus/common/crt.S:213: Error: unrecognized opcode csrs mstatus,t0', extension zicsr' required
gmake[2]: *** [CMakeFiles/taurus.dir/build.make:75: CMakeFiles/taurus.dir/common/crt.S.obj] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:84: CMakeFiles/taurus.dir/all] Error 2
gmake: *** [Makefile:136: all] Error 2

Please let me know how to proceed?

@rnayabed
Copy link
Owner

rnayabed commented Dec 7, 2023

Hi, can you link the version and what toolchain you are using? Also what are you compiling for? Can you pass the full list of arguments you send to setup?

Doing a little research i found that i no longer implies zicsr & zifencei, we have to manually specify it.

Can you just edit cmake/taurusToolchain.cmake line 30 (or relevant) and add _zicsr_zifencei at the end of RISCV_ARCH property? Then try compiling and see what happens?
For example if it is set(RISCV_ARCH rv32im) change it to set(RISCV_ARCH rv32im_zicsr_zifencei)

@VasanthBalguri
Copy link
Author

This is my toolchain:

vasanthbalguri@vasanthbalguri-Desktop:~$ riscv32-unknown-elf-gcc -v
Using built-in specs.
COLLECT_GCC=riscv32-unknown-elf-gcc
COLLECT_LTO_WRAPPER=/home/vasanthbalguri/custom/opt/riscv/bin/../libexec/gcc/riscv32-unknown-elf/13.2.0/lto-wrapper
Target: riscv32-unknown-elf
Configured with: /home/stnolting/tmp/rvgcc/riscv-gnu-toolchain/gcc/configure --target=riscv32-unknown-elf --prefix=/home/stnolting/tmp/riscv/bin --disable-shared --disable-threads --enable-languages=c,c++ --with-pkgversion= --with-system-zlib --enable-tls --with-newlib --with-sysroot=/home/stnolting/tmp/riscv/bin/riscv32-unknown-elf --with-native-system-header-dir=/include --disable-libmudflap --disable-libssp --disable-libquadmath --disable-libgomp --disable-nls --disable-tm-clone-registry --src=.././gcc --disable-multilib --with-abi=ilp32 --with-arch=rv32i --with-tune=rocket --with-isa-spec=20191213 'CFLAGS_FOR_TARGET=-Os -mcmodel=medlow' 'CXXFLAGS_FOR_TARGET=-Os -mcmodel=medlow'
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 13.2.0 ()

This is what I was running:

./setup.sh --target-triplet riscv32-unknown-elf --target-board ARIES_MICRO_V1

After I changed this line it seems to work. Is this specific to me or will it affect linux user base?
Also I have a few suggestions, can I create a pull request for it?

  1. Having separate scripts and build and install will be a good idea
  2. As now the script goes into sudo install branch even after I mention my custom install path
  3. We cannot always guarantee that custom path will not need sudo
  4. Hence separate scripts makes more sense
  5. CI/CD automation will become easy

@rnayabed
Copy link
Owner

rnayabed commented Dec 8, 2023

Yes, this means the rv32im March no longer adds zicsr extension by default. We need to modify the cmake file slightly and edit them here too.. can you send a PR?

The script runs sudo make install when the directory provided is not readable..

taurus/setup.sh

Line 227 in 1dda108

if [[ -z ${TAURUS_INSTALL_PATH+x} ]] || [[ -r "${TAURUS_INSTALL_PATH}" ]]; then
. Is it broken?

Regarding the separate scripts, can you please elaborate more?

@VasanthBalguri
Copy link
Author

VasanthBalguri commented Dec 8, 2023 via email

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

2 participants