arch/risc-v: add rv64ilp32 toolchain
This adds support of rv64ilp32 toolchain available from Github repo `ruyisdk/riscv-gnu-toolchain-rv64ilp32`. With this 32-bit nuttx can be generated for RV64 devices. Signed-off-by: Yanfeng Liu <yfliu2008@qq.com>
This commit is contained in:
parent
d029e88472
commit
33afbaadb9
@ -337,7 +337,12 @@ config ARCH_RV32
|
||||
config ARCH_RV64
|
||||
bool
|
||||
default n
|
||||
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF
|
||||
select LIBC_ARCH_ELF_64BIT if LIBC_ARCH_ELF && !ARCH_RV64ILP32
|
||||
|
||||
config ARCH_RV64ILP32
|
||||
bool
|
||||
depends on ARCH_RV64
|
||||
default n
|
||||
|
||||
config ARCH_RV_ISA_M
|
||||
bool
|
||||
@ -547,6 +552,14 @@ config RISCV_TOOLCHAIN_CLANG
|
||||
bool "LLVM Clang toolchain"
|
||||
select ARCH_TOOLCHAIN_CLANG
|
||||
|
||||
config RISCV_TOOLCHAIN_GNU_RV64ILP32
|
||||
bool "Generic GNU RV64ILP32 toolchain"
|
||||
select ARCH_TOOLCHAIN_GNU
|
||||
select ARCH_RV64ILP32
|
||||
---help---
|
||||
This option work with Ruyisdk toolchain (GCC 13 or newer)
|
||||
configured for riscv64-unknown-elf.
|
||||
|
||||
endchoice # Toolchain Selection
|
||||
|
||||
config RISCV_SEMIHOSTING_HOSTFS
|
||||
|
@ -26,6 +26,7 @@ set(CMAKE_CXX_COMPILER_FORCED TRUE)
|
||||
|
||||
if(CONFIG_RISCV_TOOLCHAIN_GNU_RV32
|
||||
OR CONFIG_RISCV_TOOLCHAIN_GNU_RV64
|
||||
OR CONFIG_RISCV_TOOLCHAIN_GNU_RV64ILP32
|
||||
OR CONFIG_RISCV_TOOLCHAIN_CLANG)
|
||||
if(NOT CONFIG_RISCV_TOOLCHAIN)
|
||||
set(CONFIG_RISCV_TOOLCHAIN GNU_RVG)
|
||||
@ -184,7 +185,11 @@ if(CONFIG_ARCH_RV32)
|
||||
add_link_options(-Wl,-melf32lriscv)
|
||||
elseif(CONFIG_ARCH_RV64)
|
||||
add_compile_options(-mcmodel=medany)
|
||||
add_link_options(-Wl,-melf64lriscv)
|
||||
if(CONFIG_ARCH_RV64ILP32)
|
||||
add_link_options(-Wl,-melf32lriscv)
|
||||
else()
|
||||
add_link_options(-Wl,-melf64lriscv)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(CONFIG_DEBUG_OPT_UNUSED_SECTIONS)
|
||||
@ -268,7 +273,11 @@ if(${CONFIG_RISCV_TOOLCHAIN} STREQUAL GNU_RVG)
|
||||
set(LLVM_ARCHTYPE "riscv32")
|
||||
elseif(CONFIG_ARCH_RV64)
|
||||
set(ARCHTYPE "rv64")
|
||||
set(ARCHABITYPE "lp64")
|
||||
if(CONFIG_ARCH_RV64ILP32)
|
||||
set(ARCHABITYPE "ilp32")
|
||||
else()
|
||||
set(ARCHABITYPE "lp64")
|
||||
endif()
|
||||
set(LLVM_ARCHTYPE "riscv64")
|
||||
endif()
|
||||
|
||||
|
@ -29,6 +29,8 @@
|
||||
|
||||
ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_GNU_RV64)),y)
|
||||
CONFIG_RISCV_TOOLCHAIN ?= GNU_RVG
|
||||
else ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_GNU_RV64ILP32)),y)
|
||||
CONFIG_RISCV_TOOLCHAIN ?= GNU_RVG
|
||||
else ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_GNU_RV32)),y)
|
||||
CONFIG_RISCV_TOOLCHAIN ?= GNU_RVG
|
||||
else ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_CLANG)),y)
|
||||
@ -119,6 +121,8 @@ SHMODULEFLAGS = -Bsymbolic -G -Bdynamic --entry=__start
|
||||
ifeq ($(CONFIG_ARCH_RV32),y)
|
||||
LDFLAGS += -melf32lriscv
|
||||
SHMODULEFLAGS += -melf32lriscv
|
||||
else ifeq ($(CONFIG_ARCH_RV64ILP32),y)
|
||||
LDFLAGS += -melf32lriscv
|
||||
else
|
||||
LDFLAGS += -melf64lriscv
|
||||
endif
|
||||
@ -231,7 +235,11 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG)
|
||||
LLVM_ARCHTYPE := riscv32
|
||||
else ifeq ($(CONFIG_ARCH_RV64),y)
|
||||
ARCHTYPE = rv64
|
||||
ARCHABITYPE = lp64
|
||||
ifeq ($(CONFIG_ARCH_RV64ILP32),y)
|
||||
ARCHABITYPE = ilp32
|
||||
else
|
||||
ARCHABITYPE = lp64
|
||||
endif
|
||||
LLVM_ARCHTYPE := riscv64
|
||||
# https://www.sifive.com/blog/all-aboard-part-4-risc-v-code-models
|
||||
ARCHCPUFLAGS = -mcmodel=medany
|
||||
|
Loading…
Reference in New Issue
Block a user