build: support out of tree SoC definition

Add the glue to make this work with SoC code outside of the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2018-09-04 14:34:06 -05:00
commit 96455d5881
7 changed files with 17 additions and 12 deletions

View file

@ -50,9 +50,9 @@ zephyr_library_named(zephyr)
zephyr_include_directories( zephyr_include_directories(
kernel/include kernel/include
arch/${ARCH}/include arch/${ARCH}/include
soc/${ARCH}/${SOC_PATH} ${SOC_DIR}/${ARCH}/${SOC_PATH}
soc/${ARCH}/${SOC_PATH}/include ${SOC_DIR}/${ARCH}/${SOC_PATH}/include
soc/${ARCH}/${SOC_FAMILY}/include ${SOC_DIR}/${ARCH}/${SOC_FAMILY}/include
${BOARD_DIR} ${BOARD_DIR}
include include
include/drivers include/drivers
@ -295,7 +295,7 @@ else()
set(LINKER_SCRIPT ${BOARD_DIR}/linker.ld) set(LINKER_SCRIPT ${BOARD_DIR}/linker.ld)
if(NOT EXISTS ${LINKER_SCRIPT}) if(NOT EXISTS ${LINKER_SCRIPT})
# If not available, try an SoC specific linker file # If not available, try an SoC specific linker file
set(LINKER_SCRIPT ${ZEPHYR_BASE}/soc/${ARCH}/${SOC_PATH}/linker.ld) set(LINKER_SCRIPT ${SOC_DIR}/${ARCH}/${SOC_PATH}/linker.ld)
endif() endif()
endif() endif()
@ -337,9 +337,9 @@ add_subdirectory(misc)
include(misc/generated/CMakeLists.txt) include(misc/generated/CMakeLists.txt)
if(EXISTS soc/${ARCH}/CMakeLists.txt) if(EXISTS soc/${ARCH}/CMakeLists.txt)
add_subdirectory(soc/${ARCH}) add_subdirectory(${SOC_DIR}/${ARCH} soc/${ARCH})
else() else()
add_subdirectory(soc/${ARCH}/${SOC_PATH}) add_subdirectory(${SOC_DIR}/${ARCH}/${SOC_PATH} soc/${ARCH}/${SOC_PATH})
endif() endif()
add_subdirectory(boards) add_subdirectory(boards)

View file

@ -18,11 +18,11 @@
# Note: $ARCH and $BOARD_DIR might be glob patterns. # Note: $ARCH and $BOARD_DIR might be glob patterns.
source "$(BOARD_DIR)/Kconfig.defconfig" source "$(BOARD_DIR)/Kconfig.defconfig"
source "soc/$(ARCH)/*/Kconfig.defconfig" source "$(SOC_DIR)/$(ARCH)/*/Kconfig.defconfig"
source "boards/Kconfig" source "boards/Kconfig"
source "soc/Kconfig" source "$(SOC_DIR)/Kconfig"
source "arch/Kconfig" source "arch/Kconfig"

View file

@ -195,8 +195,11 @@ set(CACHED_BOARD ${BOARD} CACHE STRING "Selected board")
if(NOT BOARD_ROOT) if(NOT BOARD_ROOT)
set(BOARD_ROOT ${ZEPHYR_BASE}) set(BOARD_ROOT ${ZEPHYR_BASE})
endif() endif()
if(NOT SOC_ROOT) if(NOT SOC_ROOT)
set(SOC_ROOT ${ZEPHYR_BASE}) set(SOC_DIR ${ZEPHYR_BASE}/soc)
else()
set(SOC_DIR ${SOC_ROOT}/soc)
endif() endif()
find_path(BOARD_DIR NAMES "${BOARD}_defconfig" PATHS ${BOARD_ROOT}/boards/*/* NO_DEFAULT_PATH) find_path(BOARD_DIR NAMES "${BOARD}_defconfig" PATHS ${BOARD_ROOT}/boards/*/* NO_DEFAULT_PATH)

View file

@ -90,7 +90,7 @@ if(CONFIG_HAS_DTS)
if(EXISTS ${DTS_BOARD_FIXUP_FILE}) if(EXISTS ${DTS_BOARD_FIXUP_FILE})
set(DTS_BOARD_FIXUP ${DTS_BOARD_FIXUP_FILE}) set(DTS_BOARD_FIXUP ${DTS_BOARD_FIXUP_FILE})
endif() endif()
set_ifndef(DTS_SOC_FIXUP_FILE ${ZEPHYR_BASE}/soc/${ARCH}/${SOC_PATH}/dts.fixup) set_ifndef(DTS_SOC_FIXUP_FILE ${SOC_DIR}/${ARCH}/${SOC_PATH}/dts.fixup)
if(EXISTS ${DTS_SOC_FIXUP_FILE}) if(EXISTS ${DTS_SOC_FIXUP_FILE})
set(DTS_SOC_FIXUP ${DTS_SOC_FIXUP_FILE}) set(DTS_SOC_FIXUP ${DTS_SOC_FIXUP_FILE})
endif() endif()

View file

@ -22,6 +22,7 @@ set(ENV{KCONFIG_AUTOHEADER} ${AUTOCONF_H})
# files for other architectures # files for other architectures
set(ENV{ARCH} ${ARCH}) set(ENV{ARCH} ${ARCH})
set(ENV{BOARD_DIR} ${BOARD_DIR}) set(ENV{BOARD_DIR} ${BOARD_DIR})
set(ENV{SOC_DIR} ${SOC_DIR})
add_custom_target( add_custom_target(
menuconfig menuconfig

View file

@ -117,6 +117,7 @@ add_custom_target(
srctree=${ZEPHYR_BASE} srctree=${ZEPHYR_BASE}
BOARD_DIR=boards/*/*/ BOARD_DIR=boards/*/*/
ARCH=* ARCH=*
SOC_DIR=soc/
KERNELVERSION=${PROJECT_VERSION} KERNELVERSION=${PROJECT_VERSION}
SRCARCH=x86 SRCARCH=x86
${PYTHON_EXECUTABLE} scripts/genrest.py Kconfig ${RST_OUT}/doc/reference/kconfig/ ${PYTHON_EXECUTABLE} scripts/genrest.py Kconfig ${RST_OUT}/doc/reference/kconfig/

View file

@ -2,11 +2,11 @@
choice choice
prompt "SoC/CPU/Configuration Selection" prompt "SoC/CPU/Configuration Selection"
source "soc/$ENV_VAR_ARCH/*/Kconfig.soc" source "$(SOC_DIR)/$(ARCH)/*/Kconfig.soc"
endchoice endchoice
menu "Hardware Configuration" menu "Hardware Configuration"
osource "soc/$ENV_VAR_ARCH/*/Kconfig" osource "$(SOC_DIR)/$(ARCH)/*/Kconfig"
endmenu endmenu