From ba776a1fd15c24dc1ba014c3abe19e07346e663f Mon Sep 17 00:00:00 2001 From: Jean-Paul Etienne Date: Wed, 11 Jan 2017 00:24:30 +0100 Subject: [PATCH] scripts: added Makefile to handle an external riscv32 toolchain Compiling Zephyr with an external riscv32 toolchain would require the following env variables to be exported: export ZEPHYR_GCC_VARIANT=riscv32 export RISCV32_TOOLCHAIN_PATH=/PATH/TO/TOOLCHAIN/BINARY Change-Id: I2072ed9079a4cabd27837ab39b947bc0a0a1a8b4 Signed-off-by: Jean-Paul Etienne --- scripts/Makefile.toolchain.riscv32 | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 scripts/Makefile.toolchain.riscv32 diff --git a/scripts/Makefile.toolchain.riscv32 b/scripts/Makefile.toolchain.riscv32 new file mode 100644 index 00000000000..1716c05edb9 --- /dev/null +++ b/scripts/Makefile.toolchain.riscv32 @@ -0,0 +1,13 @@ +ifndef RISCV32_TOOLCHAIN_PATH +$(error RISCV32_TOOLCHAIN_PATH is not set) +endif + +CROSS_COMPILE = ${RISCV32_TOOLCHAIN_PATH}/bin/riscv32-unknown-elf- + +TOOLCHAIN_LIBS = gcc +LIBGCC_DIR = $(shell dirname `$(CROSS_COMPILE)gcc ${KBUILD_CFLAGS} -print-libgcc-file-name`) + +LIB_INCLUDE_DIR += -L ${LIBGCC_DIR} +TOOLCHAIN_CFLAGS = -I${RISCV32_TOOLCHAIN_PATH}/include + +export CROSS_COMPILE TOOLCHAIN_LIBS TOOLCHAIN_CFLAGS LIB_INCLUDE_DIR