Nuclei-Software / nuclei-sdk

Nuclei RISC-V Software Development Kit
https://doc.nucleisys.com/nuclei_sdk
Apache License 2.0
117 stars 50 forks source link

How to evaluate gcc13 for nuclei sdk #53

Closed fanghuaqi closed 10 months ago

fanghuaqi commented 11 months ago

If you want to take a try with gcc13 for nuclei sdk, you need to download our prebuilt still in development gcc13/clang17 toolchain from https://drive.weixin.qq.com/s?k=ABcAKgdSAFcdQ1noOT, and use a develop branch of nuclei sdk https://github.com/Nuclei-Software/nuclei-sdk/tree/develop.

From 2023.10.9, now develop branch is changing to use gcc13, and merged all the changes from feature/llvm branch, please switch to use develop branch.

Latest qemu for this branch can be found here: https://drive.weixin.qq.com/s?k=ABcAKgdSAFcWD95meC

About how to use this toolchain, please click(In Chinese) https://doc.weixin.qq.com/doc/w3_ASUAMQZqALwUNtgZUvFTH2hR2F7KD?scode=ABcAKgdSAFc1u2vvWl

Download the toolchain, and export it to system PATH, and just try it.

If you want to try nuclei llvm toolchain, just pass TOOLCHAIN=nuclei_llvm when run make command.

$ riscv64-unknown-elf-gcc --version
riscv64-unknown-elf-gcc (gfc04c1213) 13.1.1 20230713
Copyright (C) 2023 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
$ cd application/baremetal/benchmark/coremark
$ make TOOLCHAIN=nuclei_llvm clean all
Clean all build objects
Current Configuration: TOOLCHAIN=nuclei_llvm RISCV_ARCH=rv32imafdc RISCV_ABI=ilp32d RISCV_TUNE=nuclei-300-series RISCV_CMODEL=medlow SOC=evalsoc BOARD=nuclei_fpga_eval CORE=n307fd ARCH_EXT= DOWNLOAD=ilm STDCLIB=newlib_small SMP= BOOT_HARTID=0
Compiling  :  ../../../../SoC/evalsoc/Common/Source/evalsoc_common.c
Compiling  :  ../../../../SoC/evalsoc/Common/Source/system_evalsoc.c
... ...
Compiling  :  core_list_join.c
Compiling  :  core_main.c
Compiling  :  core_matrix.c
Compiling  :  core_portme.c
Compiling  :  core_state.c
Compiling  :  core_util.c
Linking    :  coremark.elf
   text    data     bss     dec     hex filename
  22836    4072    4812   31720    7be8 coremark.elf

If you want to test gnu toolchain support Zc and Xxlcz, you can try it like this:

nuclei llvm not yet support Zc

cd application/baremetal/benchmark/coremark
# default TOOLCHAIN is nuclei_gnu, no need to pass TOOLCHAIN=nuclei_gnu
## Test cpu arch rv32imafc, which means n300 with single float point, and C extension
make CORE=n300f ARCH_EXT=_zca_zcb_zcf_zcmp_zcmt clean
make CORE=n300f ARCH_EXT=_zca_zcb_zcf_zcmp_zcmt all

## Test cpu arch rv32imaf_zca_zcb_zcf_zcmp_zcmt, which means n300 with single float point, and Zc extension
make CORE=n300f ARCH_EXT=_zca_zcb_zcf_zcmp_zcmt clean
make CORE=n300f ARCH_EXT=_zca_zcb_zcf_zcmp_zcmt all

## Test cpu arch rv32imaf_zca_zcb_zcf_zcmp_zcmt_xxlcz, which means n300 with single float point, and Zc extension, and Xxlcz extension
make CORE=n300f ARCH_EXT=_zca_zcb_zcf_zcmp_zcmt_xxlcz clean
make CORE=n300f ARCH_EXT=_zca_zcb_zcf_zcmp_zcmt_xxlcz all

You can also switch different c library by using https://doc.nucleisys.com/nuclei_sdk/develop/buildsystem.html#develop-buildsystem-var-stdclib

fanghuaqi commented 10 months ago

Branch feature/llvm and feature/iar are removed now, please directly use latest 0.5.0 release using Nuclei Studio 2023.10.

see https://github.com/Nuclei-Software/nuclei-sdk/releases/tag/0.5.0