2019-04-22 20:39:48 +02:00
|
|
|
# SPDX-License-Identifier: Apache-2.0
|
2021-12-16 13:55:09 +01:00
|
|
|
#
|
|
|
|
# Copyright (c) 2021, Nordic Semiconductor ASA
|
2019-04-22 20:39:48 +02:00
|
|
|
|
2021-12-16 13:55:09 +01:00
|
|
|
# Validate board and setup boards target.
|
|
|
|
#
|
|
|
|
# This CMake module will validate the BOARD argument as well as splitting the
|
2023-04-28 18:26:23 +02:00
|
|
|
# BOARD argument into <BOARD> and <BOARD_REVISION>. When BOARD_EXTENSIONS option
|
|
|
|
# is enabled (default) this module will also take care of finding board
|
|
|
|
# extension directories.
|
2021-12-16 13:55:09 +01:00
|
|
|
#
|
|
|
|
# If a board implementation is not found for the specified board an error will
|
|
|
|
# be raised and list of valid boards will be printed.
|
|
|
|
#
|
|
|
|
# If user provided board is a board alias, the board will be adjusted to real
|
|
|
|
# board name.
|
|
|
|
#
|
|
|
|
# If board name is deprecated, then board will be adjusted to new board name and
|
|
|
|
# a deprecation warning will be printed to the user.
|
|
|
|
#
|
|
|
|
# Outcome:
|
|
|
|
# The following variables will be defined when this CMake module completes:
|
|
|
|
#
|
2024-04-15 10:23:00 +02:00
|
|
|
# - BOARD: Board, without revision field.
|
|
|
|
# - BOARD_REVISION: Board revision
|
|
|
|
# - BOARD_QUALIFIERS: Board qualifiers
|
|
|
|
# - NORMALIZED_BOARD_QUALIFIERS: Board qualifiers in lower-case format where slashes have been
|
|
|
|
# replaced with underscores
|
|
|
|
# - NORMALIZED_BOARD_TARGET: Board target in lower-case format where slashes have been
|
|
|
|
# replaced with underscores
|
|
|
|
# - BOARD_DIR: Board directory with the implementation for selected board
|
|
|
|
# - ARCH_DIR: Arch dir for extracted from selected board
|
|
|
|
# - BOARD_ROOT: BOARD_ROOT with ZEPHYR_BASE appended
|
|
|
|
# - BOARD_EXTENSION_DIRS: List of board extension directories (If
|
|
|
|
# BOARD_EXTENSIONS is not explicitly disabled)
|
2021-12-16 13:55:09 +01:00
|
|
|
#
|
|
|
|
# The following targets will be defined when this CMake module completes:
|
2023-01-07 23:47:42 +01:00
|
|
|
# - board: when invoked, a list of valid boards will be printed
|
2021-12-16 13:55:09 +01:00
|
|
|
#
|
|
|
|
# Required variables:
|
|
|
|
# - BOARD: Board name, including any optional revision field, for example: `foo` or `foo@1.0.0`
|
|
|
|
#
|
|
|
|
# Optional variables:
|
|
|
|
# - BOARD_ROOT: CMake list of board roots containing board implementations
|
|
|
|
# - ARCH_ROOT: CMake list of arch roots containing arch implementations
|
|
|
|
#
|
|
|
|
# Optional environment variables:
|
|
|
|
# - ZEPHYR_BOARD_ALIASES: Environment setting pointing to a CMake file
|
|
|
|
# containing board aliases.
|
|
|
|
#
|
2023-01-07 23:47:42 +01:00
|
|
|
# Variables set by this module and not mentioned above are for internal
|
|
|
|
# use only, and may be removed, renamed, or re-purposed without prior notice.
|
2021-12-16 13:55:09 +01:00
|
|
|
|
2021-12-16 17:13:54 +01:00
|
|
|
include_guard(GLOBAL)
|
|
|
|
|
|
|
|
include(python)
|
|
|
|
include(extensions)
|
|
|
|
|
2021-12-16 13:55:09 +01:00
|
|
|
# Check that BOARD has been provided, and that it has not changed.
|
|
|
|
# If user tries to change the BOARD, the BOARD value is reset to the BOARD_CACHED value.
|
|
|
|
zephyr_check_cache(BOARD REQUIRED)
|
|
|
|
|
|
|
|
# 'BOARD_ROOT' is a prioritized list of directories where boards may
|
2022-08-05 11:09:26 +02:00
|
|
|
# be found. It always includes ${ZEPHYR_BASE} at the lowest priority (except for unittesting).
|
|
|
|
if(NOT unittest IN_LIST Zephyr_FIND_COMPONENTS)
|
|
|
|
list(APPEND BOARD_ROOT ${ZEPHYR_BASE})
|
|
|
|
endif()
|
2021-12-16 13:55:09 +01:00
|
|
|
|
2024-03-19 15:26:59 +01:00
|
|
|
# Helper function for parsing a board's name, revision, and qualifiers,
|
2022-09-14 22:23:15 +02:00
|
|
|
# from one input variable to three separate output variables.
|
2024-03-19 15:26:59 +01:00
|
|
|
function(parse_board_components board_in name_out revision_out qualifiers_out)
|
2022-09-14 22:23:15 +02:00
|
|
|
if(NOT "${${board_in}}" MATCHES "^([^@/]+)(@[^@/]+)?(/[^@]+)?$")
|
|
|
|
message(FATAL_ERROR
|
2024-03-19 15:26:59 +01:00
|
|
|
"Invalid revision / qualifiers format for ${board_in} (${${board_in}}). "
|
|
|
|
"Valid format is: <board>@<revision>/<qualifiers>"
|
2022-09-14 22:23:15 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
string(REPLACE "@" "" board_revision "${CMAKE_MATCH_2}")
|
|
|
|
|
|
|
|
set(${name_out} ${CMAKE_MATCH_1} PARENT_SCOPE)
|
|
|
|
set(${revision_out} ${board_revision} PARENT_SCOPE)
|
2024-03-19 15:26:59 +01:00
|
|
|
set(${qualifiers_out} ${CMAKE_MATCH_3} PARENT_SCOPE)
|
2022-09-14 22:23:15 +02:00
|
|
|
endfunction()
|
|
|
|
|
2024-02-22 19:24:36 +01:00
|
|
|
parse_board_components(
|
|
|
|
BOARD
|
2024-03-19 15:26:59 +01:00
|
|
|
BOARD BOARD_REVISION BOARD_QUALIFIERS
|
2024-02-22 19:24:36 +01:00
|
|
|
)
|
2021-12-16 13:55:09 +01:00
|
|
|
|
2022-08-19 16:27:39 +02:00
|
|
|
zephyr_get(ZEPHYR_BOARD_ALIASES)
|
|
|
|
if(DEFINED ZEPHYR_BOARD_ALIASES)
|
|
|
|
include(${ZEPHYR_BOARD_ALIASES})
|
2021-12-16 13:55:09 +01:00
|
|
|
if(${BOARD}_BOARD_ALIAS)
|
|
|
|
set(BOARD_ALIAS ${BOARD} CACHE STRING "Board alias, provided by user")
|
2024-02-22 19:24:36 +01:00
|
|
|
parse_board_components(
|
|
|
|
${BOARD}_BOARD_ALIAS
|
2024-03-19 15:26:59 +01:00
|
|
|
BOARD BOARD_ALIAS_REVISION BOARD_ALIAS_QUALIFIERS
|
2024-02-22 19:24:36 +01:00
|
|
|
)
|
2021-12-16 13:55:09 +01:00
|
|
|
message(STATUS "Aliased BOARD=${BOARD_ALIAS} changed to ${BOARD}")
|
2022-09-14 22:23:15 +02:00
|
|
|
if(NOT DEFINED BOARD_REVISION)
|
|
|
|
set(BOARD_REVISION ${BOARD_ALIAS_REVISION})
|
|
|
|
endif()
|
2024-03-19 15:26:59 +01:00
|
|
|
set(BOARD_QUALIFIERS ${BOARD_ALIAS_QUALIFIERS}${BOARD_QUALIFIERS})
|
2021-12-16 13:55:09 +01:00
|
|
|
endif()
|
|
|
|
endif()
|
2022-09-14 22:23:15 +02:00
|
|
|
|
2021-12-16 13:55:09 +01:00
|
|
|
include(${ZEPHYR_BASE}/boards/deprecated.cmake)
|
2024-03-19 15:26:59 +01:00
|
|
|
if(${BOARD}${BOARD_QUALIFIERS}_DEPRECATED)
|
|
|
|
set(BOARD_DEPRECATED ${BOARD}${BOARD_QUALIFIERS} CACHE STRING "Deprecated BOARD, provided by user")
|
2024-02-22 19:24:36 +01:00
|
|
|
message(WARNING
|
|
|
|
"Deprecated BOARD=${BOARD_DEPRECATED} specified, "
|
2024-03-19 15:26:59 +01:00
|
|
|
"board automatically changed to: ${${BOARD}${BOARD_QUALIFIERS}_DEPRECATED}."
|
2024-02-22 19:24:36 +01:00
|
|
|
)
|
|
|
|
parse_board_components(
|
2024-03-19 15:26:59 +01:00
|
|
|
${BOARD}${BOARD_QUALIFIERS}_DEPRECATED
|
|
|
|
BOARD BOARD_DEPRECATED_REVISION BOARD_QUALIFIERS
|
2024-02-22 19:24:36 +01:00
|
|
|
)
|
2022-09-14 22:23:15 +02:00
|
|
|
if(DEFINED BOARD_DEPRECATED_REVISION)
|
|
|
|
if(DEFINED BOARD_REVISION)
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Invalid board revision: ${BOARD_REVISION}\n"
|
|
|
|
"Deprecated board '${BOARD_DEPRECATED}' is now implemented as a revision of another board "
|
|
|
|
"(${BOARD}@${BOARD_DEPRECATED_REVISION}), so the specified revision does not apply. "
|
|
|
|
"Please consult the documentation for '${BOARD}' to see how to build for the new board."
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
set(BOARD_REVISION ${BOARD_DEPRECATED_REVISION})
|
|
|
|
endif()
|
2021-12-16 13:55:09 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
zephyr_boilerplate_watch(BOARD)
|
2019-04-22 20:39:48 +02:00
|
|
|
|
boards/shields: re-work handling in cmake and west
Remove the boards and shields lists from the 'usage' target output.
That might have been readable at some point long ago in Zephyr's
history, when only a few boards were available, but right now it's
obscuring the high level targets we really want 'usage' to print.
Instead, add 'boards' and 'shields' targets which the user can run to
get those lists, and reference them from the 'usage' output. This
makes 'usage' squintable again. We use the new list_boards.py script
from the 'boards' target.
Reference the 'help' target from 'usage' as well, and drop the
recommendation that people run '--target help' from the 'west build
--help' output for the 'west build --target' option. The canonical
place to look is 'usage' now.
Use the new list_boards.py code from 'west boards' as well, which
allows us to add the board's directory as a format string key, in
addition to its name and architecture.
Keep west-completion.bash up to date. While doing that, I noticed that
a bunch of references to this file refer to a stale location, so fix
those too.
Finally, the 'usage' output is what we print for a failed board or
shield lookup, so that needs to be updated also. Handle that by
invoking boards.cmake and a new shields.cmake in CMake script mode to
print the relevant output.
Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-12-10 00:53:00 +01:00
|
|
|
foreach(root ${BOARD_ROOT})
|
2021-12-16 13:55:09 +01:00
|
|
|
# Check that the board root looks reasonable.
|
|
|
|
if(NOT IS_DIRECTORY "${root}/boards")
|
|
|
|
message(WARNING "BOARD_ROOT element without a 'boards' subdirectory:
|
|
|
|
${root}
|
|
|
|
Hints:
|
|
|
|
- if your board directory is '/foo/bar/boards/<ARCH>/my_board' then add '/foo/bar' to BOARD_ROOT, not the entire board directory
|
|
|
|
- if in doubt, use absolute paths")
|
|
|
|
endif()
|
2022-09-14 22:23:15 +02:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if((HWMv1 AND NOT EXISTS ${BOARD_DIR}/${BOARD}_defconfig)
|
|
|
|
OR (HWMv2 AND NOT EXISTS ${BOARD_DIR}/board.yml))
|
|
|
|
message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. "
|
|
|
|
"Trying to find new location."
|
|
|
|
)
|
|
|
|
set(BOARD_DIR BOARD_DIR-NOTFOUND CACHE PATH "Path to a file." FORCE)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Prepare list boards command.
|
|
|
|
# This command is used for locating the board dir as well as printing all boards
|
|
|
|
# in the system in the following cases:
|
|
|
|
# - User specifies an invalid BOARD
|
|
|
|
# - User invokes '<build-command> boards' target
|
|
|
|
list(TRANSFORM ARCH_ROOT PREPEND "--arch-root=" OUTPUT_VARIABLE arch_root_args)
|
|
|
|
list(TRANSFORM BOARD_ROOT PREPEND "--board-root=" OUTPUT_VARIABLE board_root_args)
|
|
|
|
list(TRANSFORM SOC_ROOT PREPEND "--soc-root=" OUTPUT_VARIABLE soc_root_args)
|
|
|
|
|
|
|
|
set(list_boards_commands
|
|
|
|
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/list_boards.py
|
|
|
|
${arch_root_args} ${board_root_args} --arch-root=${ZEPHYR_BASE}
|
|
|
|
${soc_root_args} --soc-root=${ZEPHYR_BASE}
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT BOARD_DIR)
|
|
|
|
if(BOARD_ALIAS)
|
|
|
|
execute_process(${list_boards_commands} --board=${BOARD_ALIAS} --cmakeformat={DIR}
|
|
|
|
OUTPUT_VARIABLE ret_board
|
|
|
|
ERROR_VARIABLE err_board
|
|
|
|
RESULT_VARIABLE ret_val
|
|
|
|
)
|
|
|
|
string(STRIP "${ret_board}" ret_board)
|
|
|
|
cmake_parse_arguments(BOARD_HIDDEN "" "DIR" "" ${ret_board})
|
|
|
|
set(BOARD_HIDDEN_DIR ${BOARD_HIDDEN_DIR} CACHE PATH "Path to a folder." FORCE)
|
2021-12-16 13:55:09 +01:00
|
|
|
|
|
|
|
if(BOARD_HIDDEN_DIR)
|
|
|
|
message("Board alias ${BOARD_ALIAS} is hiding the real board of same name")
|
|
|
|
endif()
|
|
|
|
endif()
|
2022-09-14 22:23:15 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(format_str "{NAME}\;{DIR}\;{HWM}\;")
|
|
|
|
set(format_str "${format_str}{REVISION_FORMAT}\;{REVISION_DEFAULT}\;{REVISION_EXACT}\;")
|
2024-03-19 15:26:59 +01:00
|
|
|
set(format_str "${format_str}{REVISIONS}\;{SOCS}\;{QUALIFIERS}")
|
2022-09-14 22:23:15 +02:00
|
|
|
|
|
|
|
if(BOARD_DIR)
|
|
|
|
set(board_dir_arg "--board-dir=${BOARD_DIR}")
|
|
|
|
endif()
|
|
|
|
execute_process(${list_boards_commands} --board=${BOARD} ${board_dir_arg}
|
|
|
|
--cmakeformat=${format_str}
|
|
|
|
OUTPUT_VARIABLE ret_board
|
|
|
|
ERROR_VARIABLE err_board
|
|
|
|
RESULT_VARIABLE ret_val
|
|
|
|
)
|
|
|
|
if(ret_val)
|
|
|
|
message(FATAL_ERROR "Error finding board: ${BOARD}\nError message: ${err_board}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT "${ret_board}" STREQUAL "")
|
|
|
|
string(STRIP "${ret_board}" ret_board)
|
2024-03-22 20:17:03 +01:00
|
|
|
string(FIND "${ret_board}" "\n" idx REVERSE)
|
|
|
|
if(idx GREATER -1)
|
|
|
|
while(TRUE)
|
|
|
|
math(EXPR start "${idx} + 1")
|
|
|
|
string(SUBSTRING "${ret_board}" ${start} -1 line)
|
|
|
|
string(SUBSTRING "${ret_board}" 0 ${idx} ret_board)
|
|
|
|
|
|
|
|
cmake_parse_arguments(LIST_BOARD "" "DIR" "" ${line})
|
|
|
|
set(board_dirs "${board_dirs}\n${LIST_BOARD_DIR}")
|
|
|
|
|
|
|
|
if(idx EQUAL -1)
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${ret_board}" "\n" idx REVERSE)
|
|
|
|
endwhile()
|
|
|
|
message(FATAL_ERROR "Multiple boards named '${BOARD}' found in:${board_dirs}")
|
|
|
|
endif()
|
|
|
|
|
2022-09-14 22:23:15 +02:00
|
|
|
set(single_val "NAME;DIR;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT")
|
2024-03-19 15:26:59 +01:00
|
|
|
set(multi_val "REVISIONS;SOCS;QUALIFIERS")
|
|
|
|
cmake_parse_arguments(LIST_BOARD "" "${single_val}" "${multi_val}" ${ret_board})
|
|
|
|
set(BOARD_DIR ${LIST_BOARD_DIR} CACHE PATH "Board directory for board (${BOARD})" FORCE)
|
2024-03-06 11:01:21 +01:00
|
|
|
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${BOARD_DIR}/board.yml)
|
2022-09-14 22:23:15 +02:00
|
|
|
|
|
|
|
# Create two CMake variables identifying the hw model.
|
|
|
|
# CMake variable: HWM=[v1,v2]
|
|
|
|
# CMake variable: HWMv1=True, when HWMv1 is in use.
|
|
|
|
# CMake variable: HWMv2=True, when HWMv2 is in use.
|
2024-03-19 15:26:59 +01:00
|
|
|
set(HWM ${LIST_BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version")
|
2022-09-14 22:23:15 +02:00
|
|
|
set(HWM${HWM} True CACHE INTERNAL "Zephyr hardware model")
|
|
|
|
elseif(BOARD_DIR)
|
|
|
|
message(FATAL_ERROR "Error finding board: ${BOARD} in ${BOARD_DIR}.\n"
|
|
|
|
"This indicates the board has been removed, renamed, or placed at a new location.\n"
|
|
|
|
"Please run a pristine build."
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
message("No board named '${BOARD}' found.\n\n"
|
|
|
|
"Please choose one of the following boards:\n"
|
|
|
|
)
|
|
|
|
execute_process(${list_boards_commands})
|
|
|
|
unset(CACHED_BOARD CACHE)
|
|
|
|
message(FATAL_ERROR "Invalid BOARD; see above.")
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 15:26:59 +01:00
|
|
|
if(HWMv1 AND DEFINED BOARD_QUALIFIERS)
|
2022-09-14 22:23:15 +02:00
|
|
|
message(FATAL_ERROR
|
2024-03-19 15:26:59 +01:00
|
|
|
"Board '${BOARD}' does not support board qualifiers, ${BOARD}${BOARD_QUALIFIERS}.\n"
|
|
|
|
"Please specify board without qualifiers.\n"
|
2022-09-14 22:23:15 +02:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
cmake_path(IS_PREFIX ZEPHYR_BASE "${BOARD_DIR}" NORMALIZE in_zephyr_tree)
|
|
|
|
if(NOT in_zephyr_tree)
|
|
|
|
set(USING_OUT_OF_TREE_BOARD 1)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(HWMv1)
|
|
|
|
if(EXISTS ${BOARD_DIR}/revision.cmake)
|
|
|
|
# Board provides revision handling.
|
|
|
|
include(${BOARD_DIR}/revision.cmake)
|
|
|
|
elseif(BOARD_REVISION)
|
|
|
|
message(WARNING "Board revision ${BOARD_REVISION} specified for ${BOARD}, \
|
|
|
|
but board has no revision so revision will be ignored.")
|
2022-09-22 11:57:52 +02:00
|
|
|
endif()
|
2022-09-14 22:23:15 +02:00
|
|
|
elseif(HWMv2)
|
2024-03-19 15:26:59 +01:00
|
|
|
if(LIST_BOARD_REVISION_FORMAT)
|
|
|
|
if(LIST_BOARD_REVISION_FORMAT STREQUAL "custom")
|
2022-09-14 22:23:15 +02:00
|
|
|
include(${BOARD_DIR}/revision.cmake)
|
|
|
|
else()
|
|
|
|
if(EXISTS ${BOARD_DIR}/revision.cmake)
|
|
|
|
message(WARNING
|
|
|
|
"revision.cmake ignored, revision.cmake is only used for revision format: 'custom'"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 15:26:59 +01:00
|
|
|
string(TOUPPER "${LIST_BOARD_REVISION_FORMAT}" rev_format)
|
|
|
|
if(LIST_BOARD_REVISION_EXACT)
|
2022-09-14 22:23:15 +02:00
|
|
|
set(rev_exact EXACT)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
board_check_revision(
|
|
|
|
FORMAT ${rev_format}
|
2024-03-19 15:26:59 +01:00
|
|
|
DEFAULT_REVISION ${LIST_BOARD_REVISION_DEFAULT}
|
|
|
|
VALID_REVISIONS ${LIST_BOARD_REVISIONS}
|
2022-09-14 22:23:15 +02:00
|
|
|
${rev_exact}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
elseif(DEFINED BOARD_REVISION)
|
|
|
|
if(EXISTS ${BOARD_DIR}/revision.cmake)
|
|
|
|
message(WARNING
|
|
|
|
"revision.cmake is not used, revisions must be defined in '${BOARD_DIR}/board.yml'"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
message(FATAL_ERROR "Invalid board revision: ${BOARD_REVISION}\n"
|
|
|
|
"Board '${BOARD}' does not define any revisions."
|
2021-12-16 13:55:09 +01:00
|
|
|
)
|
|
|
|
endif()
|
2019-04-22 20:39:48 +02:00
|
|
|
|
2024-03-19 15:26:59 +01:00
|
|
|
if(LIST_BOARD_QUALIFIERS)
|
2022-09-14 22:23:15 +02:00
|
|
|
# Allow users to omit the SoC when building for a board with a single SoC.
|
2024-03-19 15:26:59 +01:00
|
|
|
list(LENGTH LIST_BOARD_SOCS socs_length)
|
cmake: support shortened file names for single SoC boards
This allow developers to create board files without the SoC name when
the board only defines a single SoC.
This means that a board, such as rpi_pico, which defines only a single
SoC, rp2040, and one variant, now allows the following file names:
Board target: rpi_pico/rp2040
- dts: rpi_pico_rp2040.dts, short: rpi_pico.dts
- defconfig: rpi_pico_rp2040_defconfig, short: rpi_pico_defconfig
- overlay: rpi_pico_rp2040.overlay, short: rpi_pico.overlay
- conf: rpi_pico_rp2040.conf, short: rpi_pico.conf
Board target: rpi_pico/rp2040/w
- dts: rpi_pico_rp2040_w.dts, short: rpi_pico_w.dts
- defconfig: rpi_pico_rp2040_w_defconfig, short: rpi_pico_w_defconfig
- overlay: rpi_pico_rp2040_w.overlay, short: rpi_pico_w.overlay
- conf: rpi_pico_rp2040_w.conf, short: rpi_pico_w.conf
A multi CPU cluster board, nrf5340dk:
Board target: nrf5340dk/nrf5340/cpunet
- dts: nrf5340dk_nrf5340_cpunet.dts, short: nrf5340dk_cpunet.dts
- defconfig: nrf5340dk_nrf5340_cpunet_defconfig,
short: nrf5340dk_cpunet_defconfig
- overlay: nrf5340dk_nrf5340_cpunet.overlay,
short: nrf5340dk_cpunet.overlay
- conf: nrf5340dk_nrf5340_cpunet.conf, short: nrf5340dk_cpunet.conf
A multi SoC board, nrf5340dk (real: nrf52840, emulated: nrf52811):
Board target: nrf52840dk/nrf52840
- dts: nrf52840dk_nrf52840.dts, short: Not possible
- defconfig: nrf52840dk_nrf52840_defconfig, short: Not possible
- overlay: nrf52840dk_nrf52840.overlay, short: Not possible
- conf: nrf52840dk_nrf52840.conf, short: Not possible
If two conflicting files are found, for example both
rpi_pico_rp2040.overlay and rpi_pico.overlay, then an error is raised.
If short form is detected for a board target with multiple SoCs, for
example nrf52840dk_nrf52840.overlay and nrf52840dk.overlay, then an
error is raised.
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2024-04-05 15:39:37 +02:00
|
|
|
if(socs_length EQUAL 1)
|
|
|
|
set(BOARD_SINGLE_SOC TRUE)
|
|
|
|
set(BOARD_${BOARD}_SINGLE_SOC TRUE)
|
|
|
|
if(NOT DEFINED BOARD_QUALIFIERS)
|
|
|
|
set(BOARD_QUALIFIERS "/${LIST_BOARD_SOCS}")
|
|
|
|
elseif("${BOARD_QUALIFIERS}" MATCHES "^//.*")
|
|
|
|
string(REGEX REPLACE "^//" "/${LIST_BOARD_SOCS}/" BOARD_QUALIFIERS "${BOARD_QUALIFIERS}")
|
|
|
|
endif()
|
2022-09-14 22:23:15 +02:00
|
|
|
endif()
|
|
|
|
|
2024-03-07 10:06:34 +01:00
|
|
|
set(board_targets ${LIST_BOARD_QUALIFIERS})
|
|
|
|
list(TRANSFORM board_targets PREPEND "${BOARD}/")
|
|
|
|
if(NOT ("${BOARD}${BOARD_QUALIFIERS}" IN_LIST board_targets))
|
|
|
|
string(REPLACE ";" "\n" board_targets "${board_targets}")
|
2022-09-14 22:23:15 +02:00
|
|
|
unset(CACHED_BOARD CACHE)
|
2024-03-19 15:26:59 +01:00
|
|
|
message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \
|
|
|
|
`${BOARD}` not found. Please specify a valid board target.\n"
|
2024-04-24 08:57:33 +02:00
|
|
|
"Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n")
|
2022-09-14 22:23:15 +02:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Unknown hw model (${HWM}) for board: ${BOARD}.")
|
2021-12-16 13:55:09 +01:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(board_message "Board: ${BOARD}")
|
|
|
|
|
|
|
|
if(DEFINED BOARD_REVISION)
|
|
|
|
set(board_message "${board_message}, Revision: ${BOARD_REVISION}")
|
|
|
|
if(DEFINED ACTIVE_BOARD_REVISION)
|
|
|
|
set(board_message "${board_message} (Active: ${ACTIVE_BOARD_REVISION})")
|
|
|
|
set(BOARD_REVISION ${ACTIVE_BOARD_REVISION})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
string(REPLACE "." "_" BOARD_REVISION_STRING ${BOARD_REVISION})
|
|
|
|
endif()
|
|
|
|
|
2024-03-19 15:26:59 +01:00
|
|
|
if(DEFINED BOARD_QUALIFIERS)
|
|
|
|
string(REGEX REPLACE "^/" "qualifiers: " board_message_qualifiers "${BOARD_QUALIFIERS}")
|
|
|
|
set(board_message "${board_message}, ${board_message_qualifiers}")
|
2024-04-15 10:23:00 +02:00
|
|
|
|
|
|
|
string(REPLACE "/" "_" NORMALIZED_BOARD_QUALIFIERS "${BOARD_QUALIFIERS}")
|
2019-04-22 20:39:48 +02:00
|
|
|
endif()
|
|
|
|
|
2024-04-15 10:23:00 +02:00
|
|
|
set(NORMALIZED_BOARD_TARGET "${BOARD}${BOARD_QUALIFIERS}")
|
|
|
|
string(REPLACE "/" "_" NORMALIZED_BOARD_TARGET "${NORMALIZED_BOARD_TARGET}")
|
|
|
|
|
2022-09-14 22:23:15 +02:00
|
|
|
message(STATUS "${board_message}")
|
|
|
|
|
2021-12-16 13:55:09 +01:00
|
|
|
add_custom_target(boards ${list_boards_commands} USES_TERMINAL)
|
2023-04-28 18:26:23 +02:00
|
|
|
|
|
|
|
# Board extensions are enabled by default
|
|
|
|
set(BOARD_EXTENSIONS ON CACHE BOOL "Support board extensions")
|
|
|
|
zephyr_get(BOARD_EXTENSIONS)
|
|
|
|
|
|
|
|
# Process board extensions
|
|
|
|
if(BOARD_EXTENSIONS)
|
|
|
|
get_filename_component(board_dir_name ${BOARD_DIR} NAME)
|
|
|
|
|
|
|
|
foreach(root ${BOARD_ROOT})
|
|
|
|
set(board_extension_dir ${root}/boards/extensions/${board_dir_name})
|
|
|
|
if(NOT EXISTS ${board_extension_dir})
|
|
|
|
continue()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
list(APPEND BOARD_EXTENSION_DIRS ${board_extension_dir})
|
|
|
|
endforeach()
|
|
|
|
endif()
|