Browse Source

infrastructure: Remove hwmv1 support

Removes support for the deprecated hardware model version 1

Signed-off-by: Jamie McCrae <jamie.mccrae@nordicsemi.no>
pull/87068/head
Jamie McCrae 8 months ago committed by Fabio Baltieri
parent
commit
9f12f8afb2
  1. 2
      arch/Kconfig
  2. 5
      arch/Kconfig.v1
  3. 5
      arch/Kconfig.v2
  4. 5
      boards/Kconfig
  5. 14
      boards/Kconfig.v1
  6. 0
      cmake/modules/arch.cmake
  7. 54
      cmake/modules/arch_v1.cmake
  8. 115
      cmake/modules/boards.cmake
  9. 45
      cmake/modules/kconfig.cmake
  10. 10
      cmake/modules/pre_dt.cmake
  11. 0
      cmake/modules/soc.cmake
  12. 75
      cmake/modules/soc_v1.cmake
  13. 4
      cmake/modules/unittest.cmake
  14. 6
      cmake/modules/zephyr_default.cmake
  15. 31
      share/sysbuild/Kconfig
  16. 5
      share/sysbuild/Kconfig.v1
  17. 4
      share/sysbuild/Kconfig.v2
  18. 28
      share/sysbuild/cmake/modules/sysbuild_extensions.cmake
  19. 66
      soc/CMakeLists.txt
  20. 4
      soc/Kconfig
  21. 25
      soc/Kconfig.v1
  22. 11
      soc/Kconfig.v1.choice
  23. 4
      subsys/testsuite/arch/Kconfig.v1

2
arch/Kconfig

@ -8,7 +8,7 @@ @@ -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"

5
arch/Kconfig.v1

@ -1,5 +0,0 @@ @@ -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"

5
arch/Kconfig.v2

@ -1,5 +0,0 @@ @@ -1,5 +0,0 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
source "$(KCONFIG_BINARY_DIR)/arch/Kconfig"

5
boards/Kconfig

@ -2,8 +2,7 @@ @@ -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 @@ -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.

14
boards/Kconfig.v1

@ -1,14 +0,0 @@ @@ -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

0
cmake/modules/arch_v2.cmake → cmake/modules/arch.cmake

54
cmake/modules/arch_v1.cmake

@ -1,54 +0,0 @@ @@ -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()

115
cmake/modules/boards.cmake

@ -141,8 +141,7 @@ Hints: @@ -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 "") @@ -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() @@ -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}")

45
cmake/modules/kconfig.cmake

@ -24,30 +24,6 @@ set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Kconfig) @@ -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 @@ -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

10
cmake/modules/pre_dt.cmake

@ -60,13 +60,9 @@ function(pre_dt_module_run) @@ -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)

0
cmake/modules/soc_v2.cmake → cmake/modules/soc.cmake

75
cmake/modules/soc_v1.cmake

@ -1,75 +0,0 @@ @@ -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/<ARCH>/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()

4
cmake/modules/unittest.cmake

@ -12,8 +12,8 @@ include(hwm_v2) @@ -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)

6
cmake/modules/zephyr_default.cmake

@ -97,7 +97,6 @@ list(APPEND zephyr_cmake_modules zephyr_module) @@ -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}") @@ -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)

31
share/sysbuild/Kconfig

@ -1,8 +1,35 @@ @@ -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/<arch>/<family>/<series>
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"

5
share/sysbuild/Kconfig.v1

@ -1,5 +0,0 @@ @@ -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.

4
share/sysbuild/Kconfig.v2

@ -28,5 +28,5 @@ config BOARD_DEPRECATED_RELEASE @@ -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"

28
share/sysbuild/cmake/modules/sysbuild_extensions.cmake

@ -397,23 +397,17 @@ function(ExternalZephyrProject_Add) @@ -397,23 +397,17 @@ function(ExternalZephyrProject_Add)
# The sysbuild BOARD is exported through sysbuild cache, and will be used
# unless <image>_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()

66
soc/CMakeLists.txt

@ -11,48 +11,30 @@ unset(_SOC_IS_IN_TREE) @@ -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()

4
soc/Kconfig

@ -3,11 +3,9 @@ @@ -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"

25
soc/Kconfig.v1

@ -1,25 +0,0 @@ @@ -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"

11
soc/Kconfig.v1.choice

@ -1,11 +0,0 @@ @@ -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

4
subsys/testsuite/arch/Kconfig.v1

@ -1,4 +0,0 @@ @@ -1,4 +0,0 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0
rsource "unit_testing/Kconfig"
Loading…
Cancel
Save