From 9f12f8afb2cf6c89b43f65b7b0e954a5affc0c04 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 14 Nov 2024 08:48:17 +0000 Subject: [PATCH] infrastructure: Remove hwmv1 support Removes support for the deprecated hardware model version 1 Signed-off-by: Jamie McCrae --- arch/Kconfig | 2 +- arch/Kconfig.v1 | 5 - arch/Kconfig.v2 | 5 - boards/Kconfig | 5 +- boards/Kconfig.v1 | 14 --- cmake/modules/{arch_v2.cmake => arch.cmake} | 0 cmake/modules/arch_v1.cmake | 54 -------- cmake/modules/boards.cmake | 115 +++++++----------- cmake/modules/kconfig.cmake | 45 ++----- cmake/modules/pre_dt.cmake | 10 +- cmake/modules/{soc_v2.cmake => soc.cmake} | 0 cmake/modules/soc_v1.cmake | 75 ------------ cmake/modules/unittest.cmake | 4 +- cmake/modules/zephyr_default.cmake | 6 +- share/sysbuild/Kconfig | 31 ++++- share/sysbuild/Kconfig.v1 | 5 - share/sysbuild/Kconfig.v2 | 4 +- .../cmake/modules/sysbuild_extensions.cmake | 28 ++--- soc/CMakeLists.txt | 66 ++++------ soc/Kconfig | 4 +- soc/Kconfig.v1 | 25 ---- soc/Kconfig.v1.choice | 11 -- subsys/testsuite/arch/Kconfig.v1 | 4 - 23 files changed, 131 insertions(+), 387 deletions(-) delete mode 100644 arch/Kconfig.v1 delete mode 100644 arch/Kconfig.v2 delete mode 100644 boards/Kconfig.v1 rename cmake/modules/{arch_v2.cmake => arch.cmake} (100%) delete mode 100644 cmake/modules/arch_v1.cmake rename cmake/modules/{soc_v2.cmake => soc.cmake} (100%) delete mode 100644 cmake/modules/soc_v1.cmake delete mode 100644 share/sysbuild/Kconfig.v1 delete mode 100644 soc/Kconfig.v1 delete mode 100644 soc/Kconfig.v1.choice delete mode 100644 subsys/testsuite/arch/Kconfig.v1 diff --git a/arch/Kconfig b/arch/Kconfig index 1b31a2867db..a6fffdea93f 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -8,7 +8,7 @@ # Include these first so that any properties (e.g. defaults) below can be # overridden (by defining symbols in multiple locations) -source "$(ARCH_DIR)/Kconfig.$(HWM_SCHEME)" +source "$(KCONFIG_BINARY_DIR)/arch/Kconfig" # ToDo: Generate a Kconfig.arch for loading of additional arch in HWMv2. osource "$(KCONFIG_BINARY_DIR)/Kconfig.arch" diff --git a/arch/Kconfig.v1 b/arch/Kconfig.v1 deleted file mode 100644 index d76acba59a3..00000000000 --- a/arch/Kconfig.v1 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -# Note: $ARCH might be a glob pattern -source "$(ARCH_DIR)/$(ARCH)/Kconfig" diff --git a/arch/Kconfig.v2 b/arch/Kconfig.v2 deleted file mode 100644 index 19db8d46246..00000000000 --- a/arch/Kconfig.v2 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA - -# SPDX-License-Identifier: Apache-2.0 - -source "$(KCONFIG_BINARY_DIR)/arch/Kconfig" diff --git a/boards/Kconfig b/boards/Kconfig index 40e8e5006e1..71b3b9571ad 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -2,8 +2,7 @@ config BOARD string - # When using hw model v2, then the board is inherited from CMake. - default "$(BOARD)" if "$(HWM_SCHEME)" = "v2" + default "$(BOARD)" help This option holds the name of the board and is used to locate the files related to the board in the source tree (under boards/). @@ -53,7 +52,7 @@ config NET_DRIVERS When building for a qemu target then NET_DRIVERS will be default enabled to allow for easy use of SLIP or PPP -rsource "Kconfig.$(HWM_SCHEME)" +rsource "Kconfig.v2" # Parse shields references # Don't do it as a menuconfig, as shield selection is a CMake feature. diff --git a/boards/Kconfig.v1 b/boards/Kconfig.v1 deleted file mode 100644 index c98bd27d2db..00000000000 --- a/boards/Kconfig.v1 +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2022 Nordic Semiconductor ASA - -# SPDX-License-Identifier: Apache-2.0 - -# In HWMv1 the KCONFIG_BOARD_DIR points directly to the BOARD_DIR. -# Set the BOARD_DIR variable for backwards compatibility to legacy hardware model. -BOARD_DIR := $(KCONFIG_BOARD_DIR) - -choice - prompt "Board Selection" - -source "$(KCONFIG_BOARD_DIR)/Kconfig.board" - -endchoice diff --git a/cmake/modules/arch_v2.cmake b/cmake/modules/arch.cmake similarity index 100% rename from cmake/modules/arch_v2.cmake rename to cmake/modules/arch.cmake diff --git a/cmake/modules/arch_v1.cmake b/cmake/modules/arch_v1.cmake deleted file mode 100644 index 613182f0723..00000000000 --- a/cmake/modules/arch_v1.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (c) 2022, Nordic Semiconductor ASA - -# -# This CMake module is only valid for hw model v1. -# In hw model v1, then arch is determined by the board folder structure. -# -# Configure ARCH settings based on board directory and arch root. -# -# This CMake module will set the following variables in the build system based -# on board directory and arch root. -# -# If no implementation is available for the current arch an error will be raised. -# -# Outcome: -# The following variables will be defined when this CMake module completes: -# -# - ARCH: Name of the arch in use. -# - ARCH_DIR: Directory containing the arch implementation. -# - ARCH_ROOT: ARCH_ROOT with ZEPHYR_BASE appended -# -# Variable dependencies: -# - ARCH_ROOT: CMake list of arch roots containing arch implementations -# - BOARD_DIR: CMake variable specifying the directory of the selected BOARD -# -# Variables set by this module and not mentioned above are considered internal -# use only and may be removed, renamed, or re-purposed without prior notice. - -include_guard(GLOBAL) - -if(HWMv1) - # 'ARCH_ROOT' is a prioritized list of directories where archs may be - # found. It always includes ${ZEPHYR_BASE} at the lowest priority (except for unittesting). - if(NOT unittest IN_LIST Zephyr_FIND_COMPONENTS) - list(APPEND ARCH_ROOT ${ZEPHYR_BASE}) - endif() - - cmake_path(GET BOARD_DIR PARENT_PATH board_arch_dir) - cmake_path(GET board_arch_dir FILENAME ARCH) - - foreach(root ${ARCH_ROOT}) - if(EXISTS ${root}/arch/${ARCH}/CMakeLists.txt) - set(ARCH_DIR ${root}/arch) - break() - endif() - endforeach() - - if(NOT ARCH_DIR) - message(FATAL_ERROR "Could not find ARCH=${ARCH} for BOARD=${BOARD}, \ -please check your installation. ARCH roots searched: \n\ -${ARCH_ROOT}") - endif() -endif() diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index 3f086dca948..9d75ff377ff 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -141,8 +141,7 @@ Hints: endif() endforeach() -if((HWMv1 AND NOT EXISTS ${BOARD_DIR}/${BOARD}_defconfig) - OR (HWMv2 AND NOT EXISTS ${BOARD_DIR}/board.yml)) +if(HWMv2 AND NOT EXISTS ${BOARD_DIR}/board.yml) message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. " "Trying to find new location." ) @@ -209,9 +208,8 @@ if(NOT "${ret_board}" STREQUAL "") endforeach() # 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. + # CMake variable: HWM=v2 + # CMake variable: HWMv2=True set(HWM ${LIST_BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version") set(HWM${HWM} True CACHE INTERNAL "Zephyr hardware model") elseif(BOARD_DIR) @@ -228,86 +226,67 @@ else() message(FATAL_ERROR "Invalid BOARD; see above.") endif() -if(HWMv1 AND DEFINED BOARD_QUALIFIERS) - message(FATAL_ERROR - "Board '${BOARD}' does not support board qualifiers, ${BOARD}${BOARD_QUALIFIERS}.\n" - "Please specify board without qualifiers.\n" - ) -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. +if(LIST_BOARD_REVISION_FORMAT) + if(LIST_BOARD_REVISION_FORMAT STREQUAL "custom") 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.") - endif() -elseif(HWMv2) - if(LIST_BOARD_REVISION_FORMAT) - if(LIST_BOARD_REVISION_FORMAT STREQUAL "custom") - 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() - - 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 ${LIST_BOARD_REVISION_DEFAULT} - VALID_REVISIONS ${LIST_BOARD_REVISIONS} - ${rev_exact} - ) - endif() - elseif(DEFINED BOARD_REVISION) + else() if(EXISTS ${BOARD_DIR}/revision.cmake) message(WARNING - "revision.cmake is not used, revisions must be defined in '${BOARD_DIR}/board.yml'" + "revision.cmake ignored, revision.cmake is only used for revision format: 'custom'" ) endif() - message(FATAL_ERROR "Invalid board revision: ${BOARD_REVISION}\n" - "Board '${BOARD}' does not define any revisions." + 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 ${LIST_BOARD_REVISION_DEFAULT} + VALID_REVISIONS ${LIST_BOARD_REVISIONS} + ${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() - if(LIST_BOARD_QUALIFIERS) - # Allow users to omit the SoC when building for a board with a single SoC. - list(LENGTH LIST_BOARD_SOCS socs_length) - 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() - endif() + message(FATAL_ERROR "Invalid board revision: ${BOARD_REVISION}\n" + "Board '${BOARD}' does not define any revisions." + ) +endif() - 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}") - unset(CACHED_BOARD CACHE) - message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \ - `${BOARD}` not found. Please specify a valid board target.\n" - "Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n") +if(LIST_BOARD_QUALIFIERS) + # Allow users to omit the SoC when building for a board with a single SoC. + list(LENGTH LIST_BOARD_SOCS socs_length) + 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() endif() -else() - message(FATAL_ERROR "Unknown hw model (${HWM}) for board: ${BOARD}.") + + 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}") + unset(CACHED_BOARD CACHE) + message(FATAL_ERROR "Board qualifiers `${BOARD_QUALIFIERS}` for board \ + `${BOARD}` not found. Please specify a valid board target.\n" + "Valid board targets for ${LIST_BOARD_NAME} are:\n${board_targets}\n") + endif() endif() set(board_message "Board: ${BOARD}") diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index af8c1e33fa7..d4d22508d0b 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -24,30 +24,6 @@ set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Kconfig) set(KCONFIG_BOARD_DIR ${KCONFIG_BINARY_DIR}/boards) file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}) -if(HWMv1) - # HWMv1 only supoorts a single board dir which points directly to the board dir. - set(KCONFIG_BOARD_DIR ${BOARD_DIR}) - # Support multiple SOC_ROOT - file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}/soc) - set(kconfig_soc_root ${SOC_ROOT}) - list(REMOVE_ITEM kconfig_soc_root ${ZEPHYR_BASE}) - set(soc_defconfig_file ${KCONFIG_BINARY_DIR}/soc/Kconfig.defconfig) - - set(OPERATION WRITE) - foreach(root ${kconfig_soc_root}) - file(APPEND ${soc_defconfig_file} - "osource \"${root}/soc/$(ARCH)/*/Kconfig.defconfig\"\n") - file(${OPERATION} ${KCONFIG_BINARY_DIR}/soc/Kconfig.soc.choice - "osource \"${root}/soc/$(ARCH)/*/Kconfig.soc\"\n" - ) - file(${OPERATION} ${KCONFIG_BINARY_DIR}/soc/Kconfig.soc.arch - "osource \"${root}/soc/$(ARCH)/Kconfig\"\n" - "osource \"${root}/soc/$(ARCH)/*/Kconfig\"\n" - ) - set(OPERATION APPEND) - endforeach() -endif() - # Support multiple shields in BOARD_ROOT, remove ZEPHYR_BASE as that is always sourced. set(kconfig_board_root ${BOARD_ROOT}) list(REMOVE_ITEM kconfig_board_root ${ZEPHYR_BASE}) @@ -176,20 +152,13 @@ set(COMMON_KCONFIG_ENV_SETTINGS ${ZEPHYR_KCONFIG_MODULES_DIR} ) -if(HWMv1) - list(APPEND COMMON_KCONFIG_ENV_SETTINGS - ARCH=${ARCH} - ARCH_DIR=${ARCH_DIR} - ) -else() - # For HWMv2 we should in future generate a Kconfig.arch.v2 which instead - # glob-sources all arch roots, but for Zephyr itself, the current approach is - # sufficient. - list(APPEND COMMON_KCONFIG_ENV_SETTINGS - ARCH=* - ARCH_DIR=${ZEPHYR_BASE}/arch - ) -endif() +# For HWMv2 we should in future generate a Kconfig.arch.v2 which instead +# glob-sources all arch roots, but for Zephyr itself, the current approach is +# sufficient. +list(APPEND COMMON_KCONFIG_ENV_SETTINGS + ARCH=* + ARCH_DIR=${ZEPHYR_BASE}/arch +) # Allow out-of-tree users to add their own Kconfig python frontend # targets by appending targets to the CMake list diff --git a/cmake/modules/pre_dt.cmake b/cmake/modules/pre_dt.cmake index 982cdc6e4a7..f8e2a80ec56 100644 --- a/cmake/modules/pre_dt.cmake +++ b/cmake/modules/pre_dt.cmake @@ -60,13 +60,9 @@ function(pre_dt_module_run) # Finalize DTS_ROOT. list(REMOVE_DUPLICATES DTS_ROOT) - if(HWMv1) - set(arch_include dts/${ARCH}) - else() - foreach(arch ${ARCH_V2_NAME_LIST}) - list(APPEND arch_include dts/${arch}) - endforeach() - endif() + foreach(arch ${ARCH_V2_NAME_LIST}) + list(APPEND arch_include dts/${arch}) + endforeach() # Finalize DTS_ROOT_SYSTEM_INCLUDE_DIRS. set(DTS_ROOT_SYSTEM_INCLUDE_DIRS) diff --git a/cmake/modules/soc_v2.cmake b/cmake/modules/soc.cmake similarity index 100% rename from cmake/modules/soc_v2.cmake rename to cmake/modules/soc.cmake diff --git a/cmake/modules/soc_v1.cmake b/cmake/modules/soc_v1.cmake deleted file mode 100644 index e2004f32255..00000000000 --- a/cmake/modules/soc_v1.cmake +++ /dev/null @@ -1,75 +0,0 @@ -# SPDX-License-Identifier: Apache-2.0 -# -# Copyright (c) 2021, Nordic Semiconductor ASA - -# Configure SoC settings based on Kconfig settings and SoC root. -# -# This CMake module will set the following variables in the build system based -# on Kconfig settings and selected SoC. -# -# If no implementation is available for the selected SoC an error will be raised. -# -# Outcome: -# The following variables will be defined when this CMake module completes: -# -# - SOC_NAME: Name of the SoC in use, identical to CONFIG_SOC -# - SOC_SERIES: Name of the SoC series in use, identical to CONFIG_SOC_SERIES -# - SOC_FAMILY: Name of the SoC family, identical to CONFIG_SOC_FAMILY -# - SOC_PATH: Path fragment defined by either SOC_NAME or SOC_FAMILY/SOC_SERIES. -# - SOC_DIR: Directory containing the SoC implementation -# - SOC_ROOT: SOC_ROOT with ZEPHYR_BASE appended -# -# Variable dependencies: -# - SOC_ROOT: CMake list of SoC roots containing SoC implementations -# -# Variables set by this module and not mentioned above are considered internal -# use only and may be removed, renamed, or re-purposed without prior notice. - -include_guard(GLOBAL) - -include(kconfig) - -if(HWMv1) - # 'SOC_ROOT' is a prioritized list of directories where socs may be - # found. It always includes ${ZEPHYR_BASE}/soc at the lowest priority. - list(APPEND SOC_ROOT ${ZEPHYR_BASE}) - - set(SOC_NAME ${CONFIG_SOC}) - set(SOC_SERIES ${CONFIG_SOC_SERIES}) - set(SOC_TOOLCHAIN_NAME ${CONFIG_SOC_TOOLCHAIN_NAME}) - set(SOC_FAMILY ${CONFIG_SOC_FAMILY}) - - if("${SOC_SERIES}" STREQUAL "") - set(SOC_PATH ${SOC_NAME}) - else() - set(SOC_PATH ${SOC_FAMILY}/${SOC_SERIES}) - endif() - - # Use SOC to search for a 'CMakeLists.txt' file. - # e.g. zephyr/soc/xtensa/intel_adsp/CMakeLists.txt. - foreach(root ${SOC_ROOT}) - # Check that the root looks reasonable. - if(NOT IS_DIRECTORY "${root}/soc") - message(WARNING "\nSOC_ROOT element(s) without a 'soc' subdirectory: - ${root} - Hints: - - if your SoC family directory is '/foo/bar/soc//my_soc_family', then add '/foo/bar' to SOC_ROOT, not the entire SoC family path - - if in doubt, use absolute paths\n") - endif() - - if(EXISTS ${root}/soc/${ARCH}/${SOC_PATH}) - set(SOC_DIR ${root}/soc) - break() - endif() - endforeach() - - if(NOT SOC_DIR) - message(FATAL_ERROR "Could not find SOC=${SOC_NAME} for BOARD=${BOARD},\n" - "please check your installation.\n" - "SOC roots searched:\n" - "${SOC_ROOT}\n" - ) - endif() - - set(SOC_FULL_DIR ${SOC_DIR}/${ARCH}/${SOC_PATH}) -endif() diff --git a/cmake/modules/unittest.cmake b/cmake/modules/unittest.cmake index aa3247661c5..e33d072fc48 100644 --- a/cmake/modules/unittest.cmake +++ b/cmake/modules/unittest.cmake @@ -12,8 +12,8 @@ include(hwm_v2) include(configuration_files) include(kconfig) -include(arch_v2) -include(soc_v2) +include(arch) +include(soc) find_package(TargetTools) diff --git a/cmake/modules/zephyr_default.cmake b/cmake/modules/zephyr_default.cmake index 2afef934057..087e9d77c6d 100644 --- a/cmake/modules/zephyr_default.cmake +++ b/cmake/modules/zephyr_default.cmake @@ -97,7 +97,6 @@ list(APPEND zephyr_cmake_modules zephyr_module) list(APPEND zephyr_cmake_modules boards) list(APPEND zephyr_cmake_modules shields) list(APPEND zephyr_cmake_modules snippets) -list(APPEND zephyr_cmake_modules arch_v1) list(APPEND zephyr_cmake_modules hwm_v2) list(APPEND zephyr_cmake_modules configuration_files) list(APPEND zephyr_cmake_modules generated_file_directories) @@ -110,9 +109,8 @@ list(APPEND zephyr_cmake_modules "\${pre_dt_board}") # kconfig and dts should be available at the same time. list(APPEND zephyr_cmake_modules dts) list(APPEND zephyr_cmake_modules kconfig) -list(APPEND zephyr_cmake_modules arch_v2) -list(APPEND zephyr_cmake_modules soc_v1) -list(APPEND zephyr_cmake_modules soc_v2) +list(APPEND zephyr_cmake_modules arch) +list(APPEND zephyr_cmake_modules soc) foreach(component ${SUB_COMPONENTS}) if(NOT ${component} IN_LIST zephyr_cmake_modules) diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 69f2d4cd396..e2076941380 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -1,8 +1,35 @@ -# Copyright (c) 2021 Nordic Semiconductor +# Copyright (c) 2021-2023 Nordic Semiconductor # # SPDX-License-Identifier: Apache-2.0 -rsource "Kconfig.$(HWM_SCHEME)" +config BOARD + string + default "$(BOARD)" + help + This option holds the name of the board and is used to locate the files + related to the board in the source tree (under boards/). + The Board is the first location where we search for a linker.ld file, + if not found we look for the linker file in + soc/// + +config BOARD_REVISION + def_string "$(BOARD_REVISION)" + help + If the BOARD has a revision field set, this is the revision. + Otherwise, it is the empty string. For example, if BOARD is + "plank@foo", this option will be "foo". If BOARD is "plank", + this option will be the empty string. + +config BOARD_DEPRECATED_RELEASE + string + help + This hidden option is set in the board configuration and indicates + the Zephyr release that the board configuration will be removed. + When set, any build for that board will generate a clearly visible + deprecation warning. + +source "boards/Kconfig.v2" +source "soc/Kconfig.v2" comment "Sysbuild image configuration" diff --git a/share/sysbuild/Kconfig.v1 b/share/sysbuild/Kconfig.v1 deleted file mode 100644 index 58191354bb7..00000000000 --- a/share/sysbuild/Kconfig.v1 +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor -# -# SPDX-License-Identifier: Apache-2.0 - -# Intentionally left empty as sysbuild Kconfig doesn't support hw model v1. diff --git a/share/sysbuild/Kconfig.v2 b/share/sysbuild/Kconfig.v2 index c8261b08616..424117c5794 100644 --- a/share/sysbuild/Kconfig.v2 +++ b/share/sysbuild/Kconfig.v2 @@ -28,5 +28,5 @@ config BOARD_DEPRECATED_RELEASE When set, any build for that board will generate a clearly visible deprecation warning. -source "boards/Kconfig.$(HWM_SCHEME)" -source "soc/Kconfig.$(HWM_SCHEME)" +source "boards/Kconfig.v2" +source "soc/Kconfig.v2" diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index b9987fb14d4..a0ca87c4253 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -397,23 +397,17 @@ function(ExternalZephyrProject_Add) # The sysbuild BOARD is exported through sysbuild cache, and will be used # unless _BOARD is defined. if(DEFINED ZBUILD_BOARD_REVISION) - # Use provided board revision - if(ZBUILD_BOARD MATCHES "/") - # HWMv2 requires adding version to the board, split elements up, attach version, then - # reassemble into a complete string - string(REPLACE "/" ";" split_board_qualifiers "${ZBUILD_BOARD}") - list(GET split_board_qualifiers 0 target_board) - set(target_board ${target_board}@${ZBUILD_BOARD_REVISION}) - list(REMOVE_AT split_board_qualifiers 0) - list(PREPEND split_board_qualifiers ${target_board}) - string(REPLACE ";" "/" board_qualifiers "${split_board_qualifiers}") - set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${board_qualifiers}) - set(split_board_qualifiers) - set(board_qualifiers) - else() - # Legacy HWMv1 support, version goes at end - set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}@${ZBUILD_BOARD_REVISION}) - endif() + # Use provided board revision, HWMv2 requires adding version to the board, split elements + # up, attach version, then reassemble into a complete string + string(REPLACE "/" ";" split_board_qualifiers "${ZBUILD_BOARD}") + list(GET split_board_qualifiers 0 target_board) + set(target_board ${target_board}@${ZBUILD_BOARD_REVISION}) + list(REMOVE_AT split_board_qualifiers 0) + list(PREPEND split_board_qualifiers ${target_board}) + string(REPLACE ";" "/" board_qualifiers "${split_board_qualifiers}") + set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${board_qualifiers}) + set(split_board_qualifiers) + set(board_qualifiers) else() set_target_properties(${ZBUILD_APPLICATION} PROPERTIES BOARD ${ZBUILD_BOARD}) endif() diff --git a/soc/CMakeLists.txt b/soc/CMakeLists.txt index 7cd3f1af754..5240a3332ca 100644 --- a/soc/CMakeLists.txt +++ b/soc/CMakeLists.txt @@ -11,48 +11,30 @@ unset(_SOC_IS_IN_TREE) add_subdirectory(common) -if(HWMv1) - message(DEPRECATION " - --------------------------------------------------------------------- - --- WARNING: Functionality to describe SoCs in HWMv1 is --- - --- deprecated and should be replaced with HWMv2, including --- - --- boards. HWMv1 SoCs support remains only to ease the migration --- - --- of out-of-tree SoCs and associated boards. It will not be --- - --- possible to build using HWMv1 SoCs at all in future releases. --- - ---------------------------------------------------------------------" - ) +# Below is inclusion of HWMv2 SoC CMake lists. +string(TOUPPER SOC_FAMILY_${SOC_FAMILY}_DIR family_setting_dir) +string(TOUPPER SOC_SERIES_${SOC_SERIES}_DIR series_setting_dir) +string(TOUPPER SOC_${SOC_NAME}_DIR soc_setting_dir) - if(EXISTS ${SOC_DIR}/${ARCH}/CMakeLists.txt) - add_subdirectory(${SOC_DIR}/${ARCH} soc/${ARCH}) - else() - add_subdirectory(${SOC_DIR}/${ARCH}/${SOC_PATH} soc/${ARCH}/${SOC_PATH}) - endif() -elseif(HWMv2) - # Below is inclusion of HWMv2 SoC CMake lists. - string(TOUPPER SOC_FAMILY_${SOC_FAMILY}_DIR family_setting_dir) - string(TOUPPER SOC_SERIES_${SOC_SERIES}_DIR series_setting_dir) - string(TOUPPER SOC_${SOC_NAME}_DIR soc_setting_dir) +if(DEFINED ${soc_setting_dir}) + add_subdirectory(${${soc_setting_dir}} soc/${SOC_NAME}) +elseif(DEFINED ${series_setting_dir}) + add_subdirectory(${${series_setting_dir}} soc/${SOC_SERIES}) +elseif(DEFINED ${family_setting_dir}) + add_subdirectory(${${family_setting_dir}} soc/${SOC_FAMILY}) +else() + message(FATAL_ERROR "No CMakeLists.txt file found for SoC: ${SOC_NAME}, " + "series: ${SOC_SERIES}, family: ${SOC_FAMILY}") +endif() - if(DEFINED ${soc_setting_dir}) - add_subdirectory(${${soc_setting_dir}} soc/${SOC_NAME}) - elseif(DEFINED ${series_setting_dir}) - add_subdirectory(${${series_setting_dir}} soc/${SOC_SERIES}) - elseif(DEFINED ${family_setting_dir}) - add_subdirectory(${${family_setting_dir}} soc/${SOC_FAMILY}) - else() - message(FATAL_ERROR "No CMakeLists.txt file found for SoC: ${SOC_NAME}, " - "series: ${SOC_SERIES}, family: ${SOC_FAMILY}") +# Include all SoC roots except Zephyr, as we are already in the Zephyr SoC root. +set(local_soc_root ${SOC_ROOT}) +list(REMOVE_ITEM local_soc_root ${ZEPHYR_BASE}) +foreach(root ${local_soc_root}) + cmake_path(GET root FILENAME name) + # A SoC root for HWMv1 may not contain a CMakeLists.txt file on this so + # let's check for existence before including. + if(EXISTS ${root}/soc/CMakeLists.txt) + add_subdirectory(${root}/soc soc/${name}) endif() - - # Include all SoC roots except Zephyr, as we are already in the Zephyr SoC root. - set(local_soc_root ${SOC_ROOT}) - list(REMOVE_ITEM local_soc_root ${ZEPHYR_BASE}) - foreach(root ${local_soc_root}) - cmake_path(GET root FILENAME name) - # A SoC root for HWMv1 may not contain a CMakeLists.txt file on this so - # let's check for existence before including. - if(EXISTS ${root}/soc/CMakeLists.txt) - add_subdirectory(${root}/soc soc/${name}) - endif() - endforeach() -endif() +endforeach() diff --git a/soc/Kconfig b/soc/Kconfig index af32c5c5cf3..a1ea1f97896 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -3,11 +3,9 @@ # Only v1 model has choice for SoC selection, therefore the optional source # Sourced here and not in Kconfig.v1 to keep current SoC/CPU selection menu # side-by-side with "Hardware Configuration" in the menu structure. -orsource "Kconfig.$(HWM_SCHEME).choice" - menu "Hardware Configuration" -rsource "Kconfig.$(HWM_SCHEME)" +rsource "Kconfig.v2" # Source Zephyr Kconfig specifics from SoC roots. osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig" diff --git a/soc/Kconfig.v1 b/soc/Kconfig.v1 deleted file mode 100644 index bd7f66d77bc..00000000000 --- a/soc/Kconfig.v1 +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA - -# SPDX-License-Identifier: Apache-2.0 - -config SOC - string - help - SoC name. The value of this setting must be defined by the selected - SoC for hw model v2. - -config SOC_SERIES - string - help - SoC series. The value of this setting must be defined by the selected - SoC if the SoC belongs to a common series. - -config SOC_FAMILY - string - help - SoC family. The value of this setting must be defined by the selected - SoC if the SoC belongs to a SoC family. Usually a SoC family also - indicates the vendor of the SoC. - -# This loads custom SoC root Kconfig (only available if custom SoC root are defined) -osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig.soc.arch" diff --git a/soc/Kconfig.v1.choice b/soc/Kconfig.v1.choice deleted file mode 100644 index e96dd15bedd..00000000000 --- a/soc/Kconfig.v1.choice +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA - -# SPDX-License-Identifier: Apache-2.0 - -choice - prompt "SoC/CPU/Configuration Selection" - -# This loads custom SoC root Kconfig (only available if custom SoC root are defined) -osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig.soc.choice" - -endchoice diff --git a/subsys/testsuite/arch/Kconfig.v1 b/subsys/testsuite/arch/Kconfig.v1 deleted file mode 100644 index 28d4b43df0b..00000000000 --- a/subsys/testsuite/arch/Kconfig.v1 +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA -# SPDX-License-Identifier: Apache-2.0 - -rsource "unit_testing/Kconfig"