Makefile.toolchain.zephyr: fix xtensa support

Building zephyr for xtensa with gcc requires additional include paths and
additional library (libhal).

Add xtensa sysroot and include paths to CFLAGS when building for xtensa.
The root Makefile then does the right thing adding these parameters to
KBUILD_CFLAGS and KBUILD_ASFLAGS.

Add xtensa libhal to the TOOLCHAIN_LIBS_xtensa. Modify TOOLICHAIN_LIBS to
include arch-specific libraries.

Seems that it would be nice to have TOOLCHAIN_CFLAGS_$(ARCH) with the
same behavior as TOOLCHAIN_LIBS_$(ARCH). It also seems that the SYSROOT
definition doesn't have to be restricted to MAKEFILE_TOOLCHAIN_DO_PASS2.

Change-Id: Ia6703ca067b964ac2f8be8fe8513ca28f101a6a3
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
This commit is contained in:
Max Filippov 2017-02-17 05:54:56 -08:00 committed by Anas Nashif
commit a4f7e562ef

View file

@ -87,6 +87,11 @@ CROSS_COMPILE_nios2=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_nios2)/$(CR
CROSS_COMPILE_TARGET_xtensa = xtensa-$(TOOLCHAIN_VENDOR)-elf
SYSROOT_TARGET_xtensa = xtensa-$(TOOLCHAIN_VENDOR)-elf
CROSS_COMPILE_xtensa=$(TOOLCHAIN_HOME)/usr/bin/$(CROSS_COMPILE_TARGET_xtensa)/$(CROSS_COMPILE_TARGET_xtensa)-
ifeq ($(ARCH),xtensa)
SYSROOT := ${ZEPHYR_SDK_INSTALL_DIR}/sysroots/${SYSROOT_TARGET_${ARCH}}
CFLAGS += --sysroot=$(SYSROOT) -I=/usr/include -I=/usr/include/arch/include
endif
TOOLCHAIN_LIBS_xtensa = hal
# riscv32 (pass1)
CROSS_COMPILE_TARGET_riscv32 = riscv32-$(TOOLCHAIN_VENDOR)-elf
@ -117,7 +122,7 @@ endif
QEMU_BIN_PATH ?= $(TOOLCHAIN_HOME)/usr/bin
QEMU_BIOS=$(TOOLCHAIN_HOME)/usr/share/qemu
TOOLCHAIN_LIBS = gcc
TOOLCHAIN_LIBS = gcc ${TOOLCHAIN_LIBS_${ARCH}}
DTC = ${TOOLCHAIN_HOME}/usr/bin/dtc
OPENOCD ?= ${TOOLCHAIN_HOME}/usr/bin/openocd