From b61f448a3f401baf4373fbabd0895a9040c4d2f1 Mon Sep 17 00:00:00 2001 From: Daniel Leung Date: Tue, 3 Dec 2019 09:59:10 -0800 Subject: [PATCH] xtensa: add support to build HAL as part of build process This adds the necessary bits to build the Xtensa HAL as a module, and removes the bits to use the HAL built with the Zephyr SDK. Signed-off-by: Daniel Leung --- arch/Kconfig | 1 + arch/xtensa/core/fatal.c | 2 +- cmake/toolchain/xtools/target.cmake | 10 ---------- cmake/toolchain/zephyr/0.10/target.cmake | 10 ---------- cmake/toolchain/zephyr/0.11/target.cmake | 7 ------- modules/Kconfig.xtensa | 8 ++++++++ 6 files changed, 10 insertions(+), 28 deletions(-) create mode 100644 modules/Kconfig.xtensa diff --git a/arch/Kconfig b/arch/Kconfig index 415b76e724..7ebef35f62 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -42,6 +42,7 @@ config XTENSA select HAS_DTS select USE_SWITCH select USE_SWITCH_SUPPORTED + select XTENSA_HAL if "$(ZEPHYR_TOOLCHAIN_VARIANT)" != "xcc" config ARCH_POSIX bool "POSIX (native) architecture" diff --git a/arch/xtensa/core/fatal.c b/arch/xtensa/core/fatal.c index 883a06c0ce..1576ece0f7 100644 --- a/arch/xtensa/core/fatal.c +++ b/arch/xtensa/core/fatal.c @@ -8,7 +8,7 @@ #include #include #include -#include +#include #include #include LOG_MODULE_DECLARE(os); diff --git a/cmake/toolchain/xtools/target.cmake b/cmake/toolchain/xtools/target.cmake index f9d4e6857a..34113545e4 100644 --- a/cmake/toolchain/xtools/target.cmake +++ b/cmake/toolchain/xtools/target.cmake @@ -18,16 +18,6 @@ set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET}) set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-) -if("${ARCH}" STREQUAL "xtensa") - set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}) - set(TOOLCHAIN_INCLUDES - ${SYSROOT_DIR}/include/arch/include - ${SYSROOT_DIR}/include - ) - - LIST(APPEND TOOLCHAIN_LIBS hal) - LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib) -endif() set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET}) if("${ARCH}" STREQUAL "x86") diff --git a/cmake/toolchain/zephyr/0.10/target.cmake b/cmake/toolchain/zephyr/0.10/target.cmake index f9d4e6857a..34113545e4 100644 --- a/cmake/toolchain/zephyr/0.10/target.cmake +++ b/cmake/toolchain/zephyr/0.10/target.cmake @@ -18,16 +18,6 @@ set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET}) set(CROSS_COMPILE ${TOOLCHAIN_HOME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-) -if("${ARCH}" STREQUAL "xtensa") - set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}) - set(TOOLCHAIN_INCLUDES - ${SYSROOT_DIR}/include/arch/include - ${SYSROOT_DIR}/include - ) - - LIST(APPEND TOOLCHAIN_LIBS hal) - LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib) -endif() set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET}) if("${ARCH}" STREQUAL "x86") diff --git a/cmake/toolchain/zephyr/0.11/target.cmake b/cmake/toolchain/zephyr/0.11/target.cmake index f7923e47b2..f0bb1ee61d 100644 --- a/cmake/toolchain/zephyr/0.11/target.cmake +++ b/cmake/toolchain/zephyr/0.11/target.cmake @@ -13,13 +13,6 @@ set(SYSROOT_TARGET ${CROSS_COMPILE_TARGET}) if("${ARCH}" STREQUAL "xtensa") set(SYSROOT_DIR ${TOOLCHAIN_HOME}/xtensa/${SOC_NAME}/${SYSROOT_TARGET}) - set(TOOLCHAIN_INCLUDES - ${SYSROOT_DIR}/include/arch/include - ${SYSROOT_DIR}/include - ) - - LIST(APPEND TOOLCHAIN_LIBS hal) - LIST(APPEND LIB_INCLUDE_DIR -L${SYSROOT_DIR}/lib) set(CROSS_COMPILE ${TOOLCHAIN_HOME}/xtensa/${SOC_NAME}/${CROSS_COMPILE_TARGET}/bin/${CROSS_COMPILE_TARGET}-) else() set(SYSROOT_DIR ${TOOLCHAIN_HOME}/${SYSROOT_TARGET}/${SYSROOT_TARGET}) diff --git a/modules/Kconfig.xtensa b/modules/Kconfig.xtensa new file mode 100644 index 0000000000..7f1d1aff94 --- /dev/null +++ b/modules/Kconfig.xtensa @@ -0,0 +1,8 @@ +# Copyright (c) 2019 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +config XTENSA_HAL + bool + help + Build the Xtensa HAL module during build process. + This is selected by the Xtensa ARCH kconfig automatically.