The patch enables VexRiscv target to build in Rust using the builtin riscv32imac-unknown-none-elf target, while converting the built tools of VexRiscv from binutils to ld.lld and llvm-bintools. The purpose is to support the RISC-V port of ARTIQ.
Detail of changes
VexRiscv target configuration
The triple is changed to riscv32-unknown-linux to emphasize that the CPU target is 32-bits RISC-V. The linux sys is specified to ensure that the -shared flag is implemented properly for compiling shared libraries (see ARTIQ).
Rust support for VexRiscv
common.mak
CARGO_TRIPLE and CARGO_NORMAL is now gated by the CPU type, only or1k and vexriscv will have both defined.
The Rust builtin target riscv32imac-unknown-none-elf is supported when building with vexriscv, with the compression feature (c) disabled.
The unstable flag build-std=core,alloc is added to built Rust standard libraries with the above feature modification (used to be performed by xargo/cargo-xbuild, but now unstable Rust supports it).
integration/sdram_init.py
Uses llvm_asm! for riscv32 architecture in Rust, and asm! for or1k target for backward compatibility.
Changing build tools to ld.lld + llvm-bintools
cpu_interface: Added the llvm_tools option. Enabled in vexriscv.
common.mak: It now checks the LLVM_TOOLS flag. When enabled, misoc will build the binary using llvm-ar, llvm-objcopy and ld.lld instead of GNU binutils.
Summary
The patch enables VexRiscv target to build in Rust using the builtin
riscv32imac-unknown-none-elf
target, while converting the built tools of VexRiscv from binutils to ld.lld and llvm-bintools. The purpose is to support the RISC-V port of ARTIQ.Detail of changes
VexRiscv target configuration
riscv32-unknown-linux
to emphasize that the CPU target is 32-bits RISC-V. Thelinux
sys is specified to ensure that the-shared
flag is implemented properly for compiling shared libraries (see ARTIQ).Rust support for VexRiscv
common.mak
CARGO_TRIPLE
andCARGO_NORMAL
is now gated by the CPU type, onlyor1k
andvexriscv
will have both defined.riscv32imac-unknown-none-elf
is supported when building withvexriscv
, with the compression feature (c
) disabled.build-std=core,alloc
is added to built Rust standard libraries with the above feature modification (used to be performed by xargo/cargo-xbuild, but now unstable Rust supports it).integration/sdram_init.py
llvm_asm!
forriscv32
architecture in Rust, andasm!
foror1k
target for backward compatibility.Changing build tools to ld.lld + llvm-bintools
cpu_interface
: Added thellvm_tools
option. Enabled invexriscv
.common.mak
: It now checks theLLVM_TOOLS
flag. When enabled, misoc will build the binary usingllvm-ar
,llvm-objcopy
andld.lld
instead of GNU binutils.