Skip to content

Commit

Permalink
build: support out of tree SoC definition
Browse files Browse the repository at this point in the history
Add the glue to make this work with SoC code outside of the tree.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
  • Loading branch information
nashif committed Sep 13, 2018
1 parent abcf2ad commit 96455d5
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 12 deletions.
12 changes: 6 additions & 6 deletions CMakeLists.txt
Expand Up @@ -50,9 +50,9 @@ zephyr_library_named(zephyr)
zephyr_include_directories(
kernel/include
arch/${ARCH}/include
soc/${ARCH}/${SOC_PATH}
soc/${ARCH}/${SOC_PATH}/include
soc/${ARCH}/${SOC_FAMILY}/include
${SOC_DIR}/${ARCH}/${SOC_PATH}
${SOC_DIR}/${ARCH}/${SOC_PATH}/include
${SOC_DIR}/${ARCH}/${SOC_FAMILY}/include
${BOARD_DIR}
include
include/drivers
Expand Down Expand Up @@ -295,7 +295,7 @@ else()
set(LINKER_SCRIPT ${BOARD_DIR}/linker.ld)
if(NOT EXISTS ${LINKER_SCRIPT})
# 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()

Expand Down Expand Up @@ -337,9 +337,9 @@ add_subdirectory(misc)
include(misc/generated/CMakeLists.txt)

if(EXISTS soc/${ARCH}/CMakeLists.txt)
add_subdirectory(soc/${ARCH})
add_subdirectory(${SOC_DIR}/${ARCH} soc/${ARCH})
else()
add_subdirectory(soc/${ARCH}/${SOC_PATH})
add_subdirectory(${SOC_DIR}/${ARCH}/${SOC_PATH} soc/${ARCH}/${SOC_PATH})
endif()

add_subdirectory(boards)
Expand Down
4 changes: 2 additions & 2 deletions Kconfig.zephyr
Expand Up @@ -18,11 +18,11 @@
# Note: $ARCH and $BOARD_DIR might be glob patterns.
source "$(BOARD_DIR)/Kconfig.defconfig"

source "soc/$(ARCH)/*/Kconfig.defconfig"
source "$(SOC_DIR)/$(ARCH)/*/Kconfig.defconfig"

source "boards/Kconfig"

source "soc/Kconfig"
source "$(SOC_DIR)/Kconfig"

source "arch/Kconfig"

Expand Down
5 changes: 4 additions & 1 deletion cmake/app/boilerplate.cmake
Expand Up @@ -195,8 +195,11 @@ set(CACHED_BOARD ${BOARD} CACHE STRING "Selected board")
if(NOT BOARD_ROOT)
set(BOARD_ROOT ${ZEPHYR_BASE})
endif()

if(NOT SOC_ROOT)
set(SOC_ROOT ${ZEPHYR_BASE})
set(SOC_DIR ${ZEPHYR_BASE}/soc)
else()
set(SOC_DIR ${SOC_ROOT}/soc)
endif()

find_path(BOARD_DIR NAMES "${BOARD}_defconfig" PATHS ${BOARD_ROOT}/boards/*/* NO_DEFAULT_PATH)
Expand Down
2 changes: 1 addition & 1 deletion cmake/dts.cmake
Expand Up @@ -90,7 +90,7 @@ if(CONFIG_HAS_DTS)
if(EXISTS ${DTS_BOARD_FIXUP_FILE})
set(DTS_BOARD_FIXUP ${DTS_BOARD_FIXUP_FILE})
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})
set(DTS_SOC_FIXUP ${DTS_SOC_FIXUP_FILE})
endif()
Expand Down
1 change: 1 addition & 0 deletions cmake/kconfig.cmake
Expand Up @@ -22,6 +22,7 @@ set(ENV{KCONFIG_AUTOHEADER} ${AUTOCONF_H})
# files for other architectures
set(ENV{ARCH} ${ARCH})
set(ENV{BOARD_DIR} ${BOARD_DIR})
set(ENV{SOC_DIR} ${SOC_DIR})

add_custom_target(
menuconfig
Expand Down
1 change: 1 addition & 0 deletions doc/CMakeLists.txt
Expand Up @@ -117,6 +117,7 @@ add_custom_target(
srctree=${ZEPHYR_BASE}
BOARD_DIR=boards/*/*/
ARCH=*
SOC_DIR=soc/
KERNELVERSION=${PROJECT_VERSION}
SRCARCH=x86
${PYTHON_EXECUTABLE} scripts/genrest.py Kconfig ${RST_OUT}/doc/reference/kconfig/
Expand Down
4 changes: 2 additions & 2 deletions soc/Kconfig
Expand Up @@ -2,11 +2,11 @@
choice
prompt "SoC/CPU/Configuration Selection"

source "soc/$ENV_VAR_ARCH/*/Kconfig.soc"
source "$(SOC_DIR)/$(ARCH)/*/Kconfig.soc"

endchoice

menu "Hardware Configuration"
osource "soc/$ENV_VAR_ARCH/*/Kconfig"
osource "$(SOC_DIR)/$(ARCH)/*/Kconfig"

endmenu

0 comments on commit 96455d5

Please sign in to comment.