Skip to content

Commit

Permalink
Build: Added support for out-of-tree Arch
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
kapedev authored and nashif committed Feb 7, 2019
1 parent 9f1acfe commit c66cb76
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ zephyr_library_named(zephyr)

zephyr_include_directories(
kernel/include
arch/${ARCH}/include
${ARCH_DIR}/${ARCH}/include
include
include/drivers
${PROJECT_BINARY_DIR}/include/generated
Expand Down Expand Up @@ -690,7 +690,7 @@ gen_kobj(KOBJ_INCLUDE_PATH)

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)

add_library( ${OFFSETS_LIB} OBJECT ${OFFSETS_C_PATH})
Expand Down
2 changes: 1 addition & 1 deletion arch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_definitions(-D__ZEPHYR_SUPERVISOR__)

add_subdirectory(common)
add_subdirectory(${ARCH})
add_subdirectory(${ARCH_DIR}/${ARCH} arch/${ARCH})
2 changes: 1 addition & 1 deletion arch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# overriden (by defining symbols in multiple locations)

# Note: $ARCH might be a glob pattern
source "arch/$(ARCH)/Kconfig"
source "$(ARCH_DIR)/$(ARCH)/Kconfig"

choice
prompt "Architecture"
Expand Down
6 changes: 6 additions & 0 deletions cmake/app/boilerplate.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,12 @@ else()
set(SOC_DIR ${SOC_ROOT}/soc)
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.
# 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.
Expand Down
2 changes: 2 additions & 0 deletions cmake/kconfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ set(ENV{ARCH} ${ARCH})
set(ENV{BOARD_DIR} ${BOARD_DIR})
set(ENV{SOC_DIR} ${SOC_DIR})
set(ENV{PROJECT_BINARY_DIR} ${PROJECT_BINARY_DIR})
set(ENV{ARCH_DIR} ${ARCH_DIR})

add_custom_target(
menuconfig
Expand All @@ -43,6 +44,7 @@ add_custom_target(
SOC_DIR=$ENV{SOC_DIR}
PROJECT_BINARY_DIR=$ENV{PROJECT_BINARY_DIR}
ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT}
ARCH_DIR=$ENV{ARCH_DIR}
${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/kconfig/menuconfig.py ${KCONFIG_ROOT}
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig
USES_TERMINAL
Expand Down
1 change: 1 addition & 0 deletions doc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ add_custom_target(
KERNELVERSION=${KERNELVERSION}
BOARD_DIR=boards/*/*/
ARCH=*
ARCH_DIR=arch/
SOC_DIR=soc/
SRCARCH=x86
KCONFIG_TURBO_MODE=${KCONFIG_TURBO_MODE}
Expand Down

0 comments on commit c66cb76

Please sign in to comment.