From 698f5f3e80d02cd305fbc0e19fa16e45771e3420 Mon Sep 17 00:00:00 2001 From: Zhihong Chen Date: Wed, 8 Mar 2023 21:05:56 +0800 Subject: [PATCH] arch/riscv/Toolchain: add riscv32-unknown-elf selection - user can use menuconfig to select riscv64-unknown-elf or riscv32-unknown-elf Signed-off-by: Zhihong Chen --- arch/risc-v/Kconfig | 13 ++++++++++--- arch/risc-v/src/common/Toolchain.defs | 10 ++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/arch/risc-v/Kconfig b/arch/risc-v/Kconfig index bc591c06d1..37f532027b 100644 --- a/arch/risc-v/Kconfig +++ b/arch/risc-v/Kconfig @@ -306,15 +306,22 @@ config ARCH_MPU_HAS_NAPOT choice prompt "Toolchain Selection" - default RISCV_TOOLCHAIN_GNU_RVG + default RISCV_TOOLCHAIN_GNU_RV64 -config RISCV_TOOLCHAIN_GNU_RVG - bool "Generic GNU RVG toolchain" +config RISCV_TOOLCHAIN_GNU_RV64 + bool "Generic GNU RV64 toolchain" select ARCH_TOOLCHAIN_GNU ---help--- This option should work for any modern GNU toolchain (GCC 5.2 or newer) configured for riscv64-unknown-elf. +config RISCV_TOOLCHAIN_GNU_RV32 + bool "Generic GNU RV32 toolchain" + select ARCH_TOOLCHAIN_GNU + ---help--- + This option should work for any modern GNU toolchain (GCC 5.2 or newer) + configured for riscv32-unknown-elf. + endchoice config RISCV_SEMIHOSTING_HOSTFS diff --git a/arch/risc-v/src/common/Toolchain.defs b/arch/risc-v/src/common/Toolchain.defs index 44c14a05b6..c5a6351aa0 100644 --- a/arch/risc-v/src/common/Toolchain.defs +++ b/arch/risc-v/src/common/Toolchain.defs @@ -27,7 +27,9 @@ # command-line selection. # -ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_GNU_RVG)),y) +ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_GNU_RV64)),y) + CONFIG_RISCV_TOOLCHAIN ?= GNU_RVG +else ifeq ($(filter y, $(CONFIG_RISCV_TOOLCHAIN_GNU_RV32)),y) CONFIG_RISCV_TOOLCHAIN ?= GNU_RVG endif @@ -120,7 +122,11 @@ ifeq ($(CONFIG_RISCV_TOOLCHAIN),GNU_RVG) # Generic GNU RVG toolchain - CROSSDEV ?= riscv64-unknown-elf- + ifeq ($(CONFIG_RISCV_TOOLCHAIN_GNU_RV32),y) + CROSSDEV ?= riscv32-unknown-elf- + else + CROSSDEV ?= riscv64-unknown-elf- + endif # Detect cpu ISA support flags