diff --git a/dist/tools/ci/print_toolchain_versions.sh b/dist/tools/ci/print_toolchain_versions.sh index 6b3bb1083a..49abec1f07 100755 --- a/dist/tools/ci/print_toolchain_versions.sh +++ b/dist/tools/ci/print_toolchain_versions.sh @@ -126,6 +126,8 @@ for p in \ arm-none-eabi \ avr mips-mti-elf \ msp430-elf \ + riscv-none-elf \ + riscv64-unknown-elf \ riscv-none-embed \ xtensa-esp32-elf \ xtensa-esp8266-elf \ @@ -141,6 +143,8 @@ for p in \ arm-none-eabi \ mips-mti-elf \ msp430-elf \ + riscv-none-elf \ + riscv64-unknown-elf \ riscv-none-embed \ xtensa-esp32-elf \ xtensa-esp8266-elf \ diff --git a/makefiles/arch/riscv.inc.mk b/makefiles/arch/riscv.inc.mk index 2fe6f032b2..ea71264666 100644 --- a/makefiles/arch/riscv.inc.mk +++ b/makefiles/arch/riscv.inc.mk @@ -1,5 +1,19 @@ # Target architecture for the build. -TARGET_ARCH_RISCV ?= riscv-none-embed +TARGET_ARCH_RISCV ?= riscv-none-elf + +# If TARGET_ARCH wasn't set by user, also check if riscv64-unknown-elf +# or riscv-none-embed is present. +ifeq (riscv-none-elf,$(TARGET_ARCH_RISCV)) + ifeq (,$(shell which $(TARGET_ARCH_RISCV)-gcc)) + ifneq (,$(shell which riscv64-unknown-elf-gcc)) + TARGET_ARCH_RISCV := riscv64-unknown-elf + else ifneq (,$(shell which riscv-none-embed-gcc)) + $(info Falling back to legacy riscv-none-embed toolchain) + TARGET_ARCH_RISCV := riscv-none-embed + endif + endif +endif + TARGET_ARCH ?= $(TARGET_ARCH_RISCV) # define build specific options