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