2019-04-06 15:08:09 +02:00
|
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
# This file must be included into the toplevel CMakeLists.txt file of
|
2020-03-12 23:34:12 +01:00
|
|
|
|
# Zephyr applications.
|
|
|
|
|
# Zephyr CMake package automatically includes this file when CMake function
|
|
|
|
|
# find_package() is used.
|
2017-10-27 15:43:34 +02:00
|
|
|
|
#
|
2020-03-12 23:34:12 +01:00
|
|
|
|
# To ensure this file is loaded in a Zephyr application it must start with
|
|
|
|
|
# one of those lines:
|
|
|
|
|
#
|
|
|
|
|
# find_package(Zephyr)
|
2020-05-29 22:17:26 +02:00
|
|
|
|
# find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
|
2020-03-12 23:34:12 +01:00
|
|
|
|
#
|
2020-05-29 22:17:26 +02:00
|
|
|
|
# The `REQUIRED HINTS $ENV{ZEPHYR_BASE}` variant is required for any application
|
|
|
|
|
# inside the Zephyr repository.
|
2017-10-27 15:43:34 +02:00
|
|
|
|
#
|
|
|
|
|
# It exists to reduce boilerplate code that Zephyr expects to be in
|
|
|
|
|
# application CMakeLists.txt code.
|
2018-12-11 16:33:23 +01:00
|
|
|
|
|
|
|
|
|
# CMake version 3.13.1 is the real minimum supported version.
|
2018-08-03 09:36:52 +02:00
|
|
|
|
#
|
|
|
|
|
# Unfortunately CMake requires the toplevel CMakeLists.txt file to
|
|
|
|
|
# define the required version, not even invoking it from an included
|
|
|
|
|
# file, like boilerplate.cmake, is sufficient. It is however permitted
|
|
|
|
|
# to have multiple invocations of cmake_minimum_required.
|
|
|
|
|
#
|
|
|
|
|
# Under these restraints we use a second 'cmake_minimum_required'
|
|
|
|
|
# invocation in every toplevel CMakeLists.txt.
|
2018-12-11 16:33:23 +01:00
|
|
|
|
cmake_minimum_required(VERSION 3.13.1)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2018-12-19 16:01:05 +01:00
|
|
|
|
# CMP0002: "Logical target names must be globally unique"
|
2017-10-27 15:43:34 +02:00
|
|
|
|
cmake_policy(SET CMP0002 NEW)
|
|
|
|
|
|
2019-02-27 08:56:35 +01:00
|
|
|
|
# Use the old CMake behaviour until the build scripts have been ported
|
|
|
|
|
# to the new behaviour.
|
|
|
|
|
# CMP0079: "target_link_libraries() allows use with targets in other directories"
|
|
|
|
|
cmake_policy(SET CMP0079 OLD)
|
2018-12-05 12:19:29 +01:00
|
|
|
|
|
2017-12-18 13:02:19 +01:00
|
|
|
|
define_property(GLOBAL PROPERTY ZEPHYR_LIBS
|
|
|
|
|
BRIEF_DOCS "Global list of all Zephyr CMake libs that should be linked in"
|
|
|
|
|
FULL_DOCS "Global list of all Zephyr CMake libs that should be linked in.
|
|
|
|
|
zephyr_library() appends libs to this list.")
|
|
|
|
|
set_property(GLOBAL PROPERTY ZEPHYR_LIBS "")
|
|
|
|
|
|
2017-12-27 16:08:06 +01:00
|
|
|
|
define_property(GLOBAL PROPERTY ZEPHYR_INTERFACE_LIBS
|
|
|
|
|
BRIEF_DOCS "Global list of all Zephyr interface libs that should be linked in."
|
|
|
|
|
FULL_DOCS "Global list of all Zephyr interface libs that should be linked in.
|
|
|
|
|
zephyr_interface_library_named() appends libs to this list.")
|
|
|
|
|
set_property(GLOBAL PROPERTY ZEPHYR_INTERFACE_LIBS "")
|
|
|
|
|
|
2017-12-18 13:02:19 +01:00
|
|
|
|
define_property(GLOBAL PROPERTY GENERATED_KERNEL_OBJECT_FILES
|
|
|
|
|
BRIEF_DOCS "Object files that are generated after Zephyr has been linked once."
|
|
|
|
|
FULL_DOCS "\
|
|
|
|
|
Object files that are generated after Zephyr has been linked once.\
|
|
|
|
|
May include mmu tables, etc."
|
|
|
|
|
)
|
|
|
|
|
set_property(GLOBAL PROPERTY GENERATED_KERNEL_OBJECT_FILES "")
|
|
|
|
|
|
|
|
|
|
define_property(GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES
|
|
|
|
|
BRIEF_DOCS "Source files that are generated after Zephyr has been linked once."
|
|
|
|
|
FULL_DOCS "\
|
2018-10-15 11:43:24 +02:00
|
|
|
|
Source files that are generated after Zephyr has been linked once.\
|
2017-12-18 13:02:19 +01:00
|
|
|
|
May include isr_tables.c etc."
|
|
|
|
|
)
|
|
|
|
|
set_property(GLOBAL PROPERTY GENERATED_KERNEL_SOURCE_FILES "")
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
set(APPLICATION_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH "Application Source Directory")
|
|
|
|
|
set(APPLICATION_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Application Binary Directory")
|
|
|
|
|
|
|
|
|
|
set(__build_dir ${CMAKE_CURRENT_BINARY_DIR}/zephyr)
|
|
|
|
|
|
|
|
|
|
set(PROJECT_BINARY_DIR ${__build_dir})
|
2018-06-14 20:21:18 +02:00
|
|
|
|
|
2020-11-26 22:02:19 +01:00
|
|
|
|
if(${CMAKE_VERSION} VERSION_EQUAL 3.19.0 OR
|
|
|
|
|
${CMAKE_VERSION} VERSION_EQUAL 3.19.1)
|
|
|
|
|
message(WARNING "CMake 3.19.0/3.19.1 contains a bug regarding Toolchain/compiler "
|
|
|
|
|
"testing. Consider switching to a different CMake version.\n"
|
|
|
|
|
"See more here: \n"
|
|
|
|
|
"- https://github.com/zephyrproject-rtos/zephyr/issues/30232\n"
|
|
|
|
|
"- https://gitlab.kitware.com/cmake/cmake/-/issues/21497")
|
|
|
|
|
# This is a workaround for #30232.
|
|
|
|
|
# During Zephyr CMake invocation a plain C compiler is used for DTS.
|
|
|
|
|
# This results in the internal `CheckCompilerFlag.cmake` being included by CMake
|
|
|
|
|
# Later, when the full toolchain is configured, then `CMakeCheckCompilerFlag.cmake` is included.
|
|
|
|
|
# This overloads the `cmake_check_compiler_flag()` function, thus causing #30232.
|
|
|
|
|
# By manualy loading `CMakeCheckCompilerFlag.cmake` then `CheckCompilerFlag.cmake` will overload
|
|
|
|
|
# the functions (and thus win the battle), and because `include_guard(GLOBAL)` is used in
|
|
|
|
|
# `CMakeCheckCompilerFlag.cmake` this file will not be re-included later.
|
|
|
|
|
include(${CMAKE_ROOT}/Modules/Internal/CMakeCheckCompilerFlag.cmake)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-03-05 23:20:18 +01:00
|
|
|
|
message(STATUS "Application: ${APPLICATION_SOURCE_DIR}")
|
|
|
|
|
|
2018-11-13 11:04:02 +01:00
|
|
|
|
add_custom_target(code_data_relocation_target)
|
|
|
|
|
|
2020-08-25 00:00:35 +02:00
|
|
|
|
# The zephyr/runners.yaml file in the build directory is used to
|
|
|
|
|
# configure the scripts/west_commands/runners Python package used
|
|
|
|
|
# by 'west flash', 'west debug', etc.
|
|
|
|
|
#
|
|
|
|
|
# This is a helper target for setting property:value pairs related to
|
|
|
|
|
# this file:
|
|
|
|
|
#
|
|
|
|
|
# Property Description
|
|
|
|
|
# -------------- --------------------------------------------------
|
|
|
|
|
# bin_file "zephyr.bin" file for flashing
|
|
|
|
|
# hex_file "zephyr.hex" file for flashing
|
|
|
|
|
# elf_file "zephyr.elf" file for flashing or debugging
|
|
|
|
|
# yaml_contents generated contents of runners.yaml
|
|
|
|
|
#
|
|
|
|
|
# Note: there are quotes around "zephyr.bin" etc. because the actual
|
|
|
|
|
# paths can be changed, e.g. to flash signed versions of these files
|
|
|
|
|
# for consumption by bootloaders such as MCUboot.
|
|
|
|
|
#
|
|
|
|
|
# See cmake/flash/CMakeLists.txt for more details.
|
|
|
|
|
add_custom_target(runners_yaml_props_target)
|
|
|
|
|
|
2018-06-14 20:21:18 +02:00
|
|
|
|
# CMake's 'project' concept has proven to not be very useful for Zephyr
|
|
|
|
|
# due in part to how Zephyr is organized and in part to it not fitting well
|
|
|
|
|
# with cross compilation.
|
2018-12-19 10:40:57 +01:00
|
|
|
|
# Zephyr therefore tries to rely as little as possible on project()
|
2018-06-14 20:21:18 +02:00
|
|
|
|
# and its associated variables, e.g. PROJECT_SOURCE_DIR.
|
|
|
|
|
# It is recommended to always use ZEPHYR_BASE instead of PROJECT_SOURCE_DIR
|
|
|
|
|
# when trying to reference ENV${ZEPHYR_BASE}.
|
2019-06-01 00:37:40 +02:00
|
|
|
|
|
2020-02-12 15:42:09 +01:00
|
|
|
|
set(ENV_ZEPHYR_BASE $ENV{ZEPHYR_BASE})
|
|
|
|
|
# This add support for old style boilerplate include.
|
|
|
|
|
if((NOT DEFINED ZEPHYR_BASE) AND (DEFINED ENV_ZEPHYR_BASE))
|
|
|
|
|
set(ZEPHYR_BASE ${ENV_ZEPHYR_BASE} CACHE PATH "Zephyr base")
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-05-13 23:05:28 +02:00
|
|
|
|
find_package(ZephyrBuildConfiguration NAMES ZephyrBuild PATHS ${ZEPHYR_BASE}/../* QUIET NO_DEFAULT_PATH NO_POLICY_SCOPE)
|
|
|
|
|
|
2019-06-01 00:37:40 +02:00
|
|
|
|
# Note any later project() resets PROJECT_SOURCE_DIR
|
2020-02-12 15:42:09 +01:00
|
|
|
|
file(TO_CMAKE_PATH "${ZEPHYR_BASE}" PROJECT_SOURCE_DIR)
|
2019-04-12 12:17:14 +02:00
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
set(ZEPHYR_BINARY_DIR ${PROJECT_BINARY_DIR})
|
|
|
|
|
|
|
|
|
|
set(AUTOCONF_H ${__build_dir}/include/generated/autoconf.h)
|
|
|
|
|
# Re-configure (Re-execute all CMakeLists.txt code) when autoconf.h changes
|
|
|
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${AUTOCONF_H})
|
|
|
|
|
|
|
|
|
|
|
2018-11-26 23:39:51 +01:00
|
|
|
|
#
|
|
|
|
|
# Import more CMake functions and macros
|
|
|
|
|
#
|
2018-11-12 15:57:19 +01:00
|
|
|
|
|
2018-11-26 23:19:26 +01:00
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
|
include(CheckCXXCompilerFlag)
|
2018-11-12 15:57:19 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/extensions.cmake)
|
2018-11-26 23:39:51 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/version.cmake) # depends on hex.cmake
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
|
# Find tools
|
|
|
|
|
#
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2018-11-26 23:39:51 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/python.cmake)
|
2020-07-07 17:29:56 +02:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/west.cmake)
|
2018-11-26 23:39:51 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/git.cmake) # depends on version.cmake
|
2018-02-26 13:49:54 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/ccache.cmake)
|
|
|
|
|
|
2020-12-12 20:13:17 +01:00
|
|
|
|
if(ZEPHYR_EXTRA_MODULES)
|
|
|
|
|
# ZEPHYR_EXTRA_MODULES has either been specified on the cmake CLI or is
|
|
|
|
|
# already in the CMakeCache.txt. This has precedence over the environment
|
|
|
|
|
# variable ZEPHYR_EXTRA_MODULES
|
|
|
|
|
elseif(DEFINED ENV{ZEPHYR_EXTRA_MODULES})
|
|
|
|
|
set(ZEPHYR_EXTRA_MODULES $ENV{ZEPHYR_EXTRA_MODULES})
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-07-07 17:29:56 +02:00
|
|
|
|
#
|
|
|
|
|
# Find Zephyr modules.
|
|
|
|
|
# Those may contain additional DTS, BOARD, SOC, ARCH ROOTs.
|
|
|
|
|
# Also create the Kconfig binary dir for generated Kconf files.
|
|
|
|
|
#
|
|
|
|
|
set(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig)
|
|
|
|
|
file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR})
|
|
|
|
|
include(${ZEPHYR_BASE}/cmake/zephyr_module.cmake)
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
|
message(FATAL_ERROR "Source directory equals build directory.\
|
|
|
|
|
In-source builds are not supported.\
|
|
|
|
|
Please specify a build directory, e.g. cmake -Bbuild -H.")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
add_custom_target(
|
|
|
|
|
pristine
|
2018-01-11 15:46:44 +01:00
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${ZEPHYR_BASE}/cmake/pristine.cmake
|
2017-10-27 15:43:34 +02:00
|
|
|
|
# Equivalent to rm -rf build/*
|
|
|
|
|
)
|
|
|
|
|
|
2019-03-06 17:28:05 +01:00
|
|
|
|
# Dummy add to generate files.
|
|
|
|
|
zephyr_linker_sources(SECTIONS)
|
|
|
|
|
|
2020-11-10 13:42:32 +01:00
|
|
|
|
# Check that BOARD has been provided, and that it has not changed.
|
|
|
|
|
zephyr_check_cache(BOARD REQUIRED)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2020-11-10 13:57:24 +01:00
|
|
|
|
set(BOARD_MESSAGE "Board: ${BOARD}")
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2020-04-04 15:29:30 +02:00
|
|
|
|
if(DEFINED ENV{ZEPHYR_BOARD_ALIASES})
|
|
|
|
|
include($ENV{ZEPHYR_BOARD_ALIASES})
|
|
|
|
|
if(${BOARD}_BOARD_ALIAS)
|
|
|
|
|
set(BOARD_ALIAS ${BOARD} CACHE STRING "Board alias, provided by user")
|
|
|
|
|
set(BOARD ${${BOARD}_BOARD_ALIAS})
|
|
|
|
|
message(STATUS "Aliased BOARD=${BOARD_ALIAS} changed to ${BOARD}")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2020-03-16 15:36:52 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/boards/deprecated.cmake)
|
|
|
|
|
if(${BOARD}_DEPRECATED)
|
|
|
|
|
set(BOARD_DEPRECATED ${BOARD} CACHE STRING "Deprecated board name, provided by user")
|
|
|
|
|
set(BOARD ${${BOARD}_DEPRECATED})
|
|
|
|
|
message(WARNING "Deprecated BOARD=${BOARD_DEPRECATED} name specified, board automatically changed to: ${BOARD}.")
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-11-10 13:42:32 +01:00
|
|
|
|
# Check that SHIELD has not changed.
|
|
|
|
|
zephyr_check_cache(SHIELD)
|
2019-01-14 16:11:15 +01:00
|
|
|
|
|
2020-11-10 13:57:24 +01:00
|
|
|
|
if(SHIELD)
|
|
|
|
|
set(BOARD_MESSAGE "${BOARD_MESSAGE}, Shield(s): ${SHIELD}")
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
message(STATUS "${BOARD_MESSAGE}")
|
|
|
|
|
|
2018-09-27 18:10:22 +02:00
|
|
|
|
# 'BOARD_ROOT' is a prioritized list of directories where boards may
|
|
|
|
|
# be found. It always includes ${ZEPHYR_BASE} at the lowest priority.
|
cmake: ensure consistent behavior between x_ROOT settings
Fixes: #23825
Today, BOARD, SOC, ARCH, DTS, KCONFIG, and TOOLCHAIN_ROOT can be
specified by users or through other CMake files.
It is not clear if relative paths are permitted and/or from where a
relative path is constructed.
Inside CMake, it is very easy to specify `${ZEPHYR_BASE}`,
`${CMAKE_CURRENT_SOURCE_DIR}`, or similar, thus there is no reason to
use relative path inside CMake, as it easy can lead to discussion on
relative to what.
For users manually invoking CMake using, `cmake ... <app-dir>` it is
nice to have to possibility to specify a relative path.
For this purpose, relative path are considered relative to the
`APPLICATION_SOURCE_DIR`.
This commit updates:
- BOARD_ROOT
- SOC_ROOT
- ARCH_ROOT
- DTS_ROOT
- KCONFIG_ROOT
- TOOLCHAIN_ROOT
to allow paths relative to `APPLICATION_SOURCE_DIR` when specified with
`-D<type>_ROOT=<relative-path>`
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-09-08 14:07:00 +02:00
|
|
|
|
zephyr_file(APPLICATION_ROOT BOARD_ROOT)
|
2018-09-27 18:10:22 +02:00
|
|
|
|
list(APPEND BOARD_ROOT ${ZEPHYR_BASE})
|
2018-09-04 21:34:06 +02:00
|
|
|
|
|
2020-07-06 12:53:39 +02:00
|
|
|
|
# 'SOC_ROOT' is a prioritized list of directories where socs may be
|
|
|
|
|
# found. It always includes ${ZEPHYR_BASE}/soc at the lowest priority.
|
cmake: ensure consistent behavior between x_ROOT settings
Fixes: #23825
Today, BOARD, SOC, ARCH, DTS, KCONFIG, and TOOLCHAIN_ROOT can be
specified by users or through other CMake files.
It is not clear if relative paths are permitted and/or from where a
relative path is constructed.
Inside CMake, it is very easy to specify `${ZEPHYR_BASE}`,
`${CMAKE_CURRENT_SOURCE_DIR}`, or similar, thus there is no reason to
use relative path inside CMake, as it easy can lead to discussion on
relative to what.
For users manually invoking CMake using, `cmake ... <app-dir>` it is
nice to have to possibility to specify a relative path.
For this purpose, relative path are considered relative to the
`APPLICATION_SOURCE_DIR`.
This commit updates:
- BOARD_ROOT
- SOC_ROOT
- ARCH_ROOT
- DTS_ROOT
- KCONFIG_ROOT
- TOOLCHAIN_ROOT
to allow paths relative to `APPLICATION_SOURCE_DIR` when specified with
`-D<type>_ROOT=<relative-path>`
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-09-08 14:07:00 +02:00
|
|
|
|
zephyr_file(APPLICATION_ROOT SOC_ROOT)
|
2020-07-06 12:53:39 +02:00
|
|
|
|
list(APPEND SOC_ROOT ${ZEPHYR_BASE})
|
2018-02-12 05:30:57 +01:00
|
|
|
|
|
2020-07-07 08:58:14 +02:00
|
|
|
|
# 'ARCH_ROOT' is a prioritized list of directories where archs may be
|
|
|
|
|
# found. It always includes ${ZEPHYR_BASE} at the lowest priority.
|
cmake: ensure consistent behavior between x_ROOT settings
Fixes: #23825
Today, BOARD, SOC, ARCH, DTS, KCONFIG, and TOOLCHAIN_ROOT can be
specified by users or through other CMake files.
It is not clear if relative paths are permitted and/or from where a
relative path is constructed.
Inside CMake, it is very easy to specify `${ZEPHYR_BASE}`,
`${CMAKE_CURRENT_SOURCE_DIR}`, or similar, thus there is no reason to
use relative path inside CMake, as it easy can lead to discussion on
relative to what.
For users manually invoking CMake using, `cmake ... <app-dir>` it is
nice to have to possibility to specify a relative path.
For this purpose, relative path are considered relative to the
`APPLICATION_SOURCE_DIR`.
This commit updates:
- BOARD_ROOT
- SOC_ROOT
- ARCH_ROOT
- DTS_ROOT
- KCONFIG_ROOT
- TOOLCHAIN_ROOT
to allow paths relative to `APPLICATION_SOURCE_DIR` when specified with
`-D<type>_ROOT=<relative-path>`
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-09-08 14:07:00 +02:00
|
|
|
|
zephyr_file(APPLICATION_ROOT ARCH_ROOT)
|
2020-07-07 08:58:14 +02:00
|
|
|
|
list(APPEND ARCH_ROOT ${ZEPHYR_BASE})
|
2018-11-15 10:37:46 +01:00
|
|
|
|
|
2020-05-28 18:06:27 +02:00
|
|
|
|
if(DEFINED SHIELD)
|
|
|
|
|
string(REPLACE " " ";" SHIELD_AS_LIST "${SHIELD}")
|
|
|
|
|
endif()
|
|
|
|
|
# SHIELD-NOTFOUND is a real CMake list, from which valid shields can be popped.
|
|
|
|
|
# After processing all shields, only invalid shields will be left in this list.
|
|
|
|
|
set(SHIELD-NOTFOUND ${SHIELD_AS_LIST})
|
|
|
|
|
|
2018-09-27 18:10:22 +02:00
|
|
|
|
# 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.
|
|
|
|
|
foreach(root ${BOARD_ROOT})
|
|
|
|
|
# NB: find_path will return immediately if the output variable is
|
|
|
|
|
# already set
|
2020-04-07 15:43:31 +02:00
|
|
|
|
if (BOARD_ALIAS)
|
|
|
|
|
find_path(BOARD_HIDDEN_DIR
|
|
|
|
|
NAMES ${BOARD_ALIAS}_defconfig
|
|
|
|
|
PATHS ${root}/boards/*/*
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
|
|
|
|
if(BOARD_HIDDEN_DIR)
|
|
|
|
|
message("Board alias ${BOARD_ALIAS} is hiding the real board of same name")
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
2018-09-27 18:10:22 +02:00
|
|
|
|
find_path(BOARD_DIR
|
2018-12-19 10:40:57 +01:00
|
|
|
|
NAMES ${BOARD}_defconfig
|
|
|
|
|
PATHS ${root}/boards/*/*
|
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
|
)
|
2018-09-27 18:10:22 +02:00
|
|
|
|
if(BOARD_DIR AND NOT (${root} STREQUAL ${ZEPHYR_BASE}))
|
2018-12-19 10:40:57 +01:00
|
|
|
|
set(USING_OUT_OF_TREE_BOARD 1)
|
2018-09-27 18:10:22 +02:00
|
|
|
|
endif()
|
2019-01-14 16:11:15 +01:00
|
|
|
|
|
|
|
|
|
set(shield_dir ${root}/boards/shields)
|
|
|
|
|
# Match the .overlay files in the shield directories to make sure we are
|
|
|
|
|
# finding shields, e.g. x_nucleo_iks01a1/x_nucleo_iks01a1.overlay
|
|
|
|
|
file(GLOB_RECURSE shields_refs_list
|
|
|
|
|
RELATIVE ${shield_dir}
|
|
|
|
|
${shield_dir}/*/*.overlay
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# The above gives a list like
|
|
|
|
|
# x_nucleo_iks01a1/x_nucleo_iks01a1.overlay;x_nucleo_iks01a2/x_nucleo_iks01a2.overlay
|
|
|
|
|
# we construct a list of shield names by extracting file name and
|
|
|
|
|
# removing the extension.
|
2020-05-28 18:51:17 +02:00
|
|
|
|
unset(SHIELD_LIST)
|
2019-01-14 16:11:15 +01:00
|
|
|
|
foreach(shield_path ${shields_refs_list})
|
|
|
|
|
get_filename_component(shield ${shield_path} NAME_WE)
|
|
|
|
|
list(APPEND SHIELD_LIST ${shield})
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
if(DEFINED SHIELD)
|
|
|
|
|
foreach(s ${SHIELD_AS_LIST})
|
|
|
|
|
list(FIND SHIELD_LIST ${s} _idx)
|
2020-03-19 16:45:53 +01:00
|
|
|
|
if (_idx EQUAL -1)
|
|
|
|
|
continue()
|
|
|
|
|
endif()
|
2019-01-14 16:11:15 +01:00
|
|
|
|
|
2020-05-28 18:06:27 +02:00
|
|
|
|
list(REMOVE_ITEM SHIELD-NOTFOUND ${s})
|
2020-03-19 16:45:53 +01:00
|
|
|
|
|
|
|
|
|
list(GET shields_refs_list ${_idx} s_path)
|
|
|
|
|
get_filename_component(s_dir ${s_path} DIRECTORY)
|
|
|
|
|
|
2020-11-05 15:24:13 +01:00
|
|
|
|
# if shield config flag is on, add shield overlay to the shield overlays
|
|
|
|
|
# list and dts_fixup file to the shield fixup file
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_dts_files
|
|
|
|
|
${shield_dir}/${s_path}
|
|
|
|
|
)
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_dts_fixups
|
|
|
|
|
${shield_dir}/${s_dir}/dts_fixup.h
|
|
|
|
|
)
|
|
|
|
|
|
2020-03-19 16:45:53 +01:00
|
|
|
|
# search for shield/boards/board.overlay file
|
|
|
|
|
if(EXISTS ${shield_dir}/${s_dir}/boards/${BOARD}.overlay)
|
|
|
|
|
# add shield/board overlay to the shield overlays list
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_dts_files
|
|
|
|
|
${shield_dir}/${s_dir}/boards/${BOARD}.overlay
|
2019-09-11 19:06:43 +02:00
|
|
|
|
)
|
2020-03-19 16:45:53 +01:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# search for shield/boards/shield/board.overlay file
|
|
|
|
|
if(EXISTS ${shield_dir}/${s_dir}/boards/${s}/${BOARD}.overlay)
|
|
|
|
|
# add shield/board overlay to the shield overlays list
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_dts_files
|
|
|
|
|
${shield_dir}/${s_dir}/boards/${s}/${BOARD}.overlay
|
2019-09-11 17:14:25 +02:00
|
|
|
|
)
|
2020-03-19 16:45:53 +01:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# search for shield/shield.conf file
|
|
|
|
|
if(EXISTS ${shield_dir}/${s_dir}/${s}.conf)
|
|
|
|
|
# add shield.conf to the shield config list
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_conf_files
|
|
|
|
|
${shield_dir}/${s_dir}/${s}.conf
|
2019-09-11 19:06:43 +02:00
|
|
|
|
)
|
2020-03-19 16:45:53 +01:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# search for shield/boards/board.conf file
|
|
|
|
|
if(EXISTS ${shield_dir}/${s_dir}/boards/${BOARD}.conf)
|
|
|
|
|
# add HW specific board.conf to the shield config list
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_conf_files
|
|
|
|
|
${shield_dir}/${s_dir}/boards/${BOARD}.conf
|
2019-09-11 19:06:43 +02:00
|
|
|
|
)
|
2020-03-19 16:45:53 +01:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# search for shield/boards/shield/board.conf file
|
|
|
|
|
if(EXISTS ${shield_dir}/${s_dir}/boards/${s}/${BOARD}.conf)
|
|
|
|
|
# add HW specific board.conf to the shield config list
|
|
|
|
|
list(APPEND
|
|
|
|
|
shield_conf_files
|
|
|
|
|
${shield_dir}/${s_dir}/boards/${s}/${BOARD}.conf
|
2019-09-11 17:14:25 +02:00
|
|
|
|
)
|
2019-01-14 16:11:15 +01:00
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
endif()
|
2018-09-27 18:10:22 +02:00
|
|
|
|
endforeach()
|
2017-12-06 13:56:12 +01:00
|
|
|
|
|
2018-11-19 11:56:19 +01:00
|
|
|
|
if(NOT BOARD_DIR)
|
|
|
|
|
message("No board named '${BOARD}' found")
|
|
|
|
|
print_usage()
|
|
|
|
|
unset(CACHED_BOARD CACHE)
|
|
|
|
|
message(FATAL_ERROR "Invalid usage")
|
|
|
|
|
endif()
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2020-05-28 18:06:27 +02:00
|
|
|
|
if(DEFINED SHIELD AND NOT (SHIELD-NOTFOUND STREQUAL ""))
|
|
|
|
|
foreach (s ${SHIELD-NOTFOUND})
|
2019-01-14 16:11:15 +01:00
|
|
|
|
message("No shield named '${s}' found")
|
|
|
|
|
endforeach()
|
|
|
|
|
print_usage()
|
|
|
|
|
unset(CACHED_SHIELD CACHE)
|
|
|
|
|
message(FATAL_ERROR "Invalid usage")
|
|
|
|
|
endif()
|
|
|
|
|
|
2018-12-19 10:40:57 +01:00
|
|
|
|
get_filename_component(BOARD_ARCH_DIR ${BOARD_DIR} DIRECTORY)
|
2018-09-27 17:15:24 +02:00
|
|
|
|
get_filename_component(ARCH ${BOARD_ARCH_DIR} NAME)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2020-07-07 08:58:14 +02:00
|
|
|
|
foreach(root ${ARCH_ROOT})
|
|
|
|
|
if(EXISTS ${root}/arch/${ARCH}/CMakeLists.txt)
|
|
|
|
|
set(ARCH_DIR ${root}/arch)
|
|
|
|
|
break()
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
if(NOT ARCH_DIR)
|
|
|
|
|
message(FATAL_ERROR "Could not find ARCH=${ARCH} for BOARD=${BOARD}, \
|
|
|
|
|
please check your installation. ARCH roots searched: \n\
|
|
|
|
|
${ARCH_ROOT}")
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-09-07 21:57:46 +02:00
|
|
|
|
if(DEFINED CONF_FILE)
|
|
|
|
|
# This ensures that CACHE{CONF_FILE} will be set correctly to current scope
|
|
|
|
|
# variable CONF_FILE. An already current scope variable will stay the same.
|
|
|
|
|
set(CONF_FILE ${CONF_FILE})
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
# CONF_FILE has either been specified on the cmake CLI or is already
|
|
|
|
|
# in the CMakeCache.txt. This has precedence over the environment
|
|
|
|
|
# variable CONF_FILE and the default prj.conf
|
2020-09-03 23:39:02 +02:00
|
|
|
|
|
|
|
|
|
# In order to support a `prj_<name>.conf pattern for auto inclusion of board
|
|
|
|
|
# overlays, then we must first ensure only a single conf file is provided.
|
|
|
|
|
string(REPLACE " " ";" CONF_FILE_AS_LIST "${CONF_FILE}")
|
|
|
|
|
list(LENGTH CONF_FILE_AS_LIST CONF_FILE_LENGTH)
|
|
|
|
|
if(${CONF_FILE_LENGTH} EQUAL 1)
|
|
|
|
|
# Need the file name to look for match.
|
|
|
|
|
# Need path in order to check if it is absolute.
|
|
|
|
|
get_filename_component(CONF_FILE_NAME ${CONF_FILE} NAME)
|
|
|
|
|
get_filename_component(CONF_FILE_DIR ${CONF_FILE} DIRECTORY)
|
2020-11-11 15:55:56 +01:00
|
|
|
|
if(${CONF_FILE_NAME} MATCHES "prj_(.*).conf")
|
2020-09-03 23:39:02 +02:00
|
|
|
|
if(NOT IS_ABSOLUTE ${CONF_FILE_DIR})
|
|
|
|
|
set(CONF_FILE_DIR ${APPLICATION_SOURCE_DIR}/${CONF_FILE_DIR})
|
|
|
|
|
endif()
|
|
|
|
|
if(EXISTS ${CONF_FILE_DIR}/boards/${BOARD}_${CMAKE_MATCH_1}.conf)
|
|
|
|
|
list(APPEND CONF_FILE ${CONF_FILE_DIR}/boards/${BOARD}_${CMAKE_MATCH_1}.conf)
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
elseif(CACHED_CONF_FILE)
|
|
|
|
|
# Cached conf file is present.
|
|
|
|
|
# That value has precedence over anything else than a new
|
|
|
|
|
# `cmake -DCONF_FILE=<file>` invocation.
|
|
|
|
|
set(CONF_FILE ${CACHED_CONF_FILE})
|
2017-10-27 15:43:34 +02:00
|
|
|
|
elseif(DEFINED ENV{CONF_FILE})
|
|
|
|
|
set(CONF_FILE $ENV{CONF_FILE})
|
|
|
|
|
|
|
|
|
|
elseif(COMMAND set_conf_file)
|
2019-02-28 14:53:48 +01:00
|
|
|
|
message(WARNING "'set_conf_file' is deprecated, it will be removed in a future release.")
|
2017-10-27 15:43:34 +02:00
|
|
|
|
set_conf_file()
|
|
|
|
|
|
|
|
|
|
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf)
|
|
|
|
|
set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj_${BOARD}.conf)
|
|
|
|
|
|
2019-02-28 14:53:48 +01:00
|
|
|
|
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
|
|
|
|
|
set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj.conf ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.conf)
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/prj.conf)
|
|
|
|
|
set(CONF_FILE ${APPLICATION_SOURCE_DIR}/prj.conf)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-09-03 23:39:02 +02:00
|
|
|
|
set(CACHED_CONF_FILE ${CONF_FILE} CACHE STRING "If desired, you can build the application using\
|
2017-10-27 15:43:34 +02:00
|
|
|
|
the configuration settings specified in an alternate .conf file using this parameter. \
|
|
|
|
|
These settings will override the settings in the application’s .config file or its default .conf file.\
|
2020-09-03 23:39:02 +02:00
|
|
|
|
Multiple files may be listed, e.g. CONF_FILE=\"prj1.confi;prj2.conf\" \
|
|
|
|
|
The CACHED_CONF_FILE is internal Zephyr variable used between CMake runs. \
|
|
|
|
|
To change CONF_FILE, use the CONF_FILE variable.")
|
|
|
|
|
unset(CONF_FILE CACHE)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2018-01-31 18:00:49 +01:00
|
|
|
|
if(DTC_OVERLAY_FILE)
|
|
|
|
|
# DTC_OVERLAY_FILE has either been specified on the cmake CLI or is already
|
|
|
|
|
# in the CMakeCache.txt. This has precedence over the environment
|
|
|
|
|
# variable DTC_OVERLAY_FILE
|
|
|
|
|
elseif(DEFINED ENV{DTC_OVERLAY_FILE})
|
|
|
|
|
set(DTC_OVERLAY_FILE $ENV{DTC_OVERLAY_FILE})
|
2019-09-24 14:16:27 +02:00
|
|
|
|
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.overlay)
|
|
|
|
|
set(DTC_OVERLAY_FILE ${APPLICATION_SOURCE_DIR}/boards/${BOARD}.overlay)
|
2018-01-31 18:00:49 +01:00
|
|
|
|
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/${BOARD}.overlay)
|
|
|
|
|
set(DTC_OVERLAY_FILE ${APPLICATION_SOURCE_DIR}/${BOARD}.overlay)
|
2019-06-15 13:21:13 +02:00
|
|
|
|
elseif(EXISTS ${APPLICATION_SOURCE_DIR}/app.overlay)
|
|
|
|
|
set(DTC_OVERLAY_FILE ${APPLICATION_SOURCE_DIR}/app.overlay)
|
2018-01-31 18:00:49 +01:00
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
set(DTC_OVERLAY_FILE ${DTC_OVERLAY_FILE} CACHE STRING "If desired, you can \
|
|
|
|
|
build the application using the DT configuration settings specified in an \
|
|
|
|
|
alternate .overlay file using this parameter. These settings will override the \
|
|
|
|
|
settings in the board's .dts file. Multiple files may be listed, e.g. \
|
|
|
|
|
DTC_OVERLAY_FILE=\"dts1.overlay dts2.overlay\"")
|
|
|
|
|
|
2020-08-18 14:47:53 +02:00
|
|
|
|
# Populate USER_CACHE_DIR with a directory that user applications may
|
|
|
|
|
# write cache files to.
|
|
|
|
|
if(NOT DEFINED USER_CACHE_DIR)
|
|
|
|
|
find_appropriate_cache_directory(USER_CACHE_DIR)
|
|
|
|
|
endif()
|
|
|
|
|
message(STATUS "Cache files will be written to: ${USER_CACHE_DIR}")
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
# Prevent CMake from testing the toolchain
|
|
|
|
|
set(CMAKE_C_COMPILER_FORCED 1)
|
|
|
|
|
set(CMAKE_CXX_COMPILER_FORCED 1)
|
|
|
|
|
|
2018-01-11 15:46:44 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/host-tools.cmake)
|
2018-12-13 16:32:07 +01:00
|
|
|
|
|
2019-11-20 10:36:13 +01:00
|
|
|
|
# Include board specific device-tree flags before parsing.
|
|
|
|
|
include(${BOARD_DIR}/pre_dt_board.cmake OPTIONAL)
|
|
|
|
|
|
2018-12-13 16:32:07 +01:00
|
|
|
|
# DTS should be close to kconfig because CONFIG_ variables from
|
|
|
|
|
# kconfig and dts should be available at the same time.
|
|
|
|
|
#
|
|
|
|
|
# The DT system uses a C preprocessor for it's code generation needs.
|
|
|
|
|
# This creates an awkward chicken-and-egg problem, because we don't
|
|
|
|
|
# always know exactly which toolchain the user needs until we know
|
|
|
|
|
# more about the target, e.g. after DT and Kconfig.
|
|
|
|
|
#
|
|
|
|
|
# To resolve this we find "some" C toolchain, configure it generically
|
|
|
|
|
# with the minimal amount of configuration needed to have it
|
|
|
|
|
# preprocess DT sources, and then, after we have finished processing
|
|
|
|
|
# both DT and Kconfig we complete the target-specific configuration,
|
|
|
|
|
# and possibly change the toolchain.
|
|
|
|
|
include(${ZEPHYR_BASE}/cmake/generic_toolchain.cmake)
|
2019-01-18 16:47:05 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/dts.cmake)
|
2018-01-11 15:46:44 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/kconfig.cmake)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2018-12-19 10:40:57 +01:00
|
|
|
|
set(SOC_NAME ${CONFIG_SOC})
|
2018-02-22 16:25:03 +01:00
|
|
|
|
set(SOC_SERIES ${CONFIG_SOC_SERIES})
|
|
|
|
|
set(SOC_FAMILY ${CONFIG_SOC_FAMILY})
|
|
|
|
|
|
|
|
|
|
if("${SOC_SERIES}" STREQUAL "")
|
|
|
|
|
set(SOC_PATH ${SOC_NAME})
|
|
|
|
|
else()
|
|
|
|
|
set(SOC_PATH ${SOC_FAMILY}/${SOC_SERIES})
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-07-06 12:53:39 +02:00
|
|
|
|
# Use SOC to search for a 'CMakeLists.txt' file.
|
|
|
|
|
# e.g. zephyr/soc/xtense/intel_apl_adsp/CMakeLists.txt.
|
|
|
|
|
foreach(root ${SOC_ROOT})
|
|
|
|
|
if(EXISTS ${root}/soc/${ARCH}/${SOC_PATH})
|
|
|
|
|
set(SOC_DIR ${root}/soc)
|
|
|
|
|
break()
|
|
|
|
|
endif()
|
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
|
if(NOT SOC_DIR)
|
|
|
|
|
message(FATAL_ERROR "Could not find SOC=${SOC_NAME} for BOARD=${BOARD}, \
|
|
|
|
|
please check your installation. SOC roots searched: \n\
|
|
|
|
|
${SOC_ROOT}")
|
|
|
|
|
endif()
|
|
|
|
|
|
2018-12-13 16:32:07 +01:00
|
|
|
|
include(${ZEPHYR_BASE}/cmake/target_toolchain.cmake)
|
|
|
|
|
|
2019-09-27 14:05:53 +02:00
|
|
|
|
project(Zephyr-Kernel VERSION ${PROJECT_VERSION})
|
|
|
|
|
enable_language(C CXX ASM)
|
2020-08-18 14:47:53 +02:00
|
|
|
|
# The setup / configuration of the toolchain itself and the configuration of
|
|
|
|
|
# supported compilation flags are now split, as this allows to use the toolchain
|
|
|
|
|
# for generic purposes, for example DTS, and then test the toolchain for
|
|
|
|
|
# supported flags at stage two.
|
|
|
|
|
# Testing the toolchain flags requires the enable_language() to have been called in CMake.
|
|
|
|
|
include(${ZEPHYR_BASE}/cmake/target_toolchain_flags.cmake)
|
2019-09-27 14:05:53 +02:00
|
|
|
|
|
|
|
|
|
# 'project' sets PROJECT_BINARY_DIR to ${CMAKE_CURRENT_BINARY_DIR},
|
|
|
|
|
# but for legacy reasons we need it to be set to
|
|
|
|
|
# ${CMAKE_CURRENT_BINARY_DIR}/zephyr
|
|
|
|
|
set(PROJECT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/zephyr)
|
|
|
|
|
set(PROJECT_SOURCE_DIR ${ZEPHYR_BASE})
|
|
|
|
|
|
2017-10-27 15:43:34 +02:00
|
|
|
|
set(KERNEL_NAME ${CONFIG_KERNEL_BIN_NAME})
|
|
|
|
|
|
|
|
|
|
set(KERNEL_ELF_NAME ${KERNEL_NAME}.elf)
|
|
|
|
|
set(KERNEL_BIN_NAME ${KERNEL_NAME}.bin)
|
|
|
|
|
set(KERNEL_HEX_NAME ${KERNEL_NAME}.hex)
|
|
|
|
|
set(KERNEL_MAP_NAME ${KERNEL_NAME}.map)
|
|
|
|
|
set(KERNEL_LST_NAME ${KERNEL_NAME}.lst)
|
|
|
|
|
set(KERNEL_S19_NAME ${KERNEL_NAME}.s19)
|
2017-11-23 13:54:26 +01:00
|
|
|
|
set(KERNEL_EXE_NAME ${KERNEL_NAME}.exe)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
set(KERNEL_STAT_NAME ${KERNEL_NAME}.stat)
|
|
|
|
|
set(KERNEL_STRIP_NAME ${KERNEL_NAME}.strip)
|
|
|
|
|
|
|
|
|
|
include(${BOARD_DIR}/board.cmake OPTIONAL)
|
|
|
|
|
|
2018-10-16 13:27:21 +02:00
|
|
|
|
# If we are using a suitable ethernet driver inside qemu, then these options
|
|
|
|
|
# must be set, otherwise a zephyr instance cannot receive any network packets.
|
|
|
|
|
# The Qemu supported ethernet driver should define CONFIG_ETH_NIC_MODEL
|
|
|
|
|
# string that tells what nic model Qemu should use.
|
|
|
|
|
if(CONFIG_QEMU_TARGET)
|
2020-05-06 01:56:52 +02:00
|
|
|
|
if ((CONFIG_NET_QEMU_ETHERNET OR CONFIG_NET_QEMU_USER) AND NOT CONFIG_ETH_NIC_MODEL)
|
|
|
|
|
message(FATAL_ERROR "
|
|
|
|
|
No Qemu ethernet driver configured!
|
|
|
|
|
Enable Qemu supported ethernet driver like e1000 at drivers/ethernet"
|
|
|
|
|
)
|
|
|
|
|
elseif(CONFIG_NET_QEMU_ETHERNET)
|
2020-05-08 14:25:03 +02:00
|
|
|
|
if(CONFIG_ETH_QEMU_EXTRA_ARGS)
|
|
|
|
|
set(NET_QEMU_ETH_EXTRA_ARGS ",${CONFIG_ETH_QEMU_EXTRA_ARGS}")
|
|
|
|
|
endif()
|
2020-05-06 01:56:52 +02:00
|
|
|
|
list(APPEND QEMU_FLAGS_${ARCH}
|
2020-05-08 14:25:03 +02:00
|
|
|
|
-nic tap,model=${CONFIG_ETH_NIC_MODEL},script=no,downscript=no,ifname=${CONFIG_ETH_QEMU_IFACE_NAME}${NET_QEMU_ETH_EXTRA_ARGS}
|
2020-05-06 01:56:52 +02:00
|
|
|
|
)
|
|
|
|
|
elseif(CONFIG_NET_QEMU_USER)
|
|
|
|
|
list(APPEND QEMU_FLAGS_${ARCH}
|
|
|
|
|
-nic user,model=${CONFIG_ETH_NIC_MODEL},${CONFIG_NET_QEMU_USER_EXTRA_ARGS}
|
|
|
|
|
)
|
2018-10-16 13:27:21 +02:00
|
|
|
|
else()
|
|
|
|
|
list(APPEND QEMU_FLAGS_${ARCH}
|
|
|
|
|
-net none
|
2018-12-19 10:40:57 +01:00
|
|
|
|
)
|
2018-10-16 13:27:21 +02:00
|
|
|
|
endif()
|
|
|
|
|
endif()
|
|
|
|
|
|
2019-11-04 14:30:24 +01:00
|
|
|
|
# General purpose Zephyr target.
|
|
|
|
|
# This target can be used for custom zephyr settings that needs to be used elsewhere in the build system
|
|
|
|
|
#
|
|
|
|
|
# Currently used properties:
|
|
|
|
|
# - COMPILES_OPTIONS: Used by application memory partition feature
|
2020-08-19 23:09:45 +02:00
|
|
|
|
# - ${TARGET}_DEPENDENCIES: additional dependencies for targets that need them
|
|
|
|
|
# like flash (FLASH_DEPENDENCIES), debug (DEBUG_DEPENDENCIES), etc.
|
2019-11-04 14:30:24 +01:00
|
|
|
|
add_custom_target(zephyr_property_target)
|
|
|
|
|
|
2018-11-26 23:49:53 +01:00
|
|
|
|
# "app" is a CMake library containing all the application code and is
|
|
|
|
|
# modified by the entry point ${APPLICATION_SOURCE_DIR}/CMakeLists.txt
|
|
|
|
|
# that was specified when cmake was called.
|
2017-10-27 15:43:34 +02:00
|
|
|
|
zephyr_library_named(app)
|
2018-08-06 17:29:16 +02:00
|
|
|
|
set_property(TARGET app PROPERTY ARCHIVE_OUTPUT_DIRECTORY app)
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2018-01-11 15:46:44 +01:00
|
|
|
|
add_subdirectory(${ZEPHYR_BASE} ${__build_dir})
|
2017-10-27 15:43:34 +02:00
|
|
|
|
|
2017-12-27 16:08:06 +01:00
|
|
|
|
# Link 'app' with the Zephyr interface libraries.
|
|
|
|
|
#
|
|
|
|
|
# NB: This must be done in boilerplate.cmake because 'app' can only be
|
|
|
|
|
# modified in the CMakeLists.txt file that created it. And it must be
|
2018-01-11 15:46:44 +01:00
|
|
|
|
# done after 'add_subdirectory(${ZEPHYR_BASE} ${__build_dir})'
|
2017-12-27 16:08:06 +01:00
|
|
|
|
# because interface libraries are defined while processing that
|
|
|
|
|
# subdirectory.
|
|
|
|
|
get_property(ZEPHYR_INTERFACE_LIBS_PROPERTY GLOBAL PROPERTY ZEPHYR_INTERFACE_LIBS)
|
|
|
|
|
foreach(boilerplate_lib ${ZEPHYR_INTERFACE_LIBS_PROPERTY})
|
|
|
|
|
# Linking 'app' with 'boilerplate_lib' causes 'app' to inherit the INTERFACE
|
|
|
|
|
# properties of 'boilerplate_lib'. The most common property is 'include
|
|
|
|
|
# directories', but it is also possible to have defines and compiler
|
|
|
|
|
# flags in the interface of a library.
|
|
|
|
|
#
|
|
|
|
|
string(TOUPPER ${boilerplate_lib} boilerplate_lib_upper_case) # Support lowercase lib names
|
|
|
|
|
target_link_libraries_ifdef(
|
|
|
|
|
CONFIG_APP_LINK_WITH_${boilerplate_lib_upper_case}
|
|
|
|
|
app
|
2018-06-22 14:35:44 +02:00
|
|
|
|
PUBLIC
|
2017-12-27 16:08:06 +01:00
|
|
|
|
${boilerplate_lib}
|
|
|
|
|
)
|
|
|
|
|
endforeach()
|
2018-09-17 15:02:54 +02:00
|
|
|
|
|
|
|
|
|
if("${CMAKE_EXTRA_GENERATOR}" STREQUAL "Eclipse CDT4")
|
|
|
|
|
# Call the amendment function before .project and .cproject generation
|
|
|
|
|
# C and CXX includes, defines in .cproject without __cplusplus
|
|
|
|
|
# with project includes and defines
|
|
|
|
|
include(${ZEPHYR_BASE}/cmake/ide/eclipse_cdt4_generator_amendment.cmake)
|
|
|
|
|
eclipse_cdt4_generator_amendment(1)
|
|
|
|
|
endif()
|