diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 8b48eca6fcd96..ed830ba4a4083 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -21,12 +21,11 @@ osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig" # This loads Zephyr base shield defconfigs source "boards/shields/*/Kconfig.defconfig" -source "$(BOARD_DIR)/Kconfig.defconfig" +osource "$(BOARD_DIR)/Kconfig.defconfig" + +# This loads Zephyr specific SoC root defconfigs +source "$(KCONFIG_BINARY_DIR)/soc/Kconfig.defconfig" -# This loads custom SoC root defconfigs -osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.defconfig" -# This loads Zephyr base SoC root defconfigs -osource "soc/$(ARCH)/*/Kconfig.defconfig" # This loads the toolchain defconfigs osource "$(TOOLCHAIN_KCONFIG_DIR)/Kconfig.defconfig" # This loads the testsuite defconfig diff --git a/MAINTAINERS.yml b/MAINTAINERS.yml index 21603d8b78521..9da438f7f9a0b 100644 --- a/MAINTAINERS.yml +++ b/MAINTAINERS.yml @@ -418,7 +418,7 @@ Board/SoC configuration: - nordicjm - "57300" files: - - soc/Kconfig + - soc/Kconfig* - boards/Kconfig labels: - "area: Board/SoC configuration" diff --git a/arch/Kconfig b/arch/Kconfig index 8130d3fa6a8b8..e8ba8d36ec207 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -8,8 +8,10 @@ # Include these first so that any properties (e.g. defaults) below can be # overridden (by defining symbols in multiple locations) -# Note: $ARCH might be a glob pattern -source "$(ARCH_DIR)/$(ARCH)/Kconfig" +source "$(ARCH_DIR)/Kconfig.$(HWM_SCHEME)" + +# ToDo: Generate a Kconfig.arch for loading of additional arch in HWMv2. +osource "$(KCONFIG_BINARY_DIR)/Kconfig.arch" # Architecture symbols # @@ -979,27 +981,6 @@ config ARCH help System architecture string. -config SOC - string - help - SoC name which can be found under soc//. - This option holds the directory name used by the build system to locate - the correct linker and header files for the SoC. - -config SOC_SERIES - string - help - SoC series name which can be found under soc///. - This option holds the directory name used by the build system to locate - the correct linker and header files. - -config SOC_FAMILY - string - help - SoC family name which can be found under soc//. - This option holds the directory name used by the build system to locate - the correct linker and header files. - config TOOLCHAIN_HAS_BUILTIN_FFS bool default y if !(64BIT && RISCV) diff --git a/arch/Kconfig.v1 b/arch/Kconfig.v1 new file mode 100644 index 0000000000000..d76acba59a3e1 --- /dev/null +++ b/arch/Kconfig.v1 @@ -0,0 +1,5 @@ +# 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 new file mode 100644 index 0000000000000..19db8d4624657 --- /dev/null +++ b/arch/Kconfig.v2 @@ -0,0 +1,5 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA + +# SPDX-License-Identifier: Apache-2.0 + +source "$(KCONFIG_BINARY_DIR)/arch/Kconfig" diff --git a/arch/archs.yml b/arch/archs.yml new file mode 100644 index 0000000000000..e07d10ffe80b3 --- /dev/null +++ b/arch/archs.yml @@ -0,0 +1,21 @@ +archs: + - name: arc + path: arc + - name: arm + path: arm + - name: arm64 + path: arm64 + - name: mips + path: mips + - name: nios2 + path: nios2 + - name: posix + path: posix + - name: riscv + path: riscv + - name: sparc + path: sparc + - name: xtensa + path: xtensa + - name: x86 + path: x86 diff --git a/boards/Kconfig b/boards/Kconfig index f56c2cab04ef9..9268b7c0c9dde 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -2,6 +2,8 @@ config BOARD string + # When using hw model v2, then the board is inherited from CMake. + default "$(BOARD)" if "$(HWM_SCHEME)" = "v2" 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/). @@ -38,14 +40,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 -# Note: $BOARD_DIR might be a glob pattern - -choice - prompt "Board Selection" - -source "$(BOARD_DIR)/Kconfig.board" - -endchoice +rsource "Kconfig.$(HWM_SCHEME)" # 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 new file mode 100644 index 0000000000000..670e2f2376eb8 --- /dev/null +++ b/boards/Kconfig.v1 @@ -0,0 +1,10 @@ +# Copyright (c) 2022 Nordic Semiconductor ASA + +# SPDX-License-Identifier: Apache-2.0 + +choice + prompt "Board Selection" + +source "$(BOARD_DIR)/Kconfig.board" + +endchoice diff --git a/boards/Kconfig.v2 b/boards/Kconfig.v2 new file mode 100644 index 0000000000000..a2221dd04b914 --- /dev/null +++ b/boards/Kconfig.v2 @@ -0,0 +1,18 @@ +# Copyright (c) 2022 Nordic Semiconductor ASA + +# SPDX-License-Identifier: Apache-2.0 + +BOARD_STRING := $(sanitize_upper,$(BOARD)) +BOARD_FULL_STRING := $(sanitize_upper,$(BOARD)$(BOARD_IDENTIFIER)) + +config BOARD_$(BOARD_STRING) + def_bool y + help + Kconfig symbol identifying the board. + +config BOARD_$(BOARD_FULL_STRING) + def_bool y + help + Kconfig symbol identifying the board including full board identifier. + +osource "$(BOARD_DIR)/Kconfig.$(BOARD)" diff --git a/boards/arm/mps3_an547/Kconfig.board b/boards/arm/mps3_an547/Kconfig.board deleted file mode 100644 index f8e755f12ed55..0000000000000 --- a/boards/arm/mps3_an547/Kconfig.board +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2021 Linaro Limited -# SPDX-License-Identifier: Apache-2.0 - -config BOARD_MPS3_AN547 - bool "Arm Cortex-M55 (Corstone-300, SSE-300 w/Ethos-U55) on MPS3 (AN547)" - depends on SOC_MPS3_AN547 - select QEMU_TARGET diff --git a/boards/arm/rzt2m_starterkit/Kconfig.defconfig b/boards/arm/rzt2m_starterkit/Kconfig.defconfig deleted file mode 100644 index 9699b23963c96..0000000000000 --- a/boards/arm/rzt2m_starterkit/Kconfig.defconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2023 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -if BOARD_RZT2M_STARTER_KIT - -config BOARD - default "rzt2m_starter_kit" - -endif diff --git a/boards/v2/arm/mps3/Kconfig b/boards/v2/arm/mps3/Kconfig new file mode 100644 index 0000000000000..019f22aae49dd --- /dev/null +++ b/boards/v2/arm/mps3/Kconfig @@ -0,0 +1,5 @@ +# Copyright (c) 2021 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MPS3 + select QEMU_TARGET diff --git a/boards/arm/mps3_an547/Kconfig.defconfig b/boards/v2/arm/mps3/Kconfig.defconfig similarity index 92% rename from boards/arm/mps3_an547/Kconfig.defconfig rename to boards/v2/arm/mps3/Kconfig.defconfig index a318d14aefe6c..078012e46a760 100644 --- a/boards/arm/mps3_an547/Kconfig.defconfig +++ b/boards/v2/arm/mps3/Kconfig.defconfig @@ -3,9 +3,6 @@ if BOARD_MPS3_AN547 -config BOARD - default "mps3_an547" - # MPU-based null-pointer dereferencing detection cannot # be applied as the (0x0 - 0x400) is unmapped but QEMU # will still permit bus access. diff --git a/boards/v2/arm/mps3/Kconfig.mps3 b/boards/v2/arm/mps3/Kconfig.mps3 new file mode 100644 index 0000000000000..84dd3fff09531 --- /dev/null +++ b/boards/v2/arm/mps3/Kconfig.mps3 @@ -0,0 +1,7 @@ +# Copyright (c) 2023 Nordic Semiconductor +# +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MPS3 + select SOC_SERIES_MPS3 + select SOC_MPS3_AN547 diff --git a/boards/arm/mps3_an547/board.cmake b/boards/v2/arm/mps3/board.cmake similarity index 100% rename from boards/arm/mps3_an547/board.cmake rename to boards/v2/arm/mps3/board.cmake diff --git a/boards/v2/arm/mps3/board.yml b/boards/v2/arm/mps3/board.yml new file mode 100644 index 0000000000000..5ee7ed7c03789 --- /dev/null +++ b/boards/v2/arm/mps3/board.yml @@ -0,0 +1,7 @@ +board: + name: mps3 + vendor: arm + socs: + - name: 'an547' + variants: + - name: 'ns' diff --git a/boards/arm/mps3_an547/doc/img/mps3_an547.jpg b/boards/v2/arm/mps3/doc/img/mps3_an547.jpg similarity index 100% rename from boards/arm/mps3_an547/doc/img/mps3_an547.jpg rename to boards/v2/arm/mps3/doc/img/mps3_an547.jpg diff --git a/boards/arm/mps3_an547/doc/index.rst b/boards/v2/arm/mps3/doc/index.rst similarity index 100% rename from boards/arm/mps3_an547/doc/index.rst rename to boards/v2/arm/mps3/doc/index.rst diff --git a/boards/arm/mps3_an547/mps3_an547-common.dtsi b/boards/v2/arm/mps3/mps3_an547-common.dtsi similarity index 100% rename from boards/arm/mps3_an547/mps3_an547-common.dtsi rename to boards/v2/arm/mps3/mps3_an547-common.dtsi diff --git a/boards/arm/mps3_an547/mps3_an547.dts b/boards/v2/arm/mps3/mps3_an547.dts similarity index 100% rename from boards/arm/mps3_an547/mps3_an547.dts rename to boards/v2/arm/mps3/mps3_an547.dts diff --git a/boards/arm/mps3_an547/mps3_an547.yaml b/boards/v2/arm/mps3/mps3_an547.yaml similarity index 93% rename from boards/arm/mps3_an547/mps3_an547.yaml rename to boards/v2/arm/mps3/mps3_an547.yaml index 3ade98161c8cf..538fa24db67d9 100644 --- a/boards/arm/mps3_an547/mps3_an547.yaml +++ b/boards/v2/arm/mps3/mps3_an547.yaml @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -identifier: mps3_an547 +identifier: mps3/an547 name: Arm MPS3-AN547 type: mcu arch: arm diff --git a/boards/arm/mps3_an547/mps3_an547_defconfig b/boards/v2/arm/mps3/mps3_an547_defconfig similarity index 81% rename from boards/arm/mps3_an547/mps3_an547_defconfig rename to boards/v2/arm/mps3/mps3_an547_defconfig index ec0c9fccc3303..90c9b6a9f8e42 100644 --- a/boards/arm/mps3_an547/mps3_an547_defconfig +++ b/boards/v2/arm/mps3/mps3_an547_defconfig @@ -4,9 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -CONFIG_SOC_SERIES_MPS3=y -CONFIG_SOC_MPS3_AN547=y -CONFIG_BOARD_MPS3_AN547=y CONFIG_RUNTIME_NMI=y CONFIG_ARM_TRUSTZONE_M=y CONFIG_ARM_MPU=y diff --git a/boards/arm/mps3_an547/mps3_an547_ns.dts b/boards/v2/arm/mps3/mps3_an547_ns.dts similarity index 100% rename from boards/arm/mps3_an547/mps3_an547_ns.dts rename to boards/v2/arm/mps3/mps3_an547_ns.dts diff --git a/boards/arm/mps3_an547/mps3_an547_ns.yaml b/boards/v2/arm/mps3/mps3_an547_ns.yaml similarity index 91% rename from boards/arm/mps3_an547/mps3_an547_ns.yaml rename to boards/v2/arm/mps3/mps3_an547_ns.yaml index 665962c62ecbc..3852415834f69 100644 --- a/boards/arm/mps3_an547/mps3_an547_ns.yaml +++ b/boards/v2/arm/mps3/mps3_an547_ns.yaml @@ -4,7 +4,7 @@ # SPDX-License-Identifier: Apache-2.0 # -identifier: mps3_an547_ns +identifier: mps3/an547/ns name: Arm MPS3-AN547_ns type: mcu arch: arm diff --git a/boards/arm/mps3_an547/mps3_an547_ns_defconfig b/boards/v2/arm/mps3/mps3_an547_ns_defconfig similarity index 80% rename from boards/arm/mps3_an547/mps3_an547_ns_defconfig rename to boards/v2/arm/mps3/mps3_an547_ns_defconfig index f782f9f8623c0..dcf5a1703408e 100644 --- a/boards/arm/mps3_an547/mps3_an547_ns_defconfig +++ b/boards/v2/arm/mps3/mps3_an547_ns_defconfig @@ -4,9 +4,6 @@ # SPDX-License-Identifier: Apache-2.0 # -CONFIG_SOC_SERIES_MPS3=y -CONFIG_SOC_MPS3_AN547=y -CONFIG_BOARD_MPS3_AN547=y CONFIG_ARM_TRUSTZONE_M=y CONFIG_RUNTIME_NMI=y CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/boards/v2/renesas/rzt2m_starterkit/Kconfig.rzt2m_starter_kit b/boards/v2/renesas/rzt2m_starterkit/Kconfig.rzt2m_starter_kit new file mode 100644 index 0000000000000..83f98b5c90bed --- /dev/null +++ b/boards/v2/renesas/rzt2m_starterkit/Kconfig.rzt2m_starter_kit @@ -0,0 +1,6 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA + +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_RZT2M_STARTER_KIT + select SOC_RENESAS_RZT2M diff --git a/boards/arm/rzt2m_starterkit/board.cmake b/boards/v2/renesas/rzt2m_starterkit/board.cmake similarity index 100% rename from boards/arm/rzt2m_starterkit/board.cmake rename to boards/v2/renesas/rzt2m_starterkit/board.cmake diff --git a/boards/v2/renesas/rzt2m_starterkit/board.yml b/boards/v2/renesas/rzt2m_starterkit/board.yml new file mode 100644 index 0000000000000..2d65a9f6304df --- /dev/null +++ b/boards/v2/renesas/rzt2m_starterkit/board.yml @@ -0,0 +1,3 @@ +board: + name: rzt2m_starter_kit + vendor: Renesas diff --git a/boards/arm/rzt2m_starterkit/doc/index.rst b/boards/v2/renesas/rzt2m_starterkit/doc/index.rst similarity index 100% rename from boards/arm/rzt2m_starterkit/doc/index.rst rename to boards/v2/renesas/rzt2m_starterkit/doc/index.rst diff --git a/boards/arm/rzt2m_starterkit/doc/rzt2m_starterkit.png b/boards/v2/renesas/rzt2m_starterkit/doc/rzt2m_starterkit.png similarity index 100% rename from boards/arm/rzt2m_starterkit/doc/rzt2m_starterkit.png rename to boards/v2/renesas/rzt2m_starterkit/doc/rzt2m_starterkit.png diff --git a/boards/arm/rzt2m_starterkit/rzt2m_starter_kit.dts b/boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit.dts similarity index 100% rename from boards/arm/rzt2m_starterkit/rzt2m_starter_kit.dts rename to boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit.dts diff --git a/boards/arm/rzt2m_starterkit/rzt2m_starter_kit.yaml b/boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit.yaml similarity index 100% rename from boards/arm/rzt2m_starterkit/rzt2m_starter_kit.yaml rename to boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit.yaml diff --git a/boards/arm/rzt2m_starterkit/rzt2m_starter_kit_defconfig b/boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit_defconfig similarity index 74% rename from boards/arm/rzt2m_starterkit/rzt2m_starter_kit_defconfig rename to boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit_defconfig index 8b994e00082f1..18f0eb4aee7b8 100644 --- a/boards/arm/rzt2m_starterkit/rzt2m_starter_kit_defconfig +++ b/boards/v2/renesas/rzt2m_starterkit/rzt2m_starter_kit_defconfig @@ -1,9 +1,6 @@ # Copyright (c) 2023 Antmicro # SPDX-License-Identifier: Apache-2.0 -CONFIG_SOC_RENESAS_RZT2M=y -CONFIG_BOARD_RZT2M_STARTER_KIT=y - CONFIG_SERIAL=y CONFIG_CONSOLE=y CONFIG_UART_CONSOLE=y diff --git a/cmake/modules/arch.cmake b/cmake/modules/arch_v1.cmake similarity index 58% rename from cmake/modules/arch.cmake rename to cmake/modules/arch_v1.cmake index 806b5c12b58c6..613182f0723f9 100644 --- a/cmake/modules/arch.cmake +++ b/cmake/modules/arch_v1.cmake @@ -2,6 +2,10 @@ # # 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 @@ -25,24 +29,26 @@ include_guard(GLOBAL) -# '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() +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) + 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() + 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}, \ + 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/arch_v2.cmake b/cmake/modules/arch_v2.cmake new file mode 100644 index 0000000000000..fd12a4a7a5fb7 --- /dev/null +++ b/cmake/modules/arch_v2.cmake @@ -0,0 +1,41 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023, Nordic Semiconductor ASA + +# +# Configure ARCH settings based on KConfig settings 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 +# +# 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(HWMv2) + # HWMv2 obtains arch from Kconfig for the given Board / SoC variant because + # the Board / SoC path is no longer sufficient for determine the arch + # (read: multi-core and multi-arch SoC). + set(ARCH ${CONFIG_ARCH}) + string(TOUPPER "${ARCH}" arch_upper) + cmake_path(GET ARCH_V2_${arch_upper}_DIR PARENT_PATH ARCH_DIR) + + 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 77f61c32f7b51..eb7444b62281c 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -62,6 +62,21 @@ if(NOT unittest IN_LIST Zephyr_FIND_COMPONENTS) endif() string(FIND "${BOARD}" "@" REVISION_SEPARATOR_INDEX) +string(FIND "${BOARD}" "/" IDENTIFIER_SEPARATOR_INDEX) + +if(NOT (REVISION_SEPARATOR_INDEX EQUAL -1 OR IDENTIFIER_SEPARATOR_INDEX EQUAL -1)) + if(REVISION_SEPARATOR_INDEX GREATER IDENTIFIER_SEPARATOR_INDEX) + message(FATAL_ERROR "Invalid revision / identifier format, format is: " + "@/" + ) + endif() +endif() + +if(NOT (IDENTIFIER_SEPARATOR_INDEX EQUAL -1)) + string(SUBSTRING ${BOARD} ${IDENTIFIER_SEPARATOR_INDEX} -1 BOARD_IDENTIFIER) + string(SUBSTRING ${BOARD} 0 ${IDENTIFIER_SEPARATOR_INDEX} BOARD) +endif() + if(NOT (REVISION_SEPARATOR_INDEX EQUAL -1)) math(EXPR BOARD_REVISION_INDEX "${REVISION_SEPARATOR_INDEX} + 1") string(SUBSTRING ${BOARD} ${BOARD_REVISION_INDEX} -1 BOARD_REVISION) @@ -95,41 +110,125 @@ Hints: - if your board directory is '/foo/bar/boards//my_board' then add '/foo/bar' to BOARD_ROOT, not the entire board directory - if in doubt, use absolute paths") endif() +endforeach() + +if((HWMv1 AND NOT EXISTS ${BOARD_DIR}/${BOARD}_defconfig) + OR (HWMv2 AND NOT EXISTS ${BOARD_DIR})) + message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. " + "Trying to find new location." + ) + set(BOARD_DIR BOARD_DIR-NOTFOUND CACHE PATH "Path to a file." FORCE) +endif() + +# Prepare list boards command. +# This command is used for locating the board dir as well as printing all boards +# in the system in the following cases: +# - User specifies an invalid BOARD +# - User invokes ' boards' target +list(TRANSFORM ARCH_ROOT PREPEND "--arch-root=" OUTPUT_VARIABLE arch_root_args) +list(TRANSFORM BOARD_ROOT PREPEND "--board-root=" OUTPUT_VARIABLE board_root_args) +list(TRANSFORM SOC_ROOT PREPEND "--soc-root=" OUTPUT_VARIABLE soc_root_args) + +set(list_boards_commands + COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/list_boards.py + ${arch_root_args} ${board_root_args} --arch-root=${ZEPHYR_BASE} + ${soc_root_args} --soc-root=${ZEPHYR_BASE} +) + +if(NOT BOARD_DIR) + if(BOARD_ALIAS) + execute_process(${list_boards_commands} --board=${BOARD_ALIAS} --format={name}\;{dir}\;{hwm} + OUTPUT_VARIABLE ret_board + ERROR_VARIABLE err_board + RESULT_VARIABLE ret_val + ) + list(GET ret_board 1 BOARD_HIDDEN_DIR) + string(STRIP "${BOARD_HIDDEN_DIR}" BOARD_HIDDEN_DIR) + set(BOARD_HIDDEN_DIR ${BOARD_HIDDEN_DIR} CACHE PATH "Path to a folder." FORCE) - # NB: find_path will return immediately if the output variable is - # already set - if (BOARD_ALIAS) - find_path(BOARD_HIDDEN_DIR - NAMES ${BOARD_ALIAS}_defconfig - PATHS ${root}/boards/*/* - NO_DEFAULT_PATH - ) if(BOARD_HIDDEN_DIR) message("Board alias ${BOARD_ALIAS} is hiding the real board of same name") endif() endif() - if(BOARD_DIR AND NOT EXISTS ${BOARD_DIR}/${BOARD}_defconfig) - message(WARNING "BOARD_DIR: ${BOARD_DIR} has been moved or deleted. " - "Trying to find new location." - ) - set(BOARD_DIR BOARD_DIR-NOTFOUND CACHE PATH "Path to a file." FORCE) + + set(format_str "{NAME}\;{DIR}\;{HWM}\;") + set(format_str "${format_str}{REVISION_FORMAT}\;{REVISION_DEFAULT}\;{REVISION_EXACT}\;") + set(format_str "${format_str}{REVISIONS}\;{IDENTIFIERS}") + + execute_process(${list_boards_commands} --board=${BOARD} + --cmakeformat=${format_str} + OUTPUT_VARIABLE ret_board + ERROR_VARIABLE err_board + RESULT_VARIABLE ret_val + ) + if(ret_val) + message(FATAL_ERROR "Error finding board: ${BOARD}\nError message: ${err_board}") endif() - find_path(BOARD_DIR - NAMES ${BOARD}_defconfig - PATHS ${root}/boards/*/* - NO_DEFAULT_PATH - ) - if(BOARD_DIR AND NOT (${root} STREQUAL ${ZEPHYR_BASE})) - set(USING_OUT_OF_TREE_BOARD 1) + string(STRIP "${ret_board}" ret_board) + set(single_val "NAME;DIR;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT") + set(multi_val "REVISIONS;IDENTIFIERS") + cmake_parse_arguments(BOARD "" "${single_val}" "${multi_val}" ${ret_board}) + set(BOARD_DIR ${BOARD_DIR} CACHE PATH "Board directory for board (${BOARD})" FORCE) + + # Create two CMake variables identifying the hw model. + # CMake variable: HWM=[v1,v2] + # CMake variable: HWMv1=True, when HWMv1 is in use. + # CMake variable: HWMv2=True, when HWMv2 is in use. + set(HWM ${BOARD_HWM} CACHE INTERNAL "Zephyr hardware model version") + set(HWM${HWM} True CACHE INTERNAL "Zephyr hardware model") +endif() + +if(NOT BOARD_DIR) + message("No board named '${BOARD}' found.\n\n" + "Please choose one of the following boards:\n" + ) + execute_process(${list_boards_commands}) + unset(CACHED_BOARD CACHE) + message(FATAL_ERROR "Invalid BOARD; see above.") +endif() + +cmake_path(IS_PREFIX ZEPHYR_BASE "${BOARD_DIR}" NORMALIZE in_zephyr_tree) +if(NOT in_zephyr_tree) + set(USING_OUT_OF_TREE_BOARD 1) +endif() + +if(HWMv1) + if(EXISTS ${BOARD_DIR}/revision.cmake) + # Board provides revision handling. + include(${BOARD_DIR}/revision.cmake) + elseif(BOARD_REVISION) + message(WARNING "Board revision ${BOARD_REVISION} specified for ${BOARD}, \ + but board has no revision so revision will be ignored.") endif() -endforeach() +elseif(HWMv2) + if(BOARD_REVISION_FORMAT) + if(BOARD_REVISION_FORMAT STREQUAL "custom") + include(${BOARD_DIR}/revision.cmake) + else() + string(TOUPPER "${BOARD_REVISION_FORMAT}" rev_format) + if(BOARD_REVISION_EXACT) + set(rev_exact EXACT) + endif() -if(EXISTS ${BOARD_DIR}/revision.cmake) - # Board provides revision handling. - include(${BOARD_DIR}/revision.cmake) -elseif(BOARD_REVISION) - message(WARNING "Board revision ${BOARD_REVISION} specified for ${BOARD}, \ - but board has no revision so revision will be ignored.") + board_check_revision( + FORMAT ${rev_format} + DEFAULT_REVISION ${BOARD_REVISION_DEFAULT} + VALID_REVISIONS ${BOARD_REVISIONS} + ${rev_exact} + ) + endif() + endif() + + if(BOARD_IDENTIFIERS) + if(NOT ("${BOARD}${BOARD_IDENTIFIER}" IN_LIST BOARD_IDENTIFIERS)) + string(REPLACE ";" "\n" BOARD_IDENTIFIERS "${BOARD_IDENTIFIERS}") + message(FATAL_ERROR "Board identifier `${BOARD_IDENTIFIER}` for board \ + `${BOARD}` not found. Please specify a valid board.\n" + "Valid board identifiers for ${BOARD_NAME} are:\n${BOARD_IDENTIFIERS}\n") + endif() + endif() +else() + message(FATAL_ERROR "Unknown hw model (${HWM}) for board: ${BOARD}.") endif() set(board_message "Board: ${BOARD}") @@ -144,29 +243,13 @@ if(DEFINED BOARD_REVISION) string(REPLACE "." "_" BOARD_REVISION_STRING ${BOARD_REVISION}) endif() -message(STATUS "${board_message}") - -# Prepare boards usage command printing. -# This command prints all boards in the system in the following cases: -# - User specifies an invalid BOARD -# - User invokes ' boards' target -list(TRANSFORM ARCH_ROOT PREPEND "--arch-root=" OUTPUT_VARIABLE arch_root_args) -list(TRANSFORM BOARD_ROOT PREPEND "--board-root=" OUTPUT_VARIABLE board_root_args) - -set(list_boards_commands - COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/list_boards.py - ${arch_root_args} ${board_root_args} --arch-root=${ZEPHYR_BASE} -) - -if(NOT BOARD_DIR) - message("No board named '${BOARD}' found.\n\n" - "Please choose one of the following boards:\n" - ) - execute_process(${list_boards_commands}) - unset(CACHED_BOARD CACHE) - message(FATAL_ERROR "Invalid BOARD; see above.") +if(DEFINED BOARD_IDENTIFIER) + string(REGEX REPLACE "^/" "variant: " board_message_identifier "${BOARD_IDENTIFIER}") + set(board_message "${board_message}, ${board_message_identifier}") endif() +message(STATUS "${board_message}") + add_custom_target(boards ${list_boards_commands} USES_TERMINAL) # Board extensions are enabled by default diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 23659c1869244..d95ebb362f9d6 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -122,11 +122,19 @@ set(DTS_CMAKE ${PROJECT_BINARY_DIR}/dts.cmake) # modules. set(VENDOR_PREFIXES dts/bindings/vendor-prefixes.txt) -set_ifndef(DTS_SOURCE ${BOARD_DIR}/${BOARD}.dts) +zephyr_build_string(dts_board_string BOARD ${BOARD} BOARD_IDENTIFIER ${BOARD_IDENTIFIER}) + +set_ifndef(DTS_SOURCE ${BOARD_DIR}/${dts_board_string}.dts) if(EXISTS ${DTS_SOURCE}) # We found a devicetree. Check for a board revision overlay. - if(DEFINED BOARD_REVISION AND EXISTS ${BOARD_DIR}/${BOARD}_${BOARD_REVISION_STRING}.overlay) - list(APPEND DTS_SOURCE ${BOARD_DIR}/${BOARD}_${BOARD_REVISION_STRING}.overlay) + if(DEFINED BOARD_REVISION) + zephyr_build_string(dts_board_string BOARD ${BOARD} + BOARD_IDENTIFIER ${BOARD_IDENTIFIER} + BOARD_REVISION ${BOARD_REVISION} + ) + if(EXISTS ${BOARD_DIR}/${dts_board_string}.overlay) + list(APPEND DTS_SOURCE ${BOARD_DIR}/${dts_board_string}.overlay) + endif() endif() else() # If we don't have a devicetree, provide an empty stub diff --git a/cmake/modules/extensions.cmake b/cmake/modules/extensions.cmake index 6bdd55433ebc4..02a9ff18f1ff5 100644 --- a/cmake/modules/extensions.cmake +++ b/cmake/modules/extensions.cmake @@ -1472,6 +1472,7 @@ endfunction() # Usage: # zephyr_build_string( # BOARD +# [BOARD_IDENTIFIER ] # [BOARD_REVISION ] # [BUILD ] # ) @@ -1491,7 +1492,7 @@ endfunction() # will return the string `alpha_1_0_0_debug` in `build_string` parameter. # function(zephyr_build_string outvar) - set(single_args BOARD BOARD_REVISION BUILD) + set(single_args BOARD BOARD_IDENTIFIER BOARD_REVISION BUILD) cmake_parse_arguments(BUILD_STR "" "${single_args}" "" ${ARGN}) if(BUILD_STR_UNPARSED_ARGUMENTS) @@ -1508,8 +1509,20 @@ function(zephyr_build_string outvar) ) endif() + if(DEFINED BUILD_STR_BOARD_IDENTIFIER AND NOT BUILD_STR_BOARD) + message(FATAL_ERROR + "zephyr_build_string(${ARGV0} BOARD_IDENTIFIER ${BUILD_STR_BOARD_IDENTIFIER} ...)" + " given without BOARD argument, please specify BOARD" + ) + endif() + set(${outvar} ${BUILD_STR_BOARD}) + if(DEFINED BUILD_STR_BOARD_IDENTIFIER) + string(REPLACE "/" "_" variant_string ${BUILD_STR_BOARD_IDENTIFIER}) + set(${outvar} "${${outvar}}${variant_string}") + endif() + if(DEFINED BUILD_STR_BOARD_REVISION) string(REPLACE "." "_" revision_string ${BUILD_STR_BOARD_REVISION}) set(${outvar} "${${outvar}}_${revision_string}") diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake new file mode 100644 index 0000000000000..d14096e802c89 --- /dev/null +++ b/cmake/modules/hwm_v2.cmake @@ -0,0 +1,108 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023, Nordic Semiconductor ASA + +# This CMake module works together with the list_hardware.py script to obtain +# all archs and SoC implementations defined in the Zephyr build system. +# +# The result from list_hardware.py is then used to generate Kconfig files for +# the build system. +# +# The following files are generated in '/soc' +# - Kconfig.defconfig: Contains references to SoC defconfig files for Zephyr integration. +# - Kconfig: Contains references to regular SoC Kconfig files for Zephyr integration. +# - Kconfig.soc: Contains references to generic SoC Kconfig files. +# +# The following file is generated in '/arch' +# - Kconfig: Contains references to regular arch Kconfig files for Zephyr integration. + +include_guard(GLOBAL) + +if(NOT HWMv2) + return() +endif() + +# Internal helper function for creation of Kconfig files. +function(kconfig_gen bin_dir file dirs) + file(MAKE_DIRECTORY "${bin_dir}") + set(kconfig_file ${bin_dir}/${file}) + foreach(dir ${dirs}) + file(APPEND ${kconfig_file} "osource \"${dir}/${file}\"\n") + endforeach() +endfunction() + +# 'SOC_ROOT' and 'ARCH_ROOT' are prioritized lists of directories where their +# implementations may be found. It always includes ${ZEPHYR_BASE}/[arch|soc] +# at the lowest priority. +list(APPEND SOC_ROOT ${ZEPHYR_BASE}) +list(APPEND ARCH_ROOT ${ZEPHYR_BASE}) + +list(TRANSFORM ARCH_ROOT PREPEND "--arch-root=" OUTPUT_VARIABLE arch_root_args) +list(TRANSFORM SOC_ROOT PREPEND "--soc-root=" OUTPUT_VARIABLE soc_root_args) + +execute_process(COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/scripts/list_hardware.py + ${arch_root_args} ${soc_root_args} + --archs --socs + --cmakeformat={TYPE}\;{NAME}\;{DIR}\;{HWM} + OUTPUT_VARIABLE ret_hw + ERROR_VARIABLE err_hw + RESULT_VARIABLE ret_val +) +if(ret_val) + message(FATAL_ERROR "Error listing hardware.\nError message: ${err_hw}") +endif() + +set(kconfig_soc_source_dir) + +while(TRUE) + string(FIND "${ret_hw}" "\n" idx REVERSE) + math(EXPR start "${idx} + 1") + string(SUBSTRING "${ret_hw}" ${start} -1 line) + string(SUBSTRING "${ret_hw}" 0 ${idx} ret_hw) + + cmake_parse_arguments(HWM "" "TYPE" "" ${line}) + if(HWM_TYPE STREQUAL "arch") + cmake_parse_arguments(ARCH_V2 "" "NAME;DIR" "" ${line}) + + list(APPEND kconfig_arch_source_dir "${ARCH_V2_DIR}") + list(APPEND ARCH_V2_NAME_LIST ${ARCH_V2_NAME}) + string(TOUPPER "${ARCH_V2_NAME}" ARCH_V2_NAME_UPPER) + set(ARCH_V2_${ARCH_V2_NAME_UPPER}_DIR ${ARCH_V2_DIR}) + elseif(HWM_TYPE MATCHES "^soc|^series|^family") + cmake_parse_arguments(SOC_V2 "" "NAME;DIR;HWM" "" ${line}) + + list(APPEND kconfig_soc_source_dir "${SOC_V2_DIR}") + + if(HWM_TYPE STREQUAL "soc") + set(setting_name SOC_${SOC_V2_NAME}_DIR) + else() + set(setting_name SOC_${HWM_TYPE}_${SOC_V2_NAME}_DIR) + endif() + string(TOUPPER ${setting_name} setting_name) + set(${setting_name} ${SOC_V2_DIR}) + endif() + + if(idx EQUAL -1) + break() + endif() +endwhile() +list(REMOVE_DUPLICATES kconfig_soc_source_dir) + +# Support multiple ARCH_ROOT and SOC_ROOT +set(arch_kconfig_file Kconfig) +set(soc_defconfig_file Kconfig.defconfig) +set(soc_zephyr_file Kconfig) +set(soc_kconfig_file Kconfig.soc) +set(arch_kconfig_header "# Load arch Kconfig descriptions.\n") +set(defconfig_header "# Load Zephyr SoC Kconfig defconfig.\n") +set(soc_zephyr_header "# Load Zephyr SoC Kconfig descriptions.\n") +set(soc_kconfig_header "# Load SoC Kconfig descriptions.\n") +file(WRITE ${KCONFIG_BINARY_DIR}/arch/${arch_kconfig_file} "${arch_kconfig_header}") +file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_defconfig_file} "${defconfig_header}") +file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_zephyr_file} "${soc_zephyr_header}") +file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_kconfig_file} "${soc_kconfig_header}") + +kconfig_gen("${KCONFIG_BINARY_DIR}/arch" "${arch_kconfig_file}" "${kconfig_arch_source_dir}") +kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_defconfig_file}" "${kconfig_soc_source_dir}") +kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_zephyr_file}" "${kconfig_soc_source_dir}") +kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_kconfig_file}" "${kconfig_soc_source_dir}") diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 632e9a7242296..382e6acd8b9fc 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -22,23 +22,30 @@ set_ifndef(KCONFIG_NAMESPACE "CONFIG") set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Kconfig) file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}) -# Support multiple SOC_ROOT, remove ZEPHYR_BASE as that is always sourced. -set(kconfig_soc_root ${SOC_ROOT}) -list(REMOVE_ITEM kconfig_soc_root ${ZEPHYR_BASE}) -set(OPERATION WRITE) -foreach(root ${kconfig_soc_root}) - file(${OPERATION} ${KCONFIG_BINARY_DIR}/Kconfig.soc.defconfig - "osource \"${root}/soc/$(ARCH)/*/Kconfig.defconfig\"\n" - ) - file(${OPERATION} ${KCONFIG_BINARY_DIR}/Kconfig.soc - "osource \"${root}/soc/$(ARCH)/*/Kconfig.soc\"\n" - ) - file(${OPERATION} ${KCONFIG_BINARY_DIR}/Kconfig.soc.arch - "osource \"${root}/soc/$(ARCH)/Kconfig\"\n" - "osource \"${root}/soc/$(ARCH)/*/Kconfig\"\n" - ) - set(OPERATION APPEND) -endforeach() +if(HWMv1) + # Support multiple SOC_ROOT + file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}/soc) + set(kconfig_soc_root ${BOARD_ROOT}) + list(REMOVE_ITEM kconfig_soc_root ${ZEPHYR_BASE}) + set(soc_defconfig_file ${KCONFIG_BINARY_DIR}/soc/Kconfig.defconfig) + + # This loads Zephyr base SoC root defconfigs + file(WRITE ${soc_defconfig_file} "osource \"soc/$(ARCH)/*/Kconfig.defconfig\"\n") + + 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}) @@ -67,9 +74,13 @@ else() set(KCONFIG_ROOT ${ZEPHYR_BASE}/Kconfig) endif() -set_ifndef(BOARD_DEFCONFIG ${BOARD_DIR}/${BOARD}_defconfig) -if((DEFINED BOARD_REVISION) AND EXISTS ${BOARD_DIR}/${BOARD}_${BOARD_REVISION_STRING}.conf) - set_ifndef(BOARD_REVISION_CONFIG ${BOARD_DIR}/${BOARD}_${BOARD_REVISION_STRING}.conf) +zephyr_build_string(config_board_string BOARD ${BOARD} BOARD_IDENTIFIER ${BOARD_IDENTIFIER}) + +if(NOT DEFINED BOARD_DEFCONFIG) + set(BOARD_DEFCONFIG ${BOARD_DIR}/${config_board_string}_defconfig) +endif() +if((DEFINED BOARD_REVISION) AND EXISTS ${BOARD_DIR}/${config_board_string}_${BOARD_REVISION_STRING}.conf) + set_ifndef(BOARD_REVISION_CONFIG ${BOARD_DIR}/${config_board_string}_${BOARD_REVISION_STRING}.conf) endif() set(DOTCONFIG ${PROJECT_BINARY_DIR}/.config) set(PARSED_KCONFIG_SOURCES_TXT ${PROJECT_BINARY_DIR}/kconfig/sources.txt) @@ -135,12 +146,11 @@ set(COMMON_KCONFIG_ENV_SETTINGS APPVERSION=${APP_VERSION_STRING} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} - # Set environment variables so that Kconfig can prune Kconfig source - # files for other architectures - ARCH=${ARCH} - ARCH_DIR=${ARCH_DIR} BOARD_DIR=${BOARD_DIR} + BOARD=${BOARD} BOARD_REVISION=${BOARD_REVISION} + BOARD_IDENTIFIER=${BOARD_IDENTIFIER} + HWM_SCHEME=${HWM} KCONFIG_BINARY_DIR=${KCONFIG_BINARY_DIR} APPLICATION_SOURCE_DIR=${APPLICATION_SOURCE_DIR} ZEPHYR_TOOLCHAIN_VARIANT=${ZEPHYR_TOOLCHAIN_VARIANT} @@ -152,6 +162,21 @@ 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() + # Allow out-of-tree users to add their own Kconfig python frontend # targets by appending targets to the CMake list # 'EXTRA_KCONFIG_TARGETS' and setting variables named diff --git a/cmake/modules/pre_dt.cmake b/cmake/modules/pre_dt.cmake index b19fd7f7fb57e..4e062b2b97069 100644 --- a/cmake/modules/pre_dt.cmake +++ b/cmake/modules/pre_dt.cmake @@ -62,6 +62,14 @@ 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() + # Finalize DTS_ROOT_SYSTEM_INCLUDE_DIRS. set(DTS_ROOT_SYSTEM_INCLUDE_DIRS) foreach(dts_root ${DTS_ROOT}) @@ -69,7 +77,7 @@ function(pre_dt_module_run) include include/zephyr dts/common - dts/${ARCH} + ${arch_include} dts ) get_filename_component(full_path ${dts_root}/${dts_root_path} REALPATH) diff --git a/cmake/modules/soc.cmake b/cmake/modules/soc.cmake deleted file mode 100644 index 5253620b6b9af..0000000000000 --- a/cmake/modules/soc.cmake +++ /dev/null @@ -1,71 +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) - -# '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() diff --git a/cmake/modules/soc_v1.cmake b/cmake/modules/soc_v1.cmake new file mode 100644 index 0000000000000..9bf24bc070fb6 --- /dev/null +++ b/cmake/modules/soc_v1.cmake @@ -0,0 +1,73 @@ +# 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() +endif() diff --git a/cmake/modules/soc_v2.cmake b/cmake/modules/soc_v2.cmake new file mode 100644 index 0000000000000..086d87a7540ba --- /dev/null +++ b/cmake/modules/soc_v2.cmake @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2021, Nordic Semiconductor ASA + +# Configure SoC settings based on Kconfig settings. +# +# This CMake module will set the following variables in the build system based +# on Kconfig settings for the selected SoC. +# +# 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 +# +# 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(HWMv2) + 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}) +endif() diff --git a/cmake/modules/unittest.cmake b/cmake/modules/unittest.cmake index 8853f5a5b0cb6..2551f41832a93 100644 --- a/cmake/modules/unittest.cmake +++ b/cmake/modules/unittest.cmake @@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.20.0) include(root) include(boards) -include(arch) +include(arch_v1) include(configuration_files) include(west) diff --git a/cmake/modules/zephyr_default.cmake b/cmake/modules/zephyr_default.cmake index 98a580c3a2d5d..7472331255b81 100644 --- a/cmake/modules/zephyr_default.cmake +++ b/cmake/modules/zephyr_default.cmake @@ -96,7 +96,8 @@ 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) +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) @@ -108,7 +109,9 @@ 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 soc) +list(APPEND zephyr_cmake_modules arch_v2) +list(APPEND zephyr_cmake_modules soc_v1) +list(APPEND zephyr_cmake_modules soc_v2) foreach(component ${SUB_COMPONENTS}) if(NOT ${component} IN_LIST zephyr_cmake_modules) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index c4042e298ad0a..5ad05d613c70e 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -83,6 +83,10 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: with open(Path(td) / "Kconfig.dts", "w") as f: f.write(kconfig) + (Path(td) / 'soc').mkdir(exist_ok=True) + with open(Path(td) / "soc" / "Kconfig.defconfig", "w") as f: + f.write('') + # base environment os.environ["ZEPHYR_BASE"] = str(ZEPHYR_BASE) os.environ["srctree"] = str(ZEPHYR_BASE) @@ -91,8 +95,9 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: # include all archs and boards os.environ["ARCH_DIR"] = "arch" - os.environ["ARCH"] = "*" + os.environ["ARCH"] = "[!v][!2]*" os.environ["BOARD_DIR"] = "boards/*/*" + os.environ["HWM_SCHEME"] = "v1" # insert external Kconfigs to the environment module_paths = dict() diff --git a/samples/modules/tflite-micro/hello_world/sample.yaml b/samples/modules/tflite-micro/hello_world/sample.yaml index bfd142f670279..000db6fffe2eb 100644 --- a/samples/modules/tflite-micro/hello_world/sample.yaml +++ b/samples/modules/tflite-micro/hello_world/sample.yaml @@ -23,6 +23,6 @@ tests: filter: CONFIG_FULL_LIBC_SUPPORTED sample.tensorflow.helloworld.cmsis_nn: tags: tensorflow - platform_allow: mps3_an547 + platform_allow: mps3/an547 extra_configs: - CONFIG_TENSORFLOW_LITE_MICRO_CMSIS_NN_KERNELS=y diff --git a/samples/modules/tflite-micro/tflm_ethosu/sample.yaml b/samples/modules/tflite-micro/tflm_ethosu/sample.yaml index e1ff20cbd0fa4..6e0342e6a5656 100644 --- a/samples/modules/tflite-micro/tflm_ethosu/sample.yaml +++ b/samples/modules/tflite-micro/tflm_ethosu/sample.yaml @@ -10,4 +10,4 @@ tests: filter: dt_compat_enabled("arm,ethos-u") build_only: true integration_platforms: - - mps3_an547 + - mps3/an547 diff --git a/scripts/ci/Kconfig.board.v2 b/scripts/ci/Kconfig.board.v2 new file mode 100644 index 0000000000000..e1335cafe3938 --- /dev/null +++ b/scripts/ci/Kconfig.board.v2 @@ -0,0 +1,10 @@ +# Kconfig top-level ci for compliance testing Kconfig tree for boards / SoC v2 scheme. +# +# Copyright (c) 2022 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +mainmenu "Zephyr board / SoC v2 Configuration" + +source "boards/Kconfig.v2" +source "soc/Kconfig.v2" diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index a331fa1c7b922..c8f9682e3e009 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -29,6 +29,8 @@ sys.path.insert(0, str(Path(__file__).resolve().parents[1])) from get_maintainer import Maintainers, MaintainersError +import list_boards +import list_hardware logger = None @@ -273,10 +275,10 @@ class KconfigCheck(ComplianceTest): doc = "See https://docs.zephyrproject.org/latest/build/kconfig/tips.html for more details." path_hint = "" - def run(self, full=True, no_modules=False): + def run(self, full=True, no_modules=False, filename="Kconfig", hwm=None): self.no_modules = no_modules - kconf = self.parse_kconfig() + kconf = self.parse_kconfig(filename=filename, hwm=hwm) self.check_top_menu_not_too_long(kconf) self.check_no_pointless_menuconfigs(kconf) @@ -346,8 +348,97 @@ def get_kconfig_dts(self, kconfig_dts_file): except subprocess.CalledProcessError as ex: self.error(ex.output.decode("utf-8")) + def get_v1_model_syms(self, kconfig_v1_file, kconfig_v1_syms_file): + """ + Generate a symbol define Kconfig file. + This function creates a file with all Kconfig symbol definitions from + old boards model so that those symbols will not appear as undefined + symbols in hardware model v2. + + This is needed to complete Kconfig compliance tests. + """ + os.environ['HWM_SCHEME'] = 'v1' + # 'kconfiglib' is global + # pylint: disable=undefined-variable + + try: + kconf_v1 = kconfiglib.Kconfig(filename=kconfig_v1_file, warn=False) + except kconfiglib.KconfigError as e: + self.failure(str(e)) + raise EndTest + + with open(kconfig_v1_syms_file, 'w') as fp_kconfig_v1_syms_file: + for s in kconf_v1.defined_syms: + if s.type != kconfiglib.UNKNOWN: + fp_kconfig_v1_syms_file.write('config ' + s.name) + fp_kconfig_v1_syms_file.write('\n\t' + kconfiglib.TYPE_TO_STR[s.type]) + fp_kconfig_v1_syms_file.write('\n\n') + + def get_v2_model(self, kconfig_dir): + """ + Get lists of v2 boards and SoCs and put them in a file that is parsed by + Kconfig - def parse_kconfig(self): + This is needed to complete Kconfig sanity tests. + """ + os.environ['HWM_SCHEME'] = 'v2' + kconfig_file = os.path.join(kconfig_dir, 'boards', 'Kconfig') + kconfig_boards_file = os.path.join(kconfig_dir, 'boards', 'Kconfig.boards') + kconfig_defconfig_file = os.path.join(kconfig_dir, 'boards', 'Kconfig.defconfig') + + root_args = argparse.Namespace(**{'board_roots': [Path(ZEPHYR_BASE)], + 'soc_roots': [Path(ZEPHYR_BASE)], 'board': None}) + v2_boards = list_boards.find_v2_boards(root_args) + + with open(kconfig_defconfig_file, 'w') as fp: + for board in v2_boards: + fp.write('osource "' + os.path.join(board.dir, 'Kconfig.defconfig') + '"\n') + + with open(kconfig_boards_file, 'w') as fp: + for board in v2_boards: + board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", board.name).upper() + fp.write('config ' + board_str + '\n') + fp.write('\t bool\n') + for identifier in list_boards.board_v2_identifiers(board): + board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", identifier).upper() + fp.write('config ' + board_str + '\n') + fp.write('\t bool\n') + fp.write('source "' + os.path.join(board.dir, 'Kconfig.') + board.name + '"\n\n') + + with open(kconfig_file, 'w') as fp: + fp.write('osource "' + os.path.join(kconfig_dir, 'boards', 'Kconfig.syms.v1') + '"\n') + for board in v2_boards: + fp.write('osource "' + os.path.join(board.dir, 'Kconfig') + '"\n') + + kconfig_defconfig_file = os.path.join(kconfig_dir, 'soc', 'Kconfig.defconfig') + kconfig_soc_file = os.path.join(kconfig_dir, 'soc', 'Kconfig.soc') + kconfig_file = os.path.join(kconfig_dir, 'soc', 'Kconfig') + + root_args = argparse.Namespace(**{'soc_roots': [Path(ZEPHYR_BASE)]}) + v2_systems = list_hardware.find_v2_systems(root_args) + + with open(kconfig_defconfig_file, 'w') as fp: + for soc in v2_systems.get_socs(): + fp.write('source "' + os.path.join(soc.folder, 'Kconfig.defconfig') + '"\n') + + with open(kconfig_soc_file, 'w') as fp: + for soc in v2_systems.get_socs(): + fp.write('source "' + os.path.join(soc.folder, 'Kconfig.soc') + '"\n\n') + + with open(kconfig_file, 'w') as fp: + for soc in v2_systems.get_socs(): + fp.write('source "' + os.path.join(soc.folder, 'Kconfig') + '"\n') + + kconfig_file = os.path.join(kconfig_dir, 'arch', 'Kconfig') + + root_args = argparse.Namespace(**{'arch_roots': [Path(ZEPHYR_BASE)], 'arch': None}) + v2_archs = list_hardware.find_v2_archs(root_args) + + with open(kconfig_file, 'w') as fp: + for arch in v2_archs['archs']: + fp.write('source "' + os.path.join(arch['path'], 'Kconfig') + '"\n') + + def parse_kconfig(self, filename="Kconfig", hwm=None): """ Returns a kconfiglib.Kconfig object for the Kconfig files. We reuse this object for all tests to avoid having to reparse for each test. @@ -372,8 +463,8 @@ def parse_kconfig(self): # Parse the entire Kconfig tree, to make sure we see all symbols os.environ["SOC_DIR"] = "soc/" os.environ["ARCH_DIR"] = "arch/" - os.environ["BOARD_DIR"] = "boards/*/*" - os.environ["ARCH"] = "*" + os.environ["BOARD"] = "boards" + os.environ["ARCH"] = "[!v][!2]*" os.environ["KCONFIG_BINARY_DIR"] = kconfiglib_dir os.environ['DEVICETREE_CONF'] = "dummy" os.environ['TOOLCHAIN_HAS_NEWLIB'] = "y" @@ -387,6 +478,28 @@ def parse_kconfig(self): # For Kconfig.dts support self.get_kconfig_dts(os.path.join(kconfiglib_dir, "Kconfig.dts")) + # To make compliance work with old hw model and HWMv2 simultaneously. + kconfiglib_boards_dir = os.path.join(kconfiglib_dir, 'boards') + os.makedirs(kconfiglib_boards_dir, exist_ok=True) + os.makedirs(os.path.join(kconfiglib_dir, 'soc'), exist_ok=True) + os.makedirs(os.path.join(kconfiglib_dir, 'arch'), exist_ok=True) + + if hwm is None or hwm == "v1": + v1_file = os.path.join(kconfiglib_dir, "Kconfig.v1") + v1_syms_file = os.path.join(kconfiglib_boards_dir, 'Kconfig.syms.v1') + with open(v1_file, 'w') as fp: + fp.write('source "boards/[!v][!2]*/*/Kconfig.defconfig"\n') + fp.write('osource "soc/[!v][!2]*/*/Kconfig.defconfig"\n') + fp.write('source "boards/Kconfig"\n') + fp.write('source "soc/Kconfig"\n') + + os.environ["BOARD_DIR"] = "boards/[!v][!2]*/*" + self.get_v1_model_syms(v1_file, v1_syms_file) + + if hwm is None or hwm == "v2": + os.environ["BOARD_DIR"] = kconfiglib_boards_dir + self.get_v2_model(kconfiglib_dir) + # Tells Kconfiglib to generate warnings for all references to undefined # symbols within Kconfig files os.environ["KCONFIG_WARN_UNDEF"] = "y" @@ -396,7 +509,7 @@ def parse_kconfig(self): # them: so some warnings might get printed # twice. "warn_to_stderr=False" could unfortunately cause # some (other) warnings to never be printed. - return kconfiglib.Kconfig() + return kconfiglib.Kconfig(filename=filename) except kconfiglib.KconfigError as e: self.failure(str(e)) raise EndTest @@ -428,7 +541,6 @@ def get_defined_syms(self, kconf): return set([sym.name for sym in kconf_syms] + re.findall(regex, grep_stdout, re.MULTILINE)) - def check_top_menu_not_too_long(self, kconf): """ Checks that there aren't too many items in the top-level menu (which @@ -754,6 +866,23 @@ def run(self): super().run(full=False, no_modules=True) +class KconfigHWMv2Check(KconfigCheck, ComplianceTest): + """ + This runs the Kconfig test for board and SoC v2 scheme. + This check ensures that all symbols inside the v2 scheme is also defined + within the same tree. + This ensures the board and SoC trees are fully self-contained and reusable. + """ + name = "KconfigHWMv2" + doc = "See https://docs.zephyrproject.org/latest/guides/kconfig/index.html for more details." + + def run(self): + # Use dedicated Kconfig board / soc v2 scheme file. + # This file sources only v2 scheme tree. + kconfig_file = os.path.join(os.path.dirname(__file__), "Kconfig.board.v2") + super().run(full=False, hwm="v2", filename=kconfig_file) + + class Nits(ComplianceTest): """ Checks various nits in added/modified files. Doesn't check stuff that's diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index a2ba406d8ce38..07f60069a4978 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -232,7 +232,7 @@ def find_boards(self): roots.append(repository_path) # Look for boards in monitored repositories - lb_args = argparse.Namespace(**{ 'arch_roots': roots, 'board_roots': roots}) + lb_args = argparse.Namespace(**{ 'arch_roots': roots, 'board_roots': roots, 'board': None}) known_boards = list_boards.find_boards(lb_args) for b in boards: name_re = re.compile(b) diff --git a/scripts/kconfig/kconfigfunctions.py b/scripts/kconfig/kconfigfunctions.py index 621ec3cb3a8bd..4af504c321b20 100644 --- a/scripts/kconfig/kconfigfunctions.py +++ b/scripts/kconfig/kconfigfunctions.py @@ -6,6 +6,7 @@ import inspect import os import pickle +import re import sys from pathlib import Path @@ -743,6 +744,17 @@ def dt_gpio_hogs_enabled(kconf, _): return "n" + +def sanitize_upper(kconf, _, string): + """ + Sanitize the string, so that the string only contains alpha-numeric + characters or underscores. All non-alpha-numeric characters are replaced + with an underscore, '_'. + When string has been sanitized it will be converted into upper case. + """ + return re.sub(r'[^a-zA-Z0-9_]', '_', string).upper() + + def shields_list_contains(kconf, _, shield): """ Return "n" if cmake environment variable 'SHIELD_AS_LIST' doesn't exist. @@ -806,5 +818,6 @@ def shields_list_contains(kconf, _, shield): "dt_node_parent": (dt_node_parent, 1, 1), "dt_nodelabel_array_prop_has_val": (dt_nodelabel_array_prop_has_val, 3, 3), "dt_gpio_hogs_enabled": (dt_gpio_hogs_enabled, 0, 0), + "sanitize_upper": (sanitize_upper, 1, 1), "shields_list_contains": (shields_list_contains, 1, 1), } diff --git a/scripts/list_boards.py b/scripts/list_boards.py index 4c7c87cad452e..19fbbc7868427 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -5,9 +5,20 @@ import argparse from collections import defaultdict +from dataclasses import dataclass, field import itertools from pathlib import Path -from typing import NamedTuple +import pykwalify.core +import sys +from typing import List +import yaml +import list_hardware + +BOARD_SCHEMA_PATH = str(Path(__file__).parent / 'schemas' / 'board-schema.yml') +with open(BOARD_SCHEMA_PATH, 'r') as f: + board_schema = yaml.safe_load(f.read()) + +BOARD_YML = 'board.yml' # # This is shared code between the build system's 'boards' target @@ -18,10 +29,73 @@ # 'ninja boards' in a build directory without west installed.) # -class Board(NamedTuple): +@dataclass +class Revision: + name: str + variants: List[str] = field(default_factory=list) + + @staticmethod + def from_dict(revision): + revisions = [] + for r in revision.get('revisions', []): + revisions.append(Revision.from_dict(r)) + return Revision(revision['name'], revisions) + + + +@dataclass +class Variant: + name: str + variants: List[str] = field(default_factory=list) + + @staticmethod + def from_dict(variant): + variants = [] + for v in variant.get('variants', []): + variants.append(Variant.from_dict(v)) + return Variant(variant['name'], variants) + + +@dataclass +class Cpucluster: + name: str + variants: List[str] = field(default_factory=list) + + +@dataclass +class Soc: + name: str + cpuclusters: List[str] = field(default_factory=list) + variants: List[str] = field(default_factory=list) + + @staticmethod + def from_soc(soc, variants): + if soc is None: + return None + if soc.cpuclusters: + cpus = [] + for c in soc.cpuclusters: + cpus.append(Cpucluster(c, + [Variant.from_dict(v) for v in variants if c == v['cpucluster']] + )) + return Soc(soc.name, cpuclusters=cpus) + return Soc(soc.name, variants=[Variant.from_dict(v) for v in variants]) + + +@dataclass(frozen=True) +class Board: name: str - arch: str dir: Path + hwm: str + arch: str = None + vendor: str = None + revision_format: str = None + revision_default: str = None + revision_exact: bool = False + revisions: List[str] = field(default_factory=list, compare=False) + socs: List[Soc] = field(default_factory=list, compare=False) + variants: List[str] = field(default_factory=list, compare=False) + def board_key(board): return board.name @@ -41,7 +115,10 @@ def find_arch2board_set(args): for root in args.board_roots: for arch, boards in find_arch2board_set_in(root, arches).items(): - ret[arch] |= boards + if args.board is not None: + ret[arch] |= {b for b in boards if b.name == args.board} + else: + ret[arch] |= boards return ret @@ -83,15 +160,74 @@ def find_arch2board_set_in(root, arches): file_name = maybe_defconfig.name if file_name.endswith('_defconfig'): board_name = file_name[:-len('_defconfig')] - ret[arch].add(Board(board_name, arch, maybe_board)) + ret[arch].add(Board(board_name, maybe_board, 'v1', arch=arch)) return ret + +def find_v2_boards(args): + root_args = argparse.Namespace(**{'soc_roots': args.soc_roots}) + systems = list_hardware.find_v2_systems(root_args) + + boards = [] + board_files = [] + for root in args.board_roots: + board_files.extend((root / 'boards').rglob(BOARD_YML)) + + for board_yml in board_files: + if board_yml.is_file(): + with board_yml.open('r') as f: + b = yaml.safe_load(f.read()) + + try: + pykwalify.core.Core(source_data=b, schema_data=board_schema).validate() + except pykwalify.errors.SchemaError as e: + sys.exit('ERROR: Malformed "build" section in file: {}\n{}' + .format(board_yml.as_posix(), e)) + + mutual_exclusive = {'board', 'boards'} + if len(mutual_exclusive - b.keys()) < 1: + sys.exit(f'ERROR: Malformed content in file: {board_yml.as_posix()}\n' + f'{mutual_exclusive} are mutual exclusive at this level.') + + board_array = b.get('boards', [ b.get('board', None) ]) + for board in board_array: + if args.board is not None: + if board['name'] != args.board: + # Not the board we're looking for, ignore. + continue + + mutual_exclusive = {'socs', 'variants'} + if len(mutual_exclusive - board.keys()) < 1: + sys.exit(f'ERROR: Malformed "board" section in file: {board_yml.as_posix()}\n' + f'{mutual_exclusive} are mutual exclusive at this level.') + socs = [Soc.from_soc(systems.get_soc(s['name']), s.get('variants', [])) + for s in board.get('socs', {})] + + board = Board( + name=board['name'], + dir=board_yml.parent, + vendor=board.get('vendor'), + revision_format=board.get('revision', {}).get('format'), + revision_default=board.get('revision', {}).get('default'), + revision_exact=board.get('revision', {}).get('exact', False), + revisions=[Revision.from_dict(v) for v in + board.get('revision', {}).get('revisions', [])], + socs=socs, + variants=[Variant.from_dict(v) for v in board.get('variants', [])], + hwm='v2', + ) + boards.append(board) + return boards + + def parse_args(): parser = argparse.ArgumentParser(allow_abbrev=False) add_args(parser) + add_args_formatting(parser) return parser.parse_args() + def add_args(parser): # Remember to update west-completion.bash if you add or remove # flags @@ -101,12 +237,98 @@ def add_args(parser): parser.add_argument("--board-root", dest='board_roots', default=[], type=Path, action='append', help='add a board root, may be given more than once') + parser.add_argument("--soc-root", dest='soc_roots', default=[], + type=Path, action='append', + help='add a soc root, may be given more than once') + parser.add_argument("--board", dest='board', default=None, + help='lookup the specific board, fail if not found') + + +def add_args_formatting(parser): + parser.add_argument("--cmakeformat", default=None, + help='''CMake Format string to use to list each board''') + -def dump_boards(arch2boards): +def variant_v2_identifiers(variant, identifier): + identifiers = [identifier + '/' + variant.name] + for v in variant.variants: + identifiers.append(variant_v2_identifiers(v, identifier + '/' + variant.name)) + return identifiers + + +def board_v2_identifiers(board): + identifiers = [] + + for s in board.socs: + if s.cpuclusters: + for c in s.cpuclusters: + id_str = board.name + '/' + s.name + '/' + c.name + identifiers.append(id_str) + for v in c.variants: + identifiers.extend(variant_v2_identifiers(v, id_str)) + else: + id_str = board.name + '/' + s.name + identifiers.append(id_str) + for v in s.variants: + identifiers.extend(variant_v2_identifiers(v, id_str)) + + if not board.socs: + identifiers.append(board.name) + + for v in board.variants: + identifiers.extend(variant_v2_identifiers(v, board.name)) + return identifiers + + +def dump_v2_boards(args): + boards = find_v2_boards(args) + + for b in boards: + identifiers = board_v2_identifiers(b) + if args.cmakeformat is not None: + notfound = lambda x: x or 'NOTFOUND' + info = args.cmakeformat.format( + NAME='NAME;' + b.name, + DIR='DIR;' + str(b.dir), + VENDOR='VENDOR;' + notfound(b.vendor), + HWM='HWM;' + b.hwm, + REVISION_DEFAULT='REVISION_DEFAULT;' + notfound(b.revision_default), + REVISION_FORMAT='REVISION_FORMAT;' + notfound(b.revision_format), + REVISION_EXACT='REVISION_EXACT;' + str(b.revision_exact), + REVISIONS='REVISIONS;' + ';'.join( + [x.name for x in b.revisions]), + IDENTIFIERS='IDENTIFIERS;' + ';'.join(identifiers) + ) + print(info) + else: + print(f'{b.name}') + + +def dump_boards(args): + arch2boards = find_arch2boards(args) for arch, boards in arch2boards.items(): - print(f'{arch}:') + if args.cmakeformat is None: + print(f'{arch}:') for board in boards: - print(f' {board.name}') + if args.cmakeformat is not None: + info = args.cmakeformat.format( + NAME='NAME;' + board.name, + DIR='DIR;' + str(board.dir), + HWM='HWM;' + board.hwm, + VENDOR='VENDOR;NOTFOUND', + REVISION_DEFAULT='REVISION_DEFAULT;NOTFOUND', + REVISION_FORMAT='REVISION_FORMAT;NOTFOUND', + REVISION_EXACT='REVISION_EXACT;NOTFOUND', + REVISIONS='REVISIONS;NOTFOUND', + VARIANT_DEFAULT='VARIANT_DEFAULT;NOTFOUND', + IDENTIFIERS='IDENTIFIERS;' + ) + print(info) + else: + print(f' {board.name}') + if __name__ == '__main__': - dump_boards(find_arch2boards(parse_args())) + args = parse_args() + dump_boards(args) + dump_v2_boards(args) diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py new file mode 100755 index 0000000000000..449ecee926be5 --- /dev/null +++ b/scripts/list_hardware.py @@ -0,0 +1,283 @@ +#!/usr/bin/env python3 + +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +import argparse +from dataclasses import dataclass +from pathlib import Path, PurePath +import pykwalify.core +import sys +from typing import List +import yaml + + +SOC_SCHEMA_PATH = str(Path(__file__).parent / 'schemas' / 'soc-schema.yml') +with open(SOC_SCHEMA_PATH, 'r') as f: + soc_schema = yaml.safe_load(f.read()) + +ARCH_SCHEMA_PATH = str(Path(__file__).parent / 'schemas' / 'arch-schema.yml') +with open(ARCH_SCHEMA_PATH, 'r') as f: + arch_schema = yaml.safe_load(f.read()) + +SOC_YML = 'soc.yml' +ARCHS_YML_PATH = PurePath('arch/archs.yml') + +class Systems: + + def __init__(self, folder='', soc_yaml=None): + self._socs = [] + self._series = [] + self._families = [] + + if soc_yaml is None: + return + + try: + data = yaml.safe_load(soc_yaml) + pykwalify.core.Core(source_data=data, + schema_data=soc_schema).validate() + except (yaml.YAMLError, pykwalify.errors.SchemaError) as e: + sys.exit(f'ERROR: Malformed yaml {soc_yaml.as_posix()}', e) + + for f in data.get('family', []): + family = Family(f['name'], folder, [], []) + for s in f.get('series', []): + series = Series(s['name'], folder, f['name'], []) + socs = [(Soc(soc['name'], + [c['name'] for c in soc.get('cpuclusters', [])], + folder, s['name'], f['name'])) + for soc in s.get('socs', [])] + series.socs.extend(socs) + self._series.append(series) + self._socs.extend(socs) + family.series.append(series) + family.socs.extend(socs) + socs = [(Soc(soc['name'], + [c['name'] for c in soc.get('cpuclusters', [])], + folder, None, f['name'])) + for soc in f.get('socs', [])] + self._socs.extend(socs) + self._families.append(family) + + for s in data.get('series', []): + series = Series(s['name'], folder, '', []) + socs = [(Soc(soc['name'], + [c['name'] for c in soc.get('cpuclusters', [])], + folder, s['name'], '')) + for soc in s.get('socs', [])] + series.socs.extend(socs) + self._series.append(series) + self._socs.extend(socs) + + socs = [(Soc(soc['name'], + [c['name'] for c in soc.get('cpuclusters', [])], + folder, '', '')) + for soc in data.get('socs', [])] + self._socs.extend(socs) + + @staticmethod + def from_file(socs_file): + '''Load SoCs from a soc.yml file. + ''' + try: + with open(socs_file, 'r') as f: + socs_yaml = f.read() + except FileNotFoundError as e: + sys.exit(f'ERROR: socs.yml file not found: {socs_file.as_posix()}', e) + + return Systems(str(socs_file.parent), socs_yaml) + + @staticmethod + def from_yaml(socs_yaml): + '''Load socs from a string with YAML contents. + ''' + return Systems('', socs_yaml) + + def extend(self, systems): + self._families.extend(systems.get_families()) + self._series.extend(systems.get_series()) + self._socs.extend(systems.get_socs()) + + def get_families(self): + return self._families + + def get_series(self): + return self._series + + def get_socs(self): + return self._socs + + def get_soc(self, name): + try: + return next(s for s in self._socs if s.name == name) + except StopIteration: + sys.exit(f"ERROR: SoC '{name}' is not found, please ensure that the SoC exists " + f"and that soc-root containing '{name}' has been correctly defined.") + + +@dataclass +class Soc: + name: str + cpuclusters: List[str] + folder: str + series: str = '' + family: str = '' + + +@dataclass +class Series: + name: str + folder: str + family: str + socs: List[Soc] + + +@dataclass +class Family: + name: str + folder: str + series: List[Series] + socs: List[Soc] + + +def find_v2_archs(args): + ret = {'archs': []} + for root in args.arch_roots: + archs_yml = root / ARCHS_YML_PATH + + if Path(archs_yml).is_file(): + with Path(archs_yml).open('r') as f: + archs = yaml.safe_load(f.read()) + + try: + pykwalify.core.Core(source_data=archs, schema_data=arch_schema).validate() + except pykwalify.errors.SchemaError as e: + sys.exit('ERROR: Malformed "build" section in file: {}\n{}' + .format(archs_yml.as_posix(), e)) + + if args.arch is not None: + archs = {'archs': list(filter( + lambda arch: arch.get('name') == args.arch, archs['archs']))} + for arch in archs['archs']: + arch.update({'path': root / 'arch' / arch['path']}) + arch.update({'hwm': 'v2'}) + arch.update({'type': 'arch'}) + + ret['archs'].extend(archs['archs']) + + return ret + + +def find_v2_systems(args): + yml_files = [] + systems = Systems() + for root in args.soc_roots: + yml_files.extend((root / 'soc').rglob(SOC_YML)) + + for soc_yml in yml_files: + if soc_yml.is_file(): + systems.extend(Systems.from_file(soc_yml)) + + return systems + + +def parse_args(): + parser = argparse.ArgumentParser(allow_abbrev=False) + add_args(parser) + return parser.parse_args() + + +def add_args(parser): + default_fmt = '{name}' + + parser.add_argument("--soc-root", dest='soc_roots', default=[], + type=Path, action='append', + help='add a SoC root, may be given more than once') + parser.add_argument("--soc", default=None, help='lookup the specific soc') + parser.add_argument("--soc-series", default=None, help='lookup the specific soc series') + parser.add_argument("--soc-family", default=None, help='lookup the specific family') + parser.add_argument("--socs", action='store_true', help='lookup all socs') + parser.add_argument("--arch-root", dest='arch_roots', default=[], + type=Path, action='append', + help='add a arch root, may be given more than once') + parser.add_argument("--arch", default=None, help='lookup the specific arch') + parser.add_argument("--archs", action='store_true', help='lookup all archs') + parser.add_argument("--format", default=default_fmt, + help='''Format string to use to list each soc.''') + parser.add_argument("--cmakeformat", default=None, + help='''CMake format string to use to list each arch/soc.''') + + +def dump_v2_archs(args): + archs = find_v2_archs(args) + + for arch in archs['archs']: + if args.cmakeformat is not None: + info = args.cmakeformat.format( + TYPE='TYPE;' + arch['type'], + NAME='NAME;' + arch['name'], + DIR='DIR;' + str(arch['path']), + HWM='HWM;' + arch['hwm'], + # Below is non exising for arch but is defined here to support + # common formatting string. + SERIES='', + FAMILY='', + ARCH='', + VENDOR='' + ) + else: + info = args.format.format( + type=arch.get('type'), + name=arch.get('name'), + dir=arch.get('path'), + hwm=arch.get('hwm'), + # Below is non exising for arch but is defined here to support + # common formatting string. + series='', + family='', + arch='', + vendor='' + ) + + print(info) + + +def dump_v2_system(args, type, system): + if args.cmakeformat is not None: + info = args.cmakeformat.format( + TYPE='TYPE;' + type, + NAME='NAME;' + system.name, + DIR='DIR;' + system.folder, + HWM='HWM;' + 'v2' + ) + else: + info = args.format.format( + type=type, + name=system.name, + dir=system.folder, + hwm='v2' + ) + + print(info) + + +def dump_v2_systems(args): + systems = find_v2_systems(args) + + for f in systems.get_families(): + dump_v2_system(args, 'family', f) + + for s in systems.get_series(): + dump_v2_system(args, 'series', s) + + for s in systems.get_socs(): + dump_v2_system(args, 'soc', s) + + +if __name__ == '__main__': + args = parse_args() + if any([args.socs, args.soc, args.soc_series, args.soc_family]): + dump_v2_systems(args) + if args.archs or args.arch is not None: + dump_v2_archs(args) diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index e25e05e49a138..0e0a435cfc492 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -18,6 +18,7 @@ import random import snippets from pathlib import Path +from argparse import Namespace logger = logging.getLogger('twister') logger.setLevel(logging.DEBUG) @@ -34,7 +35,7 @@ from twisterlib.testinstance import TestInstance from twisterlib.quarantine import Quarantine - +import list_boards from zephyr_module import parse_modules ZEPHYR_BASE = os.getenv("ZEPHYR_BASE") @@ -398,13 +399,24 @@ def info(what): def add_configurations(self): - for board_root in self.env.board_roots: - board_root = os.path.abspath(board_root) - logger.debug("Reading platform configuration files under %s..." % - board_root) + board_dirs = set() + # Create a list of board roots as defined by the build system in general + # Note, internally in twister a board root includes the `boards` folder + # but in Zephyr build system, the board root is without the `boards` in folder path. + board_roots = [Path(os.path.dirname(root)) for root in self.env.board_roots] + lb_args = Namespace(arch_roots=[Path(ZEPHYR_BASE)], soc_roots=[Path(ZEPHYR_BASE)], + board_roots=board_roots, board=None) + v1_boards = list_boards.find_boards(lb_args) + v2_boards = list_boards.find_v2_boards(lb_args) + for b in v1_boards: + board_dirs.add(b.dir) + for b in v2_boards: + board_dirs.add(b.dir) + logger.debug("Reading platform configuration files under %s..." % self.env.board_roots) - platform_config = self.test_config.get('platforms', {}) - for file in glob.glob(os.path.join(board_root, "*", "*", "*.yaml")): + platform_config = self.test_config.get('platforms', {}) + for folder in board_dirs: + for file in glob.glob(os.path.join(folder, "*.yaml")): try: platform = Platform() platform.load(file) diff --git a/scripts/schemas/arch-schema.yml b/scripts/schemas/arch-schema.yml new file mode 100644 index 0000000000000..e1228ee151952 --- /dev/null +++ b/scripts/schemas/arch-schema.yml @@ -0,0 +1,29 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023, Nordic Semiconductor ASA + +## A pykwalify schema for basic validation of the structure of a +## arch metadata YAML file. +## +# The archs.yml file is a simple list of key value pairs containing architectures +# and their location which is used by the build system. +type: map +mapping: + archs: + required: true + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + desc: Name of the arch + path: + required: true + type: str + desc: Location of the arch implementation relative to the archs.yml file. + comment: + required: false + type: str + desc: Free form comment with extra information regarding the arch. diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml new file mode 100644 index 0000000000000..8d258f90e32c9 --- /dev/null +++ b/scripts/schemas/board-schema.yml @@ -0,0 +1,82 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023, Nordic Semiconductor ASA + +## A pykwalify schema for basic validation of the structure of a +## board metadata YAML file. +## +# The board.yml file is a simple list of key value pairs containing board +# information like: name, vendor, socs, variants. +schema;variant-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + cpucluster: + required: false + type: str + variants: + required: false + include: variant-schema + +schema;board-schema: + type: map + mapping: + name: + required: true + type: str + desc: Name of the board + vendor: + required: false + type: str + desc: SoC family of the SoC on the board. + revision: + required: false + type: map + mapping: + format: + required: true + type: str + enum: + ["major.minor.patch", "letter", "number", "custom"] + default: + required: true + type: str + exact: + required: false + type: bool + revisions: + required: true + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + socs: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + variants: + include: variant-schema + variants: + include: variant-schema + +type: map +mapping: + board: + include: board-schema + boards: + type: seq + sequence: + - include: board-schema diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml new file mode 100644 index 0000000000000..dd62ee3c17dcc --- /dev/null +++ b/scripts/schemas/soc-schema.yml @@ -0,0 +1,72 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2023, Nordic Semiconductor ASA + +## A pykwalify schema for basic validation of the structure of a SoC +## metadata YAML file. +## +# The soc.yml file is a simple list of key value pairs containing SoCs +# located and the current structure level. +schema;cpucluster-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + +schema;soc-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + cpuclusters: + include: cpucluster-schema + +schema;series-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + socs: + required: false + include: soc-schema + +type: map +mapping: + family: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + series: + include: series-schema + socs: + include: soc-schema + series: + include: series-schema + socs: + include: soc-schema + vendor: + required: false + type: str + desc: SoC series of the SoC. + This field is of informational use and can be used for filtering of SoCs. + comment: + required: false + type: str + desc: Free form comment with extra information regarding the SoC. diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 39238756f6121..35eb4685eed72 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -49,6 +49,7 @@ def do_add_parser(self, parser_adder): The following arguments are available: - name: board name + - identifiers: board identifiers - arch: board architecture - dir: directory that contains the board definition ''')) @@ -72,6 +73,7 @@ def do_run(self, args, _): name_re = None args.arch_roots = [ZEPHYR_BASE] + args.soc_roots = [ZEPHYR_BASE] modules_board_roots = [ZEPHYR_BASE] for module in zephyr_module.parse_modules(ZEPHYR_BASE, self.manifest): @@ -85,4 +87,10 @@ def do_run(self, args, _): if name_re is not None and not name_re.search(board.name): continue log.inf(args.format.format(name=board.name, arch=board.arch, - dir=board.dir)) + dir=board.dir, hwm=board.hwm, identifiers='')) + + for board in list_boards.find_v2_boards(args): + if name_re is not None and not name_re.search(board.name): + continue + log.inf(args.format.format(name=board.name, dir=board.dir, hwm=board.hwm, + identifiers=list_boards.board_v2_identifiers(board))) diff --git a/scripts/west_commands/completion/west-completion.bash b/scripts/west_commands/completion/west-completion.bash index ca3f5669d05bc..c5d61a8f4490b 100644 --- a/scripts/west_commands/completion/west-completion.bash +++ b/scripts/west_commands/completion/west-completion.bash @@ -660,6 +660,7 @@ __comp_west_boards() local dir_opts=" --arch-root --board-root + --soc-root " all_opts="$dir_opts $other_opts" diff --git a/scripts/west_commands/completion/west-completion.fish b/scripts/west_commands/completion/west-completion.fish index 92dbc65c800df..de45234856756 100644 --- a/scripts/west_commands/completion/west-completion.fish +++ b/scripts/west_commands/completion/west-completion.fish @@ -292,6 +292,7 @@ complete -c west -n "__zephyr_west_seen_subcommand_from boards" -o f -l format - complete -c west -n "__zephyr_west_seen_subcommand_from boards" -o n -l name -d "name regex" complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l arch-root -xa "(__zephyr_west_complete_directories)" -d "add an arch root" complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l board-root -xa "(__zephyr_west_complete_directories)" -d "add a board root" +complete -c west -n "__zephyr_west_seen_subcommand_from boards" -l soc-root -xa "(__zephyr_west_complete_directories)" -d "add a soc root" # build complete -c west -n "__zephyr_west_use_subcommand; and __zephyr_west_check_if_in_workspace" -ra build -d "compile a Zephyr application" diff --git a/scripts/west_commands/completion/west-completion.zsh b/scripts/west_commands/completion/west-completion.zsh index b3a881288c086..35bae6f43c92f 100644 --- a/scripts/west_commands/completion/west-completion.zsh +++ b/scripts/west_commands/completion/west-completion.zsh @@ -214,6 +214,7 @@ _west_boards() { {-n,--name}'[name regex]:regex:' '*--arch-root[Add an arch root]:arch root:_directories' '*--board-root[Add a board root]:board root:_directories' + '*--soc-root[Add a soc root]:soc root:_directories' ) _arguments -S $opts diff --git a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake index 980c54ef76653..38dc9446a0374 100644 --- a/share/sysbuild/cmake/modules/sysbuild_extensions.cmake +++ b/share/sysbuild/cmake/modules/sysbuild_extensions.cmake @@ -146,9 +146,9 @@ function(sysbuild_cache) endif() endforeach() if(DEFINED BOARD_REVISION) - list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}@${BOARD_REVISION}\n") + list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}@${BOARD_REVISION}${BOARD_IDENTIFIER}\n") else() - list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}\n") + list(APPEND sysbuild_cache_strings "BOARD:STRING=${BOARD}${BOARD_IDENTIFIER}\n") endif() list(APPEND sysbuild_cache_strings "SYSBUILD_NAME:STRING=${SB_CACHE_APPLICATION}\n") diff --git a/soc/CMakeLists.txt b/soc/CMakeLists.txt index 6706168281eb0..353179fbea519 100644 --- a/soc/CMakeLists.txt +++ b/soc/CMakeLists.txt @@ -9,8 +9,38 @@ if(_SOC_IS_IN_TREE) endif() unset(_SOC_IS_IN_TREE) -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}) +if(HWMv1) + 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() + + # 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() diff --git a/soc/Kconfig b/soc/Kconfig index 33c2d0c29a435..78e3f03411510 100644 --- a/soc/Kconfig +++ b/soc/Kconfig @@ -1,21 +1,19 @@ # SPDX-License-Identifier: Apache-2.0 -choice - prompt "SoC/CPU/Configuration Selection" +# 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" -# This loads custom SoC root Kconfig (only available if custom SoC root are defined) -osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc" -# This loads Zephyr base SoC root Kconfig -osource "soc/$(ARCH)/*/Kconfig.soc" +menu "Hardware Configuration" -endchoice +rsource "Kconfig.$(HWM_SCHEME)" -menu "Hardware Configuration" -# This loads custom SoC root Kconfig (only available if custom SoC root are defined) -osource "$(KCONFIG_BINARY_DIR)/Kconfig.soc.arch" -# This loads Zephyr base SoC Kconfigs +# This loads Zephyr base SoC Kconfigs for both hw model v1 and v2 osource "soc/$(ARCH)/Kconfig" -osource "soc/$(ARCH)/*/Kconfig" + +# Source Zephyr Kconfig specifics from SoC roots. +osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig" module = SOC module-str = SOC @@ -44,10 +42,6 @@ config SOC_COMPATIBLE_NRF5340_CPUNET config SOC_COMPATIBLE_NRF5340_CPUAPP bool -# -# SOC_*_LD: SoC specific Linker script additions -# - config SOC_DEPRECATED_RELEASE string help diff --git a/soc/Kconfig.v1 b/soc/Kconfig.v1 new file mode 100644 index 0000000000000..55a65e3ea4151 --- /dev/null +++ b/soc/Kconfig.v1 @@ -0,0 +1,27 @@ +# 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" +# This loads Zephyr base SoC Kconfigs +osource "soc/$(ARCH)/*/Kconfig" diff --git a/soc/Kconfig.v1.choice b/soc/Kconfig.v1.choice new file mode 100644 index 0000000000000..a6768f264d963 --- /dev/null +++ b/soc/Kconfig.v1.choice @@ -0,0 +1,13 @@ +# 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" +# This loads Zephyr base SoC scheme v1 root Kconfig +osource "soc/$(ARCH)/*/Kconfig.soc" + +endchoice diff --git a/soc/Kconfig.v2 b/soc/Kconfig.v2 new file mode 100644 index 0000000000000..3faceee06d525 --- /dev/null +++ b/soc/Kconfig.v2 @@ -0,0 +1,32 @@ +# Copyright (c) 2022 Nordic Semiconductor ASA + +# SPDX-License-Identifier: Apache-2.0 + +# Load all SoCs. +# SoCs that has transitioned to SoC scheme v2 are promptless, and thus +# unselectable by the user or through configuration files. +# +# SoC that are still using scheme v1 are still having a prompt but is loaded as +# they offer board maintainers the possibility to use board scheme v2. + +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. + +# Source all Kconfig HWMv2 from SoC roots. +source "$(KCONFIG_BINARY_DIR)/soc/Kconfig.soc" diff --git a/soc/arm/arm/mps3/Kconfig.series b/soc/arm/arm/mps3/Kconfig.series deleted file mode 100644 index 2b73ade4a69f2..0000000000000 --- a/soc/arm/arm/mps3/Kconfig.series +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2021 Linaro Limited -# SPDX-License-Identifier: Apache-2.0 - -config SOC_SERIES_MPS3 - bool "Arm MPS3 MCU Series" - select ARM - select SOC_FAMILY_ARM - select GPIO_MMIO32 if GPIO - help - Enable support for ARM MPS3 MCU Series diff --git a/soc/arm/renesas_rzt2m/CMakeLists.txt b/soc/arm/renesas_rzt2m/CMakeLists.txt deleted file mode 100644 index 05fd66ec83cd4..0000000000000 --- a/soc/arm/renesas_rzt2m/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -# Copyright (c) 2023 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -zephyr_sources( - soc.c - ) diff --git a/soc/arm/renesas_rzt2m/Kconfig.soc b/soc/arm/renesas_rzt2m/Kconfig.soc deleted file mode 100644 index 0275833b7925e..0000000000000 --- a/soc/arm/renesas_rzt2m/Kconfig.soc +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2023 Antmicro -# SPDX-License-Identifier: Apache-2.0 - -config SOC_RENESAS_RZT2M - bool "Renesas RZ/T2M MCU" - select ARM - select CPU_CORTEX_R52 - select CPU_HAS_ARM_MPU - select GIC_V3 - select GIC_SINGLE_SECURITY_STATE - select ARM_ARCH_TIMER - select SYSCON diff --git a/soc/arm/arm/mps3/CMakeLists.txt b/soc/v2/arm/mps3/CMakeLists.txt similarity index 87% rename from soc/arm/arm/mps3/CMakeLists.txt rename to soc/v2/arm/mps3/CMakeLists.txt index d82e1bc62c5dc..3cf33caa58dba 100644 --- a/soc/arm/arm/mps3/CMakeLists.txt +++ b/soc/v2/arm/mps3/CMakeLists.txt @@ -5,4 +5,6 @@ zephyr_sources( soc.c ) +zephyr_include_directories(.) + set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_m/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/arm/mps3/Kconfig.soc b/soc/v2/arm/mps3/Kconfig similarity index 74% rename from soc/arm/arm/mps3/Kconfig.soc rename to soc/v2/arm/mps3/Kconfig index ae577fa549b1b..9c9f9c8413add 100644 --- a/soc/arm/arm/mps3/Kconfig.soc +++ b/soc/v2/arm/mps3/Kconfig @@ -1,12 +1,12 @@ # Copyright (c) 2017-2021 Linaro Limited # SPDX-License-Identifier: Apache-2.0 -choice - prompt "Arm MPS3 SoCs" - depends on SOC_SERIES_MPS3 +config SOC_SERIES_MPS3 + select ARM + select SOC_FAMILY_ARM + select GPIO_MMIO32 if GPIO config SOC_MPS3_AN547 - bool "Arm Cortex-M55 SSE-300 on MPS3 (AN547)" select CPU_CORTEX_M55 select CPU_HAS_ARM_SAU select CPU_HAS_ARM_MPU @@ -16,8 +16,6 @@ config SOC_MPS3_AN547 select ARMV8_1_M_MVEF select ARMV8_1_M_PMU -endchoice - config ARMV8_1_M_PMU_EVENTCNT int default 8 if SOC_MPS3_AN547 diff --git a/soc/arm/arm/mps3/Kconfig.defconfig.series b/soc/v2/arm/mps3/Kconfig.defconfig similarity index 67% rename from soc/arm/arm/mps3/Kconfig.defconfig.series rename to soc/v2/arm/mps3/Kconfig.defconfig index 6cd2516838010..449b87d33a179 100644 --- a/soc/arm/arm/mps3/Kconfig.defconfig.series +++ b/soc/v2/arm/mps3/Kconfig.defconfig @@ -3,12 +3,9 @@ if SOC_SERIES_MPS3 -config SOC_SERIES - default "mps3" - config SYS_CLOCK_HW_CYCLES_PER_SEC default 25000000 -source "soc/arm/arm/mps3/Kconfig.defconfig.mps3*" +rsource "Kconfig.defconfig.mps3*" endif # SOC_SERIES_MPS3 diff --git a/soc/arm/arm/mps3/Kconfig.defconfig.mps3_an547 b/soc/v2/arm/mps3/Kconfig.defconfig.mps3_an547 similarity index 79% rename from soc/arm/arm/mps3/Kconfig.defconfig.mps3_an547 rename to soc/v2/arm/mps3/Kconfig.defconfig.mps3_an547 index 870bbb46c0b02..0961808eae213 100644 --- a/soc/arm/arm/mps3/Kconfig.defconfig.mps3_an547 +++ b/soc/v2/arm/mps3/Kconfig.defconfig.mps3_an547 @@ -3,9 +3,6 @@ if SOC_MPS3_AN547 -config SOC - default "mps3_an547" - config NUM_IRQS default 128 diff --git a/soc/v2/arm/mps3/Kconfig.soc b/soc/v2/arm/mps3/Kconfig.soc new file mode 100644 index 0000000000000..81dde1fd2da30 --- /dev/null +++ b/soc/v2/arm/mps3/Kconfig.soc @@ -0,0 +1,17 @@ +# Copyright (c) 2017-2021 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +config SOC_SERIES_MPS3 + bool + help + Enable support for ARM MPS3 MCU Series + +config SOC_SERIES + default "mps3" if SOC_SERIES_MPS3 + +config SOC_MPS3_AN547 + bool + select SOC_SERIES_MPS3 + +config SOC + default "mps3_an547" if SOC_MPS3_AN547 diff --git a/soc/arm/arm/mps3/soc.c b/soc/v2/arm/mps3/soc.c similarity index 100% rename from soc/arm/arm/mps3/soc.c rename to soc/v2/arm/mps3/soc.c diff --git a/soc/arm/arm/mps3/soc.h b/soc/v2/arm/mps3/soc.h similarity index 100% rename from soc/arm/arm/mps3/soc.h rename to soc/v2/arm/mps3/soc.h diff --git a/soc/v2/arm/mps3/soc.yml b/soc/v2/arm/mps3/soc.yml new file mode 100644 index 0000000000000..19a295a7884d2 --- /dev/null +++ b/soc/v2/arm/mps3/soc.yml @@ -0,0 +1,4 @@ +series: +- name: mps3 + socs: + - name: an547 diff --git a/soc/v2/renesas_rzt2m/CMakeLists.txt b/soc/v2/renesas_rzt2m/CMakeLists.txt new file mode 100644 index 0000000000000..2b318b5e98f2b --- /dev/null +++ b/soc/v2/renesas_rzt2m/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2023 Antmicro +# SPDX-License-Identifier: Apache-2.0 + +zephyr_sources( + soc.c + ) + +zephyr_include_directories(.) + +set(SOC_LINKER_SCRIPT ${ZEPHYR_BASE}/include/zephyr/arch/arm/cortex_r/scripts/linker.ld CACHE INTERNAL "") diff --git a/soc/arm/renesas_rzt2m/Kconfig b/soc/v2/renesas_rzt2m/Kconfig similarity index 64% rename from soc/arm/renesas_rzt2m/Kconfig rename to soc/v2/renesas_rzt2m/Kconfig index fc2f6e81c4eca..ff7dba57b0b9f 100644 --- a/soc/arm/renesas_rzt2m/Kconfig +++ b/soc/v2/renesas_rzt2m/Kconfig @@ -2,7 +2,13 @@ # SPDX-License-Identifier: Apache-2.0 config SOC_RENESAS_RZT2M - bool + select ARM + select CPU_CORTEX_R52 + select CPU_HAS_ARM_MPU + select GIC_V3 + select GIC_SINGLE_SECURITY_STATE + select ARM_ARCH_TIMER + select SYSCON if SOC_RENESAS_RZT2M diff --git a/soc/arm/renesas_rzt2m/Kconfig.defconfig b/soc/v2/renesas_rzt2m/Kconfig.defconfig similarity index 89% rename from soc/arm/renesas_rzt2m/Kconfig.defconfig rename to soc/v2/renesas_rzt2m/Kconfig.defconfig index 72f828d435117..7eedc53ffc64d 100644 --- a/soc/arm/renesas_rzt2m/Kconfig.defconfig +++ b/soc/v2/renesas_rzt2m/Kconfig.defconfig @@ -3,9 +3,6 @@ if SOC_RENESAS_RZT2M -config SOC - default "renesas_rzt2m" - config NUM_IRQS default 994 diff --git a/boards/arm/rzt2m_starterkit/Kconfig.board b/soc/v2/renesas_rzt2m/Kconfig.soc similarity index 63% rename from boards/arm/rzt2m_starterkit/Kconfig.board rename to soc/v2/renesas_rzt2m/Kconfig.soc index 9fddcf006a4f1..93d5d7f99c4f1 100644 --- a/boards/arm/rzt2m_starterkit/Kconfig.board +++ b/soc/v2/renesas_rzt2m/Kconfig.soc @@ -1,6 +1,9 @@ # Copyright (c) 2023 Antmicro # SPDX-License-Identifier: Apache-2.0 -config BOARD_RZT2M_STARTER_KIT - bool "RZ/T2M Starter Kit Board" +config SOC_RENESAS_RZT2M + bool + +config SOC + default "renesas_rzt2m" depends on SOC_RENESAS_RZT2M diff --git a/soc/arm/renesas_rzt2m/linker.ld b/soc/v2/renesas_rzt2m/linker.ld similarity index 100% rename from soc/arm/renesas_rzt2m/linker.ld rename to soc/v2/renesas_rzt2m/linker.ld diff --git a/soc/arm/renesas_rzt2m/pinctrl_soc.h b/soc/v2/renesas_rzt2m/pinctrl_soc.h similarity index 100% rename from soc/arm/renesas_rzt2m/pinctrl_soc.h rename to soc/v2/renesas_rzt2m/pinctrl_soc.h diff --git a/soc/arm/renesas_rzt2m/soc.c b/soc/v2/renesas_rzt2m/soc.c similarity index 100% rename from soc/arm/renesas_rzt2m/soc.c rename to soc/v2/renesas_rzt2m/soc.c diff --git a/soc/arm/renesas_rzt2m/soc.h b/soc/v2/renesas_rzt2m/soc.h similarity index 100% rename from soc/arm/renesas_rzt2m/soc.h rename to soc/v2/renesas_rzt2m/soc.h diff --git a/soc/v2/renesas_rzt2m/soc.yml b/soc/v2/renesas_rzt2m/soc.yml new file mode 100644 index 0000000000000..35c7cc27f7703 --- /dev/null +++ b/soc/v2/renesas_rzt2m/soc.yml @@ -0,0 +1,2 @@ +socs: + - name: renesas_rzt2m diff --git a/subsys/testsuite/arch/Kconfig.v1 b/subsys/testsuite/arch/Kconfig.v1 new file mode 100644 index 0000000000000..28d4b43df0bbd --- /dev/null +++ b/subsys/testsuite/arch/Kconfig.v1 @@ -0,0 +1,4 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +rsource "unit_testing/Kconfig" diff --git a/tests/arch/arm/arm_no_multithreading/testcase.yaml b/tests/arch/arm/arm_no_multithreading/testcase.yaml index 43ab80279f037..2070867613489 100644 --- a/tests/arch/arm/arm_no_multithreading/testcase.yaml +++ b/tests/arch/arm/arm_no_multithreading/testcase.yaml @@ -10,7 +10,7 @@ tests: - qemu_cortex_m3 - mps2_an385 - mps2_an521 - - mps3_an547 + - mps3/an547 - nrf52840dk_nrf52840 - nrf9160dk_nrf9160 - nrf51dk_nrf51422 diff --git a/tests/arch/arm/arm_thread_swap_tz/testcase.yaml b/tests/arch/arm/arm_thread_swap_tz/testcase.yaml index f8bbbc8dd9375..d12173451b118 100644 --- a/tests/arch/arm/arm_thread_swap_tz/testcase.yaml +++ b/tests/arch/arm/arm_thread_swap_tz/testcase.yaml @@ -9,7 +9,7 @@ tests: arch.arm.swap.tz: # NOTE: this platform disables FPU access in TFM. platform_exclude: - - mps3_an547_ns + - mps3/an547/ns - nucleo_l552ze_q_ns integration_platforms: - mps2_an521_ns @@ -18,7 +18,7 @@ tests: - CONFIG_ARM_NONSECURE_PREEMPTIBLE_SECURE_CALLS=n # NOTE: this platform disables FPU access in TFM. platform_exclude: - - mps3_an547_ns + - mps3/an547/ns - nucleo_l552ze_q_ns integration_platforms: - mps2_an521_ns diff --git a/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml b/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml index c252711132266..1082fab75a1b8 100644 --- a/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml +++ b/tests/benchmarks/cmsis_dsp/basicmath/testcase.yaml @@ -17,7 +17,7 @@ tests: filter: CONFIG_CPU_HAS_FPU integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - fpu extra_configs: diff --git a/tests/lib/cmsis_dsp/bayes/testcase.yaml b/tests/lib/cmsis_dsp/bayes/testcase.yaml index 121a878553260..973524a21691e 100644 --- a/tests/lib/cmsis_dsp/bayes/testcase.yaml +++ b/tests/lib/cmsis_dsp/bayes/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/complexmath/testcase.yaml b/tests/lib/cmsis_dsp/complexmath/testcase.yaml index 9a2c847e400b0..391e3224c3ab2 100644 --- a/tests/lib/cmsis_dsp/complexmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/complexmath/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/distance/testcase.yaml b/tests/lib/cmsis_dsp/distance/testcase.yaml index 2e00016efb3b3..d00dc5b3e76f8 100644 --- a/tests/lib/cmsis_dsp/distance/testcase.yaml +++ b/tests/lib/cmsis_dsp/distance/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/fastmath/testcase.yaml b/tests/lib/cmsis_dsp/fastmath/testcase.yaml index ded000fe7526d..ee58a10654352 100644 --- a/tests/lib/cmsis_dsp/fastmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/fastmath/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/filtering/testcase.yaml b/tests/lib/cmsis_dsp/filtering/testcase.yaml index 84662306db516..8af0b448b3938 100644 --- a/tests/lib/cmsis_dsp/filtering/testcase.yaml +++ b/tests/lib/cmsis_dsp/filtering/testcase.yaml @@ -26,7 +26,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -55,7 +55,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -84,7 +84,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -114,7 +114,7 @@ tests: integration_platforms: - mps2_an521_remote platform_exclude: - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/interpolation/testcase.yaml b/tests/lib/cmsis_dsp/interpolation/testcase.yaml index 06973fa215893..b61ae8d180410 100644 --- a/tests/lib/cmsis_dsp/interpolation/testcase.yaml +++ b/tests/lib/cmsis_dsp/interpolation/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/matrix/testcase.yaml b/tests/lib/cmsis_dsp/matrix/testcase.yaml index 04411e4c02fbf..011e4ebeb2e78 100644 --- a/tests/lib/cmsis_dsp/matrix/testcase.yaml +++ b/tests/lib/cmsis_dsp/matrix/testcase.yaml @@ -23,7 +23,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -52,7 +52,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -81,7 +81,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -109,7 +109,7 @@ tests: and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -138,7 +138,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -167,7 +167,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -197,7 +197,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -228,7 +228,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -259,7 +259,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -288,7 +288,7 @@ tests: and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -318,7 +318,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -349,7 +349,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml b/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml index 07e747f388faa..be5e38ec33529 100644 --- a/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml +++ b/tests/lib/cmsis_dsp/quaternionmath/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/statistics/testcase.yaml b/tests/lib/cmsis_dsp/statistics/testcase.yaml index 473f030d505b1..bda9f02469bb2 100644 --- a/tests/lib/cmsis_dsp/statistics/testcase.yaml +++ b/tests/lib/cmsis_dsp/statistics/testcase.yaml @@ -16,7 +16,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/support/testcase.yaml b/tests/lib/cmsis_dsp/support/testcase.yaml index 26ef2893ab1c3..051b0e2681c87 100644 --- a/tests/lib/cmsis_dsp/support/testcase.yaml +++ b/tests/lib/cmsis_dsp/support/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/svm/testcase.yaml b/tests/lib/cmsis_dsp/svm/testcase.yaml index d0d59f7b70b77..a22eb2196468d 100644 --- a/tests/lib/cmsis_dsp/svm/testcase.yaml +++ b/tests/lib/cmsis_dsp/svm/testcase.yaml @@ -15,7 +15,7 @@ tests: and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/lib/cmsis_dsp/transform/testcase.yaml b/tests/lib/cmsis_dsp/transform/testcase.yaml index 2d93d48d09bb0..07fd58a774997 100644 --- a/tests/lib/cmsis_dsp/transform/testcase.yaml +++ b/tests/lib/cmsis_dsp/transform/testcase.yaml @@ -22,7 +22,7 @@ tests: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -50,7 +50,7 @@ tests: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -129,7 +129,7 @@ tests: filter: (CMSIS_DSP_FLOAT16 and (CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -156,7 +156,7 @@ tests: filter: (CMSIS_DSP_FLOAT16 and (CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) integration_platforms: - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu @@ -210,7 +210,7 @@ tests: filter: ((CONFIG_CPU_AARCH32_CORTEX_R or CONFIG_CPU_CORTEX_M) and CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - - mps3_an547 + - mps3/an547 tags: - cmsis_dsp - fpu diff --git a/tests/subsys/dsp/basicmath/testcase.yaml b/tests/subsys/dsp/basicmath/testcase.yaml index cb8dd1a27655b..1fa87bb6797cf 100644 --- a/tests/subsys/dsp/basicmath/testcase.yaml +++ b/tests/subsys/dsp/basicmath/testcase.yaml @@ -13,7 +13,7 @@ tests: filter: (CONFIG_CPU_HAS_FPU and CONFIG_FULL_LIBC_SUPPORTED) or CONFIG_ARCH_POSIX integration_platforms: - mps2_an521_remote - - mps3_an547 + - mps3/an547 tags: - zdsp - fpu