アリババのRISC-Vコアデザインのオープンソース化があった。中身を見てみるとビルドスクリプトにも思いっきりT-Headって書いてあるのでT-Headでいいでしょう。
初期のclone
したデザインからいくつかコメントアウトとPATHの追加削除を行っている。なんでcsh
のスクリプトに堂々とC++風のコメントが入っているんだ...
diff --git a/smart_run/setup/example_setup.csh b/smart_run/setup/example_setup.csh old mode 100644 new mode 100755 index 15c3e10..87711d8 --- a/smart_run/setup/example_setup.csh +++ b/smart_run/setup/example_setup.csh @@ -1,21 +1,5 @@ -/*Copyright 2019-2021 T-Head Semiconductor Co., Ltd. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ #!/bin/csh -setenv TOOL_EXTENSION /tools/riscv/riscv64-elf-x86_64/bin +setenv TOOL_EXTENSION /home/msyksphinz/riscv64/riscv64-unknown-elf/bin echo 'Toolchain path($TOOL_EXTENSION):' echo " $TOOL_EXTENSION" - -
openc910/smart_run
ディレクトリに行き、make runcase CASE=coremark
で動かしてみる。
最初はVCSからnc-verilogでないと動かないかと思ったが、デフォルトでiverilogでも行けるっぽい。よかった。
以下のコマンドでデザインのビルドとCoremarkのビルドまでやってくれるようだ。
と思ったらこけた。
DESKTOP-P42Q0NR:~/work/riscv/openc910/smart_run% make runcase CASE=coremark [THead-smart] Compiling smart now ... [THead-smart] SIM = iverilog Toolchain path: /home/msyksphinz/riscv64/riscv64-unknown-elf/bin /bin/sh: 1: Syntax error: Bad fd number make[2]: *** [setup/smart_cfg.mk:90: coremark_build] Error 2 make[1]: *** [Makefile:108: buildcase] Error 2 make: *** [Makefile:132: runcase] Error 2
こんな感じかな。csh前提の実装になっている。結構古い会社のデザインだとありがちだよね。
diff --git a/smart_run/setup/smart_cfg.mk b/smart_run/setup/smart_cfg.mk index 8fb93e7..50ce7fd 100644 --- a/smart_run/setup/smart_cfg.mk +++ b/smart_run/setup/smart_cfg.mk @@ -87,7 +87,7 @@ coremark_build: @find ./tests/lib/ -maxdepth 1 -type f -exec cp {} ./work/ \; @cp ./tests/lib/clib/* ./work @cp ./tests/lib/newlib_wrap/* ./work - @cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=c910 ENDIAN_MODE=little-endian CASENAME=coremark FILE=core_main >& coremark_build.case.log + @cd ./work && make -s clean && make -s all CPU_ARCH_FLAG_0=c910 ENDIAN_MODE=little-endian CASENAME=coremark FILE=core_main > coremark_build.case.log 2>&1
すると次は以下だ。やはり古いGCCでやるとダメだったか。新しいriscv64-unknown-elf-gcc
を取ってこなければなるまい。
riscv64-unknown-elf-gcc: error: unrecognized command line option '-msignedness-cmpiv' riscv64-unknown-elf-gcc: error: unrecognized command line option '-mno-thread-jumps1'; did you mean '-fno-thread-jumps'? riscv64-unknown-elf-gcc: error: unrecognized command line option '-mno-iv-adjust-addr-cost' riscv64-unknown-elf-gcc: error: unrecognized command line option '-mno-expand-split-imm'
B-Extensionに対応したRISC-V GCCがある程度GCCのバージョンとしては新しい。これを使ってみよう。
riscv64-unknown-elf-gcc -msignedness-cmpiv riscv64-unknown-elf-gcc: error: unrecognized command-line option ‘-msignedness-cmpiv’ riscv64-unknown-elf-gcc: fatal error: no input files compilation terminated. zsh: exit 1 riscv64-unknown-elf-gcc -msignedness-cmpiv
あれ?そもそもこのオプション普通は存在しないのか。やはりT-Head謹製のGCCを取ってこないとダメかな(もうディスクが無い)。