I’m new to riscv and want to compile a bare-metal toolchain
with latest binutils/gcc git tree. I have seen both upstream projects recently got support for riscv. Any plans to get newlib support upstream, too?
I added riscv support to my build system, but I get an internal compiler error:
Makefile:490: recipe for target ‘_multc3.o’ failed
make[8]: *** [_multc3.o] Error 1
make[8]: *** Waiting for unfinished jobs…
/home/wbx/riscv/toolchain_build_generic-riscv_newlib/w-gcc-git-1/gcc-git/libgcc/libgcc2.c: In function ‘__divtc3’:
/home/wbx/riscv/toolchain_build_generic-riscv_newlib/w-gcc-git-1/gcc-git/libgcc/libgcc2.c:2094:1: error: unable to generate reloads for:
}
^
(insn 2671 2822 1275 33 (set (reg:SI 1107)
(mem/c:SI (plus:SI (reg/f:SI 65 frame)
(const_int 4 [0x4])) [3 %sfp±188 S4 A32])) “/home/wbx/riscv/toolchain_build_generic-riscv_newlib/w-gcc-git-1/gcc-git/libgcc/libgcc2.c”:2082 132 {*movsi_internal}
(expr_list:REG_DEAD (reg:SI 1225)
(nil)))
/home/wbx/riscv/toolchain_build_generic-riscv_newlib/w-gcc-git-1/gcc-git/libgcc/libgcc2.c:2094:1: internal compiler error: in curr_insn_transform, at lra-constraints.c:3785
Please submit a full bug report,
with preprocessed source if appropriate.
See http://www.openadk.org/ for instructions.
Makefile:490: recipe for target ‘_divtc3.o’ failed
make[8]: *** [_divtc3.o] Error 1
Makefile:10886: recipe for target ‘all-target-libgcc’ failed
make[7]: *** [all-target-libgcc] Error 2
Makefile:872: recipe for target ‘all’ failed
make[6]: *** [all] Error 2
If that patch doesn’t fix your bug, then I’ll need to be able to reproduce your error to help. Can you first verify that riscv-gnu-toolchain builds on your platform, and if it does can you attach a preprocessed source to a bug report on https://github.com/riscv/riscv-gcc/issues ?
You might also try GNU MCU Eclipse RISC-V Embedded GCC, it is a RISC-V toolchain intended for bare-metal embeded applications. It generates code for both riscv32 and riscv64.
Binary releases for all major platforms (32/64-bits) are available from GitHub.