Open pfalz-benni opened 4 months ago
gcc 13 toolchain:https://download.rt-thread.org/rt-smart/riscv64/riscv64-unknown-linux-musl-rv64imafdcv-lp64d-20230804.tar.bz2 use vector please refer this patch: [Uploading 0006-support-gcc-13.patch…]()
@LearnigF The uploaded patch can not be displayed... Could you please provide it again?
What happened
Due to its improvements in vectorization, I want to use a newer version of the GCC toolchain to build applications for the big core that implements RVV1.0. I am able to build the executable with the standard RISC-V GCC 13.2.0 (rv64gc_lp64d_linux_musl_medany), also linking the provided liker script (https://github.com/kendryte/k230_sdk/blob/main/src/big/rt-smart/userapps/linker_scripts/riscv64/link.lds).
When I execute the elf file (a simple main function returning 0) on the big core I get the following error:
Comparing the disassemblies of the executables compiled with the vendor GCC 12 (left) and the standard GCC 13 (right) I'm seeing the following differences for the specified program counter:
I'm suspecting that the problem is that the vendor GCC 12 automatically compiles a number of syscall implementations into every executable. I'm guessing RT-Thread tries to call them and that's why the program crashes. Here are examples of the missing syscalls but there are far more:
If my assumption is correct, could you please provide the source for those syscalls built into the vendor toolchain?
Reproduction steps
Build toolchain configured like the provided GCC 12 from the source on https://github.com/riscv-collab/riscv-gnu-toolchain with configuration "rv64gc_lp64d_linux_musl_medany".
Write minimal C file:
Build with
rv64gc_lp64d_linux_musl_medany/bin/riscv64-unknown-linux-musl-gcc -march=rv64gc -mabi=lp64d -mcmodel=medany -T k230_rtsmart_linker_scripts/riscv64/link.lds --static main.c -o main.elf
Transfer
main.elf
to K230 board and execute it on the big core.Hardware board
CanMV-K230-V1.1
Software version
v1.5
Bug frequency
100%
Anything else
No response