Build: Added support for out-of-tree Arch

Introduces the ARCH_ROOT argument, similar to BOARD_ROOT and SOC_ROOT.
This enables support for out-of-tree architectures.

The ARCH_ROOT out-of-tree layout is expected to be the following:
 * ${ARCH_ROOT}/arch/${ARCH}/
 * ${ARCH_ROOT}/include/arch/${ARCH}/ (Optional)

Signed-off-by: Klaus Petersen <kape@oticon.com>
This commit is contained in:
Klaus Petersen 2018-11-15 10:37:46 +01:00 committed by Anas Nashif
commit c66cb76fed
6 changed files with 13 additions and 4 deletions

View file

@ -59,7 +59,7 @@ zephyr_library_named(zephyr)
zephyr_include_directories( zephyr_include_directories(
kernel/include kernel/include
arch/${ARCH}/include ${ARCH_DIR}/${ARCH}/include
include include
include/drivers include/drivers
${PROJECT_BINARY_DIR}/include/generated ${PROJECT_BINARY_DIR}/include/generated
@ -690,7 +690,7 @@ gen_kobj(KOBJ_INCLUDE_PATH)
set(OFFSETS_LIB offsets) set(OFFSETS_LIB offsets)
set(OFFSETS_C_PATH ${ZEPHYR_BASE}/arch/${ARCH}/core/offsets/offsets.c) set(OFFSETS_C_PATH ${ARCH_DIR}/${ARCH}/core/offsets/offsets.c)
set(OFFSETS_H_PATH ${PROJECT_BINARY_DIR}/include/generated/offsets.h) set(OFFSETS_H_PATH ${PROJECT_BINARY_DIR}/include/generated/offsets.h)
add_library( ${OFFSETS_LIB} OBJECT ${OFFSETS_C_PATH}) add_library( ${OFFSETS_LIB} OBJECT ${OFFSETS_C_PATH})

View file

@ -1,4 +1,4 @@
add_definitions(-D__ZEPHYR_SUPERVISOR__) add_definitions(-D__ZEPHYR_SUPERVISOR__)
add_subdirectory(common) add_subdirectory(common)
add_subdirectory(${ARCH}) add_subdirectory(${ARCH_DIR}/${ARCH} arch/${ARCH})

View file

@ -12,7 +12,7 @@
# overriden (by defining symbols in multiple locations) # overriden (by defining symbols in multiple locations)
# Note: $ARCH might be a glob pattern # Note: $ARCH might be a glob pattern
source "arch/$(ARCH)/Kconfig" source "$(ARCH_DIR)/$(ARCH)/Kconfig"
choice choice
prompt "Architecture" prompt "Architecture"

View file

@ -255,6 +255,12 @@ else()
set(SOC_DIR ${SOC_ROOT}/soc) set(SOC_DIR ${SOC_ROOT}/soc)
endif() endif()
if(NOT ARCH_ROOT)
set(ARCH_DIR ${ZEPHYR_BASE}/arch)
else()
set(ARCH_DIR ${ARCH_ROOT}/arch)
endif()
# Use BOARD to search for a '_defconfig' file. # Use BOARD to search for a '_defconfig' file.
# e.g. zephyr/boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig. # e.g. zephyr/boards/arm/96b_carbon_nrf51/96b_carbon_nrf51_defconfig.
# When found, use that path to infer the ARCH we are building for. # When found, use that path to infer the ARCH we are building for.

View file

@ -30,6 +30,7 @@ set(ENV{ARCH} ${ARCH})
set(ENV{BOARD_DIR} ${BOARD_DIR}) set(ENV{BOARD_DIR} ${BOARD_DIR})
set(ENV{SOC_DIR} ${SOC_DIR}) set(ENV{SOC_DIR} ${SOC_DIR})
set(ENV{PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR}) set(ENV{PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR})
set(ENV{ARCH_DIR} ${ARCH_DIR})
add_custom_target( add_custom_target(
menuconfig menuconfig
@ -43,6 +44,7 @@ add_custom_target(
SOC_DIR=$ENV{SOC_DIR} SOC_DIR=$ENV{SOC_DIR}
PROJECT_BINARY_DIR=$ENV{PROJECT_BINARY_DIR} PROJECT_BINARY_DIR=$ENV{PROJECT_BINARY_DIR}
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT} ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
ARCH_DIR=$ENV{ARCH_DIR}
${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/kconfig/menuconfig.py ${KCONFIG_ROOT} ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/kconfig/menuconfig.py ${KCONFIG_ROOT}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
USES_TERMINAL USES_TERMINAL

View file

@ -142,6 +142,7 @@ add_custom_target(
KERNELVERSION=${KERNELVERSION} KERNELVERSION=${KERNELVERSION}
BOARD_DIR=boards/*/*/ BOARD_DIR=boards/*/*/
ARCH=* ARCH=*
ARCH_DIR=arch/
SOC_DIR=soc/ SOC_DIR=soc/
SRCARCH=x86 SRCARCH=x86
KCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE} KCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE}