terminology: adopt CMake, python, and Kconfig code to use qualifiers
Followup: #69905 Adopting new board terminology for CMake, python, and Kconfig code to use qualifiers instead of identifiers. Also adjusted to board target where applicable. Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
parent
4370847c75
commit
732c504e4c
|
@ -1,7 +1,7 @@
|
|||
# Copyright (c) 2022 Nordic Semiconductor
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
if("${BOARD_IDENTIFIER}" STREQUAL "/nrf51822")
|
||||
if("${BOARD_QUALIFIERS}" STREQUAL "/nrf51822")
|
||||
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
|
||||
# - power@40000000 & clock@40000000 & nrf-mpu@40000000
|
||||
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")
|
||||
|
|
|
@ -2,17 +2,17 @@
|
|||
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
BOARD_STRING := $(sanitize_upper,$(BOARD))
|
||||
BOARD_FULL_STRING := $(sanitize_upper,$(BOARD)$(BOARD_IDENTIFIER))
|
||||
BOARD_STRING := $(normalize_upper,$(BOARD))
|
||||
BOARD_TARGET_STRING := $(normalize_upper,$(BOARD)$(BOARD_QUALIFIERS))
|
||||
|
||||
config BOARD_$(BOARD_STRING)
|
||||
def_bool y
|
||||
help
|
||||
Kconfig symbol identifying the board.
|
||||
|
||||
config BOARD_$(BOARD_FULL_STRING)
|
||||
config BOARD_$(BOARD_TARGET_STRING)
|
||||
def_bool y
|
||||
help
|
||||
Kconfig symbol identifying the board including full board identifier.
|
||||
Kconfig symbol identifying the board target.
|
||||
|
||||
osource "$(BOARD_DIR)/Kconfig.$(BOARD)"
|
||||
|
|
|
@ -10,7 +10,7 @@ if(NOT DEFINED OPENOCD_NRF5_SUBFAMILY)
|
|||
string(REGEX MATCH nrf5. OPENOCD_NRF5_SUBFAMILY "${BOARD}")
|
||||
|
||||
if(HWMv2 AND "${OPENOCD_NRF5_SUBFAMILY}" STREQUAL "")
|
||||
string(REGEX MATCH nrf5. OPENOCD_NRF5_SUBFAMILY "${BOARD_IDENTIFIER}")
|
||||
string(REGEX MATCH nrf5. OPENOCD_NRF5_SUBFAMILY "${BOARD_QUALIFIERS}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
set(SUPPORTED_EMU_PLATFORMS nsim)
|
||||
|
||||
string(SUBSTRING "${BOARD_IDENTIFIER}" 1 -1 NSIM_BASE_FILENAME)
|
||||
string(SUBSTRING "${BOARD_QUALIFIERS}" 1 -1 NSIM_BASE_FILENAME)
|
||||
string(REPLACE "/" "_" NSIM_BASE_FILENAME "${NSIM_BASE_FILENAME}")
|
||||
|
||||
if(NOT (CONFIG_SOC_NSIM_HS_SMP OR CONFIG_SOC_NSIM_HS6X_SMP OR CONFIG_SOC_NSIM_HS5X_SMP))
|
||||
|
|
|
@ -61,25 +61,25 @@ if(NOT unittest IN_LIST Zephyr_FIND_COMPONENTS)
|
|||
list(APPEND BOARD_ROOT ${ZEPHYR_BASE})
|
||||
endif()
|
||||
|
||||
# Helper function for parsing a board's name, revision, and identifier,
|
||||
# Helper function for parsing a board's name, revision, and qualifiers,
|
||||
# from one input variable to three separate output variables.
|
||||
function(parse_board_components board_in name_out revision_out identifier_out)
|
||||
function(parse_board_components board_in name_out revision_out qualifiers_out)
|
||||
if(NOT "${${board_in}}" MATCHES "^([^@/]+)(@[^@/]+)?(/[^@]+)?$")
|
||||
message(FATAL_ERROR
|
||||
"Invalid revision / identifier format for ${board_in} (${${board_in}}). "
|
||||
"Valid format is: <board>@<revision>/<identifier>"
|
||||
"Invalid revision / qualifiers format for ${board_in} (${${board_in}}). "
|
||||
"Valid format is: <board>@<revision>/<qualifiers>"
|
||||
)
|
||||
endif()
|
||||
string(REPLACE "@" "" board_revision "${CMAKE_MATCH_2}")
|
||||
|
||||
set(${name_out} ${CMAKE_MATCH_1} PARENT_SCOPE)
|
||||
set(${revision_out} ${board_revision} PARENT_SCOPE)
|
||||
set(${identifier_out} ${CMAKE_MATCH_3} PARENT_SCOPE)
|
||||
set(${qualifiers_out} ${CMAKE_MATCH_3} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
parse_board_components(
|
||||
BOARD
|
||||
BOARD BOARD_REVISION BOARD_IDENTIFIER
|
||||
BOARD BOARD_REVISION BOARD_QUALIFIERS
|
||||
)
|
||||
|
||||
zephyr_get(ZEPHYR_BOARD_ALIASES)
|
||||
|
@ -89,26 +89,26 @@ if(DEFINED ZEPHYR_BOARD_ALIASES)
|
|||
set(BOARD_ALIAS ${BOARD} CACHE STRING "Board alias, provided by user")
|
||||
parse_board_components(
|
||||
${BOARD}_BOARD_ALIAS
|
||||
BOARD BOARD_ALIAS_REVISION BOARD_ALIAS_IDENTIFIER
|
||||
BOARD BOARD_ALIAS_REVISION BOARD_ALIAS_QUALIFIERS
|
||||
)
|
||||
message(STATUS "Aliased BOARD=${BOARD_ALIAS} changed to ${BOARD}")
|
||||
if(NOT DEFINED BOARD_REVISION)
|
||||
set(BOARD_REVISION ${BOARD_ALIAS_REVISION})
|
||||
endif()
|
||||
set(BOARD_IDENTIFIER ${BOARD_ALIAS_IDENTIFIER}${BOARD_IDENTIFIER})
|
||||
set(BOARD_QUALIFIERS ${BOARD_ALIAS_QUALIFIERS}${BOARD_QUALIFIERS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include(${ZEPHYR_BASE}/boards/deprecated.cmake)
|
||||
if(${BOARD}${BOARD_IDENTIFIER}_DEPRECATED)
|
||||
set(BOARD_DEPRECATED ${BOARD}${BOARD_IDENTIFIER} CACHE STRING "Deprecated BOARD, provided by user")
|
||||
if(${BOARD}${BOARD_QUALIFIERS}_DEPRECATED)
|
||||
set(BOARD_DEPRECATED ${BOARD}${BOARD_QUALIFIERS} CACHE STRING "Deprecated BOARD, provided by user")
|
||||
message(WARNING
|
||||
"Deprecated BOARD=${BOARD_DEPRECATED} specified, "
|
||||
"board automatically changed to: ${${BOARD}${BOARD_IDENTIFIER}_DEPRECATED}."
|
||||
"board automatically changed to: ${${BOARD}${BOARD_QUALIFIERS}_DEPRECATED}."
|
||||
)
|
||||
parse_board_components(
|
||||
${BOARD}${BOARD_IDENTIFIER}_DEPRECATED
|
||||
BOARD BOARD_DEPRECATED_REVISION BOARD_IDENTIFIER
|
||||
${BOARD}${BOARD_QUALIFIERS}_DEPRECATED
|
||||
BOARD BOARD_DEPRECATED_REVISION BOARD_QUALIFIERS
|
||||
)
|
||||
if(DEFINED BOARD_DEPRECATED_REVISION)
|
||||
if(DEFINED BOARD_REVISION)
|
||||
|
@ -178,7 +178,7 @@ endif()
|
|||
|
||||
set(format_str "{NAME}\;{DIR}\;{HWM}\;")
|
||||
set(format_str "${format_str}{REVISION_FORMAT}\;{REVISION_DEFAULT}\;{REVISION_EXACT}\;")
|
||||
set(format_str "${format_str}{REVISIONS}\;{SOCS}\;{IDENTIFIERS}")
|
||||
set(format_str "${format_str}{REVISIONS}\;{SOCS}\;{QUALIFIERS}")
|
||||
|
||||
if(BOARD_DIR)
|
||||
set(board_dir_arg "--board-dir=${BOARD_DIR}")
|
||||
|
@ -196,15 +196,15 @@ endif()
|
|||
if(NOT "${ret_board}" STREQUAL "")
|
||||
string(STRIP "${ret_board}" ret_board)
|
||||
set(single_val "NAME;DIR;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT")
|
||||
set(multi_val "REVISIONS;SOCS;IDENTIFIERS")
|
||||
cmake_parse_arguments(BOARD "" "${single_val}" "${multi_val}" ${ret_board})
|
||||
set(BOARD_DIR ${BOARD_DIR} CACHE PATH "Board directory for board (${BOARD})" FORCE)
|
||||
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)
|
||||
|
||||
# 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.
|
||||
set(HWM ${BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version")
|
||||
set(HWM ${LIST_BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version")
|
||||
set(HWM${HWM} True CACHE INTERNAL "Zephyr hardware model")
|
||||
elseif(BOARD_DIR)
|
||||
message(FATAL_ERROR "Error finding board: ${BOARD} in ${BOARD_DIR}.\n"
|
||||
|
@ -220,10 +220,10 @@ else()
|
|||
message(FATAL_ERROR "Invalid BOARD; see above.")
|
||||
endif()
|
||||
|
||||
if(HWMv1 AND DEFINED BOARD_IDENTIFIER)
|
||||
if(HWMv1 AND DEFINED BOARD_QUALIFIERS)
|
||||
message(FATAL_ERROR
|
||||
"Board '${BOARD}' does not support board identifiers, ${BOARD}${BOARD_IDENTIFIER}.\n"
|
||||
"Please specify board without an identifier.\n"
|
||||
"Board '${BOARD}' does not support board qualifiers, ${BOARD}${BOARD_QUALIFIERS}.\n"
|
||||
"Please specify board without qualifiers.\n"
|
||||
)
|
||||
endif()
|
||||
|
||||
|
@ -241,8 +241,8 @@ if(HWMv1)
|
|||
but board has no revision so revision will be ignored.")
|
||||
endif()
|
||||
elseif(HWMv2)
|
||||
if(BOARD_REVISION_FORMAT)
|
||||
if(BOARD_REVISION_FORMAT STREQUAL "custom")
|
||||
if(LIST_BOARD_REVISION_FORMAT)
|
||||
if(LIST_BOARD_REVISION_FORMAT STREQUAL "custom")
|
||||
include(${BOARD_DIR}/revision.cmake)
|
||||
else()
|
||||
if(EXISTS ${BOARD_DIR}/revision.cmake)
|
||||
|
@ -251,15 +251,15 @@ elseif(HWMv2)
|
|||
)
|
||||
endif()
|
||||
|
||||
string(TOUPPER "${BOARD_REVISION_FORMAT}" rev_format)
|
||||
if(BOARD_REVISION_EXACT)
|
||||
string(TOUPPER "${LIST_BOARD_REVISION_FORMAT}" rev_format)
|
||||
if(LIST_BOARD_REVISION_EXACT)
|
||||
set(rev_exact EXACT)
|
||||
endif()
|
||||
|
||||
board_check_revision(
|
||||
FORMAT ${rev_format}
|
||||
DEFAULT_REVISION ${BOARD_REVISION_DEFAULT}
|
||||
VALID_REVISIONS ${BOARD_REVISIONS}
|
||||
DEFAULT_REVISION ${LIST_BOARD_REVISION_DEFAULT}
|
||||
VALID_REVISIONS ${LIST_BOARD_REVISIONS}
|
||||
${rev_exact}
|
||||
)
|
||||
endif()
|
||||
|
@ -275,21 +275,21 @@ elseif(HWMv2)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(BOARD_IDENTIFIERS)
|
||||
if(LIST_BOARD_QUALIFIERS)
|
||||
# Allow users to omit the SoC when building for a board with a single SoC.
|
||||
list(LENGTH BOARD_SOCS socs_length)
|
||||
if(NOT DEFINED BOARD_IDENTIFIER AND socs_length EQUAL 1)
|
||||
set(BOARD_IDENTIFIER "/${BOARD_SOCS}")
|
||||
elseif("${BOARD_IDENTIFIER}" MATCHES "^//.*" AND socs_length EQUAL 1)
|
||||
string(REGEX REPLACE "^//" "/${BOARD_SOCS}/" BOARD_IDENTIFIER "${BOARD_IDENTIFIER}")
|
||||
list(LENGTH LIST_BOARD_SOCS socs_length)
|
||||
if(NOT DEFINED BOARD_QUALIFIERS AND socs_length EQUAL 1)
|
||||
set(BOARD_QUALIFIERS "/${LIST_BOARD_SOCS}")
|
||||
elseif("${BOARD_QUALIFIERS}" MATCHES "^//.*" AND socs_length EQUAL 1)
|
||||
string(REGEX REPLACE "^//" "/${LIST_BOARD_SOCS}/" BOARD_QUALIFIERS "${BOARD_QUALIFIERS}")
|
||||
endif()
|
||||
|
||||
if(NOT ("${BOARD}${BOARD_IDENTIFIER}" IN_LIST BOARD_IDENTIFIERS))
|
||||
string(REPLACE ";" "\n" BOARD_IDENTIFIERS "${BOARD_IDENTIFIERS}")
|
||||
if(NOT ("${BOARD}${BOARD_QUALIFIERS}" IN_LIST LIST_BOARD_QUALIFIERS))
|
||||
string(REPLACE ";" "\n" LIST_BOARD_QUALIFIERS "${LIST_BOARD_QUALIFIERS}")
|
||||
unset(CACHED_BOARD CACHE)
|
||||
message(FATAL_ERROR "Board identifier `${BOARD_IDENTIFIER}` for board \
|
||||
`${BOARD}` not found. Please specify a valid board.\n"
|
||||
"Valid board identifiers for ${BOARD_NAME} are:\n${BOARD_IDENTIFIERS}\n")
|
||||
message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \
|
||||
`${BOARD}` not found. Please specify a valid board target.\n"
|
||||
"Valid board qualifiers for ${BOARD_NAME} are:\n${LIST_BOARD_QUALIFIERS}\n")
|
||||
endif()
|
||||
endif()
|
||||
else()
|
||||
|
@ -308,9 +308,9 @@ if(DEFINED BOARD_REVISION)
|
|||
string(REPLACE "." "_" BOARD_REVISION_STRING ${BOARD_REVISION})
|
||||
endif()
|
||||
|
||||
if(DEFINED BOARD_IDENTIFIER)
|
||||
string(REGEX REPLACE "^/" "identifier: " board_message_identifier "${BOARD_IDENTIFIER}")
|
||||
set(board_message "${board_message}, ${board_message_identifier}")
|
||||
if(DEFINED BOARD_QUALIFIERS)
|
||||
string(REGEX REPLACE "^/" "qualifiers: " board_message_qualifiers "${BOARD_QUALIFIERS}")
|
||||
set(board_message "${board_message}, ${board_message_qualifiers}")
|
||||
endif()
|
||||
|
||||
message(STATUS "${board_message}")
|
||||
|
|
|
@ -79,7 +79,7 @@ zephyr_get(DTC_OVERLAY_FILE SYSBUILD LOCAL)
|
|||
if(NOT DEFINED DTC_OVERLAY_FILE)
|
||||
zephyr_build_string(board_overlay_strings
|
||||
BOARD ${BOARD}
|
||||
BOARD_IDENTIFIER ${BOARD_IDENTIFIER}
|
||||
BOARD_QUALIFIERS ${BOARD_QUALIFIERS}
|
||||
MERGE
|
||||
)
|
||||
list(TRANSFORM board_overlay_strings APPEND ".overlay")
|
||||
|
|
|
@ -123,7 +123,7 @@ set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake)
|
|||
set(VENDOR_PREFIXES dts/bindings/vendor-prefixes.txt)
|
||||
|
||||
if(NOT DEFINED DTS_SOURCE)
|
||||
zephyr_build_string(dts_board_string BOARD ${BOARD} BOARD_IDENTIFIER ${BOARD_IDENTIFIER} MERGE)
|
||||
zephyr_build_string(dts_board_string BOARD ${BOARD} BOARD_QUALIFIERS ${BOARD_QUALIFIERS} MERGE)
|
||||
foreach(str ${dts_board_string})
|
||||
if(EXISTS ${BOARD_DIR}/${str}.dts)
|
||||
set(DTS_SOURCE ${BOARD_DIR}/${str}.dts)
|
||||
|
@ -140,7 +140,7 @@ if(EXISTS ${DTS_SOURCE})
|
|||
CONF_FILES ${BOARD_DIR}
|
||||
DTS no_rev_suffix_dts_board_overlays
|
||||
BOARD ${BOARD}
|
||||
BOARD_IDENTIFIER ${BOARD_IDENTIFIER}
|
||||
BOARD_QUALIFIERS ${BOARD_QUALIFIERS}
|
||||
)
|
||||
|
||||
# ...but remove the ones that do not include the revision suffix
|
||||
|
|
|
@ -1516,7 +1516,7 @@ endfunction()
|
|||
# When MERGE is supplied a list of build strings will be returned with the full
|
||||
# build string as first item in the list.
|
||||
# The full order of build strings returned in the list will be:
|
||||
# - Full build string, including identifier and revision
|
||||
# - Normalized board target build string, this includes qualifiers and revision
|
||||
# - Build string with board variants removed in addition
|
||||
# - Build string with cpuset removed in addition
|
||||
# - Build string with soc removed in addition
|
||||
|
@ -1530,7 +1530,7 @@ endfunction()
|
|||
# Usage:
|
||||
# zephyr_build_string(<out-variable>
|
||||
# BOARD <board>
|
||||
# [BOARD_IDENTIFIER <identifier>]
|
||||
# [BOARD_QUALIFIERS <qualifiers>]
|
||||
# [BOARD_REVISION <revision>]
|
||||
# [BUILD <type>]
|
||||
# [MERGE [REVERSE]]
|
||||
|
@ -1540,7 +1540,7 @@ endfunction()
|
|||
# BOARD <board>: Board name to use when creating the build string.
|
||||
# BOARD_REVISION <revision>: Board revision to use when creating the build string.
|
||||
# BUILD <type>: Build type to use when creating the build string.
|
||||
# MERGE: Return a list of build identifiers instead of a single build string.
|
||||
# MERGE: Return a list of build strings instead of a single build string.
|
||||
# REVERSE: Reverse the list before returning it.
|
||||
#
|
||||
# Examples
|
||||
|
@ -1553,17 +1553,17 @@ endfunction()
|
|||
# will return the string `alpha_1_0_0_debug` in `build_string` parameter.
|
||||
#
|
||||
# calling
|
||||
# zephyr_build_string(build_string BOARD alpha BOARD_IDENTIFIER /soc/bar)
|
||||
# zephyr_build_string(build_string BOARD alpha BOARD_QUALIFIERS /soc/bar)
|
||||
# will return the string `alpha_soc_bar` in `build_string` parameter.
|
||||
#
|
||||
# calling
|
||||
# zephyr_build_string(build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_IDENTIFIER /soc/bar MERGE)
|
||||
# zephyr_build_string(build_string BOARD alpha BOARD_REVISION 1.0.0 BOARD_QUALIFIERS /soc/bar MERGE)
|
||||
# will return a list of the following strings
|
||||
# `alpha_soc_bar_1_0_0;alpha_soc_bar;alpha_soc_1_0_0;alpha_soc;alpha_1_0_0;alpha` in `build_string` parameter.
|
||||
#
|
||||
function(zephyr_build_string outvar)
|
||||
set(options MERGE REVERSE)
|
||||
set(single_args BOARD BOARD_IDENTIFIER BOARD_REVISION BUILD)
|
||||
set(single_args BOARD BOARD_QUALIFIERS BOARD_REVISION BUILD)
|
||||
|
||||
cmake_parse_arguments(BUILD_STR "${options}" "${single_args}" "" ${ARGN})
|
||||
if(BUILD_STR_UNPARSED_ARGUMENTS)
|
||||
|
@ -1580,14 +1580,14 @@ function(zephyr_build_string outvar)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(DEFINED BUILD_STR_BOARD_IDENTIFIER AND NOT BUILD_STR_BOARD)
|
||||
if(DEFINED BUILD_STR_BOARD_QUALIFIERS AND NOT BUILD_STR_BOARD)
|
||||
message(FATAL_ERROR
|
||||
"zephyr_build_string(${ARGV0} <list> BOARD_IDENTIFIER ${BUILD_STR_BOARD_IDENTIFIER} ...)"
|
||||
"zephyr_build_string(${ARGV0} <list> BOARD_QUALIFIERS ${BUILD_STR_BOARD_QUALIFIERS} ...)"
|
||||
" given without BOARD argument, please specify BOARD"
|
||||
)
|
||||
endif()
|
||||
|
||||
string(REPLACE "/" ";" str_segment_list "${BUILD_STR_BOARD}${BUILD_STR_BOARD_IDENTIFIER}")
|
||||
string(REPLACE "/" ";" str_segment_list "${BUILD_STR_BOARD}${BUILD_STR_BOARD_QUALIFIERS}")
|
||||
string(REPLACE "." "_" revision_string "${BUILD_STR_BOARD_REVISION}")
|
||||
|
||||
string(JOIN "_" ${outvar} ${str_segment_list} ${revision_string} ${BUILD_STR_BUILD})
|
||||
|
@ -2531,7 +2531,7 @@ Please provide one of following: APPLICATION_ROOT, CONF_FILES")
|
|||
set(single_args APPLICATION_ROOT)
|
||||
elseif(${ARGV0} STREQUAL CONF_FILES)
|
||||
set(options REQUIRED)
|
||||
set(single_args BOARD BOARD_REVISION BOARD_IDENTIFIER DTS KCONF DEFCONFIG BUILD SUFFIX)
|
||||
set(single_args BOARD BOARD_REVISION BOARD_QUALIFIERS DTS KCONF DEFCONFIG BUILD SUFFIX)
|
||||
set(multi_args CONF_FILES NAMES)
|
||||
endif()
|
||||
|
||||
|
@ -2590,8 +2590,8 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
|
|||
set(FILE_BOARD_REVISION ${BOARD_REVISION})
|
||||
endif()
|
||||
|
||||
if(DEFINED BOARD_IDENTIFIER)
|
||||
set(FILE_BOARD_IDENTIFIER ${BOARD_IDENTIFIER})
|
||||
if(DEFINED BOARD_QUALIFIERS)
|
||||
set(FILE_BOARD_QUALIFIERS ${BOARD_QUALIFIERS})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -2602,7 +2602,7 @@ Relative paths are only allowed with `-D${ARGV1}=<path>`")
|
|||
zephyr_build_string(filename_list
|
||||
BOARD ${FILE_BOARD}
|
||||
BOARD_REVISION ${FILE_BOARD_REVISION}
|
||||
BOARD_IDENTIFIER ${FILE_BOARD_IDENTIFIER}
|
||||
BOARD_QUALIFIERS ${FILE_BOARD_QUALIFIERS}
|
||||
BUILD ${FILE_BUILD}
|
||||
MERGE REVERSE
|
||||
)
|
||||
|
|
|
@ -81,7 +81,7 @@ endif()
|
|||
if(DEFINED BOARD_REVISION)
|
||||
zephyr_build_string(config_board_string
|
||||
BOARD ${BOARD}
|
||||
BOARD_IDENTIFIER ${BOARD_IDENTIFIER}
|
||||
BOARD_QUALIFIERS ${BOARD_QUALIFIERS}
|
||||
BOARD_REVISION ${BOARD_REVISION}
|
||||
)
|
||||
set(board_rev_file ${config_board_string})
|
||||
|
@ -160,7 +160,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS
|
|||
BOARD_DIR=${BOARD_DIR}
|
||||
BOARD=${BOARD}
|
||||
BOARD_REVISION=${BOARD_REVISION}
|
||||
BOARD_IDENTIFIER=${BOARD_IDENTIFIER}
|
||||
BOARD_QUALIFIERS=${BOARD_QUALIFIERS}
|
||||
HWM_SCHEME=${HWM}
|
||||
KCONFIG_BINARY_DIR=${KCONFIG_BINARY_DIR}
|
||||
APPLICATION_SOURCE_DIR=${APPLICATION_SOURCE_DIR}
|
||||
|
|
|
@ -122,8 +122,8 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]:
|
|||
board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", board.name).upper()
|
||||
f.write('config ' + board_str + '\n')
|
||||
f.write('\t bool\n')
|
||||
for identifier in list_boards.board_v2_identifiers(board):
|
||||
board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", identifier).upper()
|
||||
for qualifier in list_boards.board_v2_qualifiers(board):
|
||||
board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", qualifier).upper()
|
||||
f.write('config ' + board_str + '\n')
|
||||
f.write('\t bool\n')
|
||||
f.write('source "' + (board.dir / ('Kconfig.' + board.name)).as_posix() + '"\n\n')
|
||||
|
|
|
@ -270,9 +270,9 @@ Your board directory should look like this:
|
|||
├── Kconfig.plank
|
||||
├── Kconfig.defconfig
|
||||
├── plank_defconfig
|
||||
├── plank_<identifier>_defconfig
|
||||
├── plank_<qualifiers>_defconfig
|
||||
├── plank.dts
|
||||
├── plank_<identifier>.dts
|
||||
├── plank_<qualifiers>.dts
|
||||
└── plank.yaml
|
||||
|
||||
Replace ``plank`` with your board's name, of course.
|
||||
|
@ -284,7 +284,7 @@ The mandatory files are:
|
|||
CPU clusters for multi-core SoCs are not described in this file as they are
|
||||
inherited from the SoC's YAML description.
|
||||
|
||||
#. :file:`plank.dts` or :file:`plank_<identifier>.dts`: a hardware description
|
||||
#. :file:`plank.dts` or :file:`plank_<qualifiers>.dts`: a hardware description
|
||||
in :ref:`devicetree <dt-guide>` format. This declares your SoC, connectors,
|
||||
and any other hardware components such as LEDs, buttons, sensors, or
|
||||
communication peripherals (USB, BLE controller, etc).
|
||||
|
@ -300,7 +300,7 @@ The optional files are:
|
|||
- :file:`Kconfig`, :file:`Kconfig.defconfig` software configuration in
|
||||
:ref:`kconfig` formats. This provides default settings for software features
|
||||
and peripheral drivers.
|
||||
- :file:`plank_defconfig` and :file:`plank_<identifier>_defconfig`: software
|
||||
- :file:`plank_defconfig` and :file:`plank_<qualifiers>_defconfig`: software
|
||||
configuration in Kconfig ``.conf`` format.
|
||||
- :file:`board.cmake`: used for :ref:`flash-and-debug-support`
|
||||
- :file:`CMakeLists.txt`: if you need to add additional source files to
|
||||
|
@ -311,7 +311,7 @@ The optional files are:
|
|||
- :file:`plank.yaml`: a YAML file with miscellaneous metadata used by the
|
||||
:ref:`twister_script`.
|
||||
|
||||
Board identifiers of the form ``<soc>/<cpucluster>/<variant>`` are sanitized so
|
||||
Board qualifiers of the form ``<soc>/<cpucluster>/<variant>`` are normalized so
|
||||
that ``/`` is replaced with ``_`` when used for filenames, for example:
|
||||
``soc1/foo`` becomes ``soc1_foo`` when used in filenames.
|
||||
|
||||
|
@ -374,7 +374,7 @@ Write your devicetree
|
|||
*********************
|
||||
|
||||
The devicetree file :file:`boards/<vendor>/plank/plank.dts` or
|
||||
:file:`boards/<vendor>/plank/plank_<identifier>.dts` describes your board
|
||||
:file:`boards/<vendor>/plank/plank_<qualifiers>.dts` describes your board
|
||||
hardware in the Devicetree Source (DTS) format (as usual, change ``plank`` to
|
||||
your board's name). If you're new to devicetree, see :ref:`devicetree-intro`.
|
||||
|
||||
|
@ -524,7 +524,7 @@ files for a board named ``plank``:
|
|||
├── Kconfig.plank
|
||||
├── Kconfig.defconfig
|
||||
├── plank_defconfig
|
||||
└── plank_<identifier>_defconfig
|
||||
└── plank_<qualifiers>_defconfig
|
||||
|
||||
:file:`Kconfig.plank`
|
||||
A shared Kconfig file which can be sourced both in Zephyr Kconfig and sysbuild
|
||||
|
@ -542,7 +542,7 @@ files for a board named ``plank``:
|
|||
select SOC_SOC1
|
||||
|
||||
The Kconfig symbols :kconfig:option:`BOARD_<board>` and
|
||||
:kconfig:option:`BOARD_<board_with_identifier>` are constructed by the build
|
||||
:kconfig:option:`BOARD_<normalized_board_target>` are constructed by the build
|
||||
system, therefore no type shall be defined in above code snippet.
|
||||
|
||||
:file:`Kconfig`
|
||||
|
@ -593,17 +593,17 @@ files for a board named ``plank``:
|
|||
|
||||
endif # BOARD_PLANK
|
||||
|
||||
:file:`plank_defconfig` / :file:`plank_<identifier>_defconfig`
|
||||
:file:`plank_defconfig` / :file:`plank_<qualifiers>_defconfig`
|
||||
A Kconfig fragment that is merged as-is into the final build directory
|
||||
:file:`.config` whenever an application is compiled for your board.
|
||||
|
||||
If both the common :file:`plank_defconfig` file and one or more board
|
||||
identifier specific :file:`plank_<identifier>_defconfig` files exist, then
|
||||
qualifiers specific :file:`plank_<qualifiers>_defconfig` files exist, then
|
||||
all matching files will be used.
|
||||
This allows you to place configuration which is common for all board SoCs,
|
||||
CPU clusters, and board variants in the base :file:`plank_defconfig` and only
|
||||
place the adjustments specific for a given SoC or board variant in the
|
||||
:file:`plank_<identifier>_defconfig`.
|
||||
:file:`plank_<qualifiers>_defconfig`.
|
||||
|
||||
The ``_defconfig`` should contain mandatory settings for your system clock,
|
||||
console, etc. The results are architecture-specific, but typically look
|
||||
|
@ -614,7 +614,7 @@ files for a board named ``plank``:
|
|||
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=120000000 # set up your clock, etc
|
||||
CONFIG_SERIAL=y
|
||||
|
||||
:file:`plank_x_y_z_defconfig` / :file:`plank_<identifier>_x_y_z_defconfig`
|
||||
:file:`plank_x_y_z_defconfig` / :file:`plank_<qualifiers>_x_y_z_defconfig`
|
||||
A Kconfig fragment that is merged as-is into the final build directory
|
||||
:file:`.config` whenever an application is compiled for your board revision
|
||||
``x.y.z``.
|
||||
|
@ -828,21 +828,21 @@ adjustments to the board's normal configuration.
|
|||
|
||||
As described in the :ref:`default_board_configuration` and
|
||||
:ref:`board_kconfig_files` sections the board default configuration is created
|
||||
from the files :file:`<board>.dts` / :file:`<board>_<identifier>.dts` and
|
||||
:file:`<board>_defconfig` / :file:`<board>_<identifier>_defconfig`.
|
||||
from the files :file:`<board>.dts` / :file:`<board>_<qualifiers>.dts` and
|
||||
:file:`<board>_defconfig` / :file:`<board>_<qualifiers>_defconfig`.
|
||||
When building for a specific board revision, the above files are used as a
|
||||
starting point and the following board files will be used in addition:
|
||||
|
||||
- :file:`<board>_<identifier>_<revision>_defconfig`: a specific revision
|
||||
- :file:`<board>_<qualifiers>_<revision>_defconfig`: a specific revision
|
||||
defconfig which is only used for the board and SOC / variants identified by
|
||||
``<board>_<identifier>``.
|
||||
``<board>_<qualifiers>``.
|
||||
|
||||
- :file:`<board>_<revision>_defconfig`: a specific revision defconfig which is
|
||||
used for the board regardless of the SOC / variants.
|
||||
|
||||
- :file:`<board>_<identifier>_<revision>.overlay`: a specific revision dts
|
||||
- :file:`<board>_<qualifiers>_<revision>.overlay`: a specific revision dts
|
||||
overlay which is only used for the board and SOC / variants identified by
|
||||
``<board>_<identifier>``.
|
||||
``<board>_<qualifiers>``.
|
||||
|
||||
- :file:`<board>_<revision>.overlay`: a specific revision dts overlay which is
|
||||
used for the board regardless of the SOC / variants.
|
||||
|
@ -858,8 +858,8 @@ revision adjustments:
|
|||
.. code-block:: none
|
||||
|
||||
boards/zephyr/plank
|
||||
├── plank_0_5_0_defconfig # Kconfig adjustment for all plank board identifiers on revision 0.5.0
|
||||
├── plank_0_5_0.overlay # DTS overlay for all plank board identifiers on revision 0.5.0
|
||||
├── plank_0_5_0_defconfig # Kconfig adjustment for all plank board qualifiers on revision 0.5.0
|
||||
├── plank_0_5_0.overlay # DTS overlay for all plank board qualifiers on revision 0.5.0
|
||||
└── plank_soc1_foo_1_5_0_defconfig # Kconfig adjustment for plank board when building for soc1 variant foo on revision 1.5.0
|
||||
|
||||
Custom revision.cmake files
|
||||
|
|
|
@ -15,7 +15,7 @@ test it.
|
|||
Annotated Example Output
|
||||
************************
|
||||
|
||||
The sample first displays the boot banner, board identifier and
|
||||
The sample first displays the boot banner, board name and
|
||||
frequency of the local clock used for synchronization, and whether the
|
||||
DS3231 has recorded a loss-of-oscillator::
|
||||
|
||||
|
|
|
@ -448,8 +448,8 @@ class KconfigCheck(ComplianceTest):
|
|||
board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", board.name).upper()
|
||||
fp.write('config ' + board_str + '\n')
|
||||
fp.write('\t bool\n')
|
||||
for identifier in list_boards.board_v2_identifiers(board):
|
||||
board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", identifier).upper()
|
||||
for qualifier in list_boards.board_v2_qualifiers(board):
|
||||
board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", qualifier).upper()
|
||||
fp.write('config ' + board_str + '\n')
|
||||
fp.write('\t bool\n')
|
||||
fp.write(
|
||||
|
|
|
@ -842,12 +842,12 @@ def dt_gpio_hogs_enabled(kconf, _):
|
|||
return "n"
|
||||
|
||||
|
||||
def sanitize_upper(kconf, _, string):
|
||||
def normalize_upper(kconf, _, string):
|
||||
"""
|
||||
Sanitize the string, so that the string only contains alpha-numeric
|
||||
Normalize the string, so that the string only contains alpha-numeric
|
||||
characters or underscores. All non-alpha-numeric characters are replaced
|
||||
with an underscore, '_'.
|
||||
When string has been sanitized it will be converted into upper case.
|
||||
When string has been normalized it will be converted into upper case.
|
||||
"""
|
||||
return re.sub(r'[^a-zA-Z0-9_]', '_', string).upper()
|
||||
|
||||
|
@ -919,6 +919,6 @@ functions = {
|
|||
"dt_gpio_hogs_enabled": (dt_gpio_hogs_enabled, 0, 0),
|
||||
"dt_chosen_partition_addr_int": (dt_chosen_partition_addr, 1, 3),
|
||||
"dt_chosen_partition_addr_hex": (dt_chosen_partition_addr, 1, 3),
|
||||
"sanitize_upper": (sanitize_upper, 1, 1),
|
||||
"normalize_upper": (normalize_upper, 1, 1),
|
||||
"shields_list_contains": (shields_list_contains, 1, 1),
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@ BOARD_YML = 'board.yml'
|
|||
# 'ninja boards' in a build directory without west installed.)
|
||||
#
|
||||
|
||||
|
||||
@dataclass
|
||||
class Revision:
|
||||
name: str
|
||||
|
@ -42,7 +43,6 @@ class Revision:
|
|||
return Revision(revision['name'], revisions)
|
||||
|
||||
|
||||
|
||||
@dataclass
|
||||
class Variant:
|
||||
name: str
|
||||
|
@ -100,15 +100,18 @@ class Board:
|
|||
def board_key(board):
|
||||
return board.name
|
||||
|
||||
|
||||
def find_arch2boards(args):
|
||||
arch2board_set = find_arch2board_set(args)
|
||||
return {arch: sorted(arch2board_set[arch], key=board_key)
|
||||
for arch in arch2board_set}
|
||||
|
||||
|
||||
def find_boards(args):
|
||||
return sorted(itertools.chain(*find_arch2board_set(args).values()),
|
||||
key=board_key)
|
||||
|
||||
|
||||
def find_arch2board_set(args):
|
||||
arches = sorted(find_arches(args))
|
||||
ret = defaultdict(set)
|
||||
|
@ -122,6 +125,7 @@ def find_arch2board_set(args):
|
|||
|
||||
return ret
|
||||
|
||||
|
||||
def find_arches(args):
|
||||
arch_set = set()
|
||||
|
||||
|
@ -130,6 +134,7 @@ def find_arches(args):
|
|||
|
||||
return arch_set
|
||||
|
||||
|
||||
def find_arches_in(root):
|
||||
ret = set()
|
||||
arch = root / 'arch'
|
||||
|
@ -145,6 +150,7 @@ def find_arches_in(root):
|
|||
|
||||
return ret
|
||||
|
||||
|
||||
def find_arch2board_set_in(root, arches, board_dir):
|
||||
ret = defaultdict(set)
|
||||
boards = root / 'boards'
|
||||
|
@ -184,7 +190,7 @@ def load_v2_boards(board_name, board_yml, systems):
|
|||
sys.exit(f'ERROR: Malformed content in file: {board_yml.as_posix()}\n'
|
||||
f'{mutual_exclusive} are mutual exclusive at this level.')
|
||||
|
||||
board_array = b.get('boards', [ b.get('board', None) ])
|
||||
board_array = b.get('boards', [b.get('board', None)])
|
||||
for board in board_array:
|
||||
if board_name is not None:
|
||||
if board['name'] != board_name:
|
||||
|
@ -269,40 +275,40 @@ def add_args_formatting(parser):
|
|||
help='''CMake Format string to use to list each board''')
|
||||
|
||||
|
||||
def variant_v2_identifiers(variant, identifier):
|
||||
identifiers = [identifier + '/' + variant.name]
|
||||
def variant_v2_qualifiers(variant, qualifiers):
|
||||
qualifiers_list = [qualifiers + '/' + variant.name]
|
||||
for v in variant.variants:
|
||||
identifiers.extend(variant_v2_identifiers(v, identifier + '/' + variant.name))
|
||||
return identifiers
|
||||
qualifiers_list.extend(variant_v2_qualifiers(v, qualifiers + '/' + variant.name))
|
||||
return qualifiers_list
|
||||
|
||||
|
||||
def board_v2_identifiers(board):
|
||||
identifiers = []
|
||||
def board_v2_qualifiers(board):
|
||||
qualifiers_list = []
|
||||
|
||||
for s in board.socs:
|
||||
if s.cpuclusters:
|
||||
for c in s.cpuclusters:
|
||||
id_str = board.name + '/' + s.name + '/' + c.name
|
||||
identifiers.append(id_str)
|
||||
qualifiers_list.append(id_str)
|
||||
for v in c.variants:
|
||||
identifiers.extend(variant_v2_identifiers(v, id_str))
|
||||
qualifiers_list.extend(variant_v2_qualifiers(v, id_str))
|
||||
else:
|
||||
id_str = board.name + '/' + s.name
|
||||
identifiers.append(id_str)
|
||||
qualifiers_list.append(id_str)
|
||||
for v in s.variants:
|
||||
identifiers.extend(variant_v2_identifiers(v, id_str))
|
||||
qualifiers_list.extend(variant_v2_qualifiers(v, id_str))
|
||||
|
||||
if not board.socs:
|
||||
identifiers.append(board.name)
|
||||
qualifiers_list.append(board.name)
|
||||
|
||||
for v in board.variants:
|
||||
identifiers.extend(variant_v2_identifiers(v, board.name))
|
||||
return identifiers
|
||||
qualifiers_list.extend(variant_v2_qualifiers(v, board.name))
|
||||
return qualifiers_list
|
||||
|
||||
|
||||
def board_v2_identifiers_csv(board):
|
||||
def board_v2_qualifiers_csv(board):
|
||||
# Return in csv (comma separated value) format
|
||||
return ",".join(board_v2_identifiers(board))
|
||||
return ",".join(board_v2_qualifiers(board))
|
||||
|
||||
|
||||
def dump_v2_boards(args):
|
||||
|
@ -314,7 +320,7 @@ def dump_v2_boards(args):
|
|||
boards = find_v2_boards(args)
|
||||
|
||||
for b in boards:
|
||||
identifiers = board_v2_identifiers(b)
|
||||
qualifiers_list = board_v2_qualifiers(b)
|
||||
if args.cmakeformat is not None:
|
||||
notfound = lambda x: x or 'NOTFOUND'
|
||||
info = args.cmakeformat.format(
|
||||
|
@ -328,7 +334,7 @@ def dump_v2_boards(args):
|
|||
REVISIONS='REVISIONS;' + ';'.join(
|
||||
[x.name for x in b.revisions]),
|
||||
SOCS='SOCS;' + ';'.join([s.name for s in b.socs]),
|
||||
IDENTIFIERS='IDENTIFIERS;' + ';'.join(identifiers)
|
||||
QUALIFIERS='QUALIFIERS;' + ';'.join(qualifiers_list)
|
||||
)
|
||||
print(info)
|
||||
else:
|
||||
|
@ -353,7 +359,7 @@ def dump_boards(args):
|
|||
REVISIONS='REVISIONS;NOTFOUND',
|
||||
VARIANT_DEFAULT='VARIANT_DEFAULT;NOTFOUND',
|
||||
SOCS='SOCS;',
|
||||
IDENTIFIERS='IDENTIFIERS;'
|
||||
QUALIFIERS='QUALIFIERS;'
|
||||
)
|
||||
print(info)
|
||||
else:
|
||||
|
|
|
@ -159,11 +159,11 @@ zephyr_create_scope(snippets)
|
|||
board_re = board[1:-1]
|
||||
self.print(f'''\
|
||||
# Appends for board regular expression '{board_re}'
|
||||
if("${{BOARD}}${{BOARD_IDENTIFIER}}" MATCHES "^{board_re}$")''')
|
||||
if("${{BOARD}}${{BOARD_QUALIFIERS}}" MATCHES "^{board_re}$")''')
|
||||
else:
|
||||
self.print(f'''\
|
||||
# Appends for board '{board}'
|
||||
if("${{BOARD}}${{BOARD_IDENTIFIER}}" STREQUAL "{board}")''')
|
||||
if("${{BOARD}}${{BOARD_QUALIFIERS}}" STREQUAL "{board}")''')
|
||||
self.print_appends(appends, 1)
|
||||
self.print('endif()')
|
||||
|
||||
|
|
|
@ -49,8 +49,9 @@ class Boards(WestCommand):
|
|||
The following arguments are available:
|
||||
|
||||
- name: board name
|
||||
- identifiers: board identifiers
|
||||
- arch: board architecture
|
||||
- qualifiers: board qualifiers (will be empty for legacy boards)
|
||||
- arch: board architecture (deprecated)
|
||||
(arch is ambiguous for boards described in new hw model)
|
||||
- dir: directory that contains the board definition
|
||||
'''))
|
||||
|
||||
|
@ -87,10 +88,10 @@ class Boards(WestCommand):
|
|||
if name_re is not None and not name_re.search(board.name):
|
||||
continue
|
||||
log.inf(args.format.format(name=board.name, arch=board.arch,
|
||||
dir=board.dir, hwm=board.hwm, identifiers=''))
|
||||
dir=board.dir, hwm=board.hwm, qualifiers=''))
|
||||
|
||||
for board in list_boards.find_v2_boards(args):
|
||||
if name_re is not None and not name_re.search(board.name):
|
||||
continue
|
||||
log.inf(args.format.format(name=board.name, dir=board.dir, hwm=board.hwm,
|
||||
identifiers=list_boards.board_v2_identifiers_csv(board)))
|
||||
log.inf(args.format.format(name=board.name, arch='', dir=board.dir, hwm=board.hwm,
|
||||
qualifiers=list_boards.board_v2_qualifiers_csv(board)))
|
||||
|
|
|
@ -146,9 +146,9 @@ function(sysbuild_cache)
|
|||
endif()
|
||||
endforeach()
|
||||
if(DEFINED BOARD_REVISION)
|
||||
list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}@${BOARD_REVISION}${BOARD_IDENTIFIER}\n")
|
||||
list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}@${BOARD_REVISION}${BOARD_QUALIFIERS}\n")
|
||||
else()
|
||||
list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}${BOARD_IDENTIFIER}\n")
|
||||
list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}${BOARD_QUALIFIERS}\n")
|
||||
endif()
|
||||
list(APPEND sysbuild_cache_strings "SYSBUILD_NAME:STRING=${SB_CACHE_APPLICATION}\n")
|
||||
|
||||
|
|
Loading…
Reference in a new issue