From 12834d263da8e9a088ab7f9999ac367ed76757b2 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Wed, 14 May 2025 22:25:54 +0100 Subject: [PATCH 1/3] doc: Update on switch to CMSIS_6 Add a note to announce the switch to CMSIS_6 for Cortex-M arch. Signed-off-by: Sudan Landge --- doc/hardware/arch/arm_cortex_m.rst | 12 ++++++++++-- doc/releases/migration-guide-4.2.rst | 14 ++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/doc/hardware/arch/arm_cortex_m.rst b/doc/hardware/arch/arm_cortex_m.rst index 4bfb05d8026ee..52d45e6f035ee 100644 --- a/doc/hardware/arch/arm_cortex_m.rst +++ b/doc/hardware/arch/arm_cortex_m.rst @@ -632,8 +632,16 @@ script as well. CMSIS ***** -Cortex-M CMSIS headers are hosted in a standalone module repository: -`zephyrproject-rtos/cmsis `_. +Cortex-M CMSIS headers are provided through standalone module repositories: + +- **CMSIS 5**: `zephyrproject-rtos/cmsis `_ +- **CMSIS 6**: `zephyrproject-rtos/CMSIS_6 `_ + +Zephyr has begun transitioning to **CMSIS 6** as the default source for Cortex-M core headers. +However, at present, Zephyr includes headers from **both** the CMSIS 6 and legacy CMSIS 5 modules. + +The legacy CMSIS 5 headers remain available primarily for compatibility with vendor HALs, while all +new architecture-level development should use **CMSIS 6** headers whenever possible. :kconfig:option:`CONFIG_CPU_CORTEX_M` selects :kconfig:option:`CONFIG_HAS_CMSIS_CORE` to signify that CMSIS headers are available for all supported Cortex-M variants. diff --git a/doc/releases/migration-guide-4.2.rst b/doc/releases/migration-guide-4.2.rst index 3cf4475c992e6..720476d0920d5 100644 --- a/doc/releases/migration-guide-4.2.rst +++ b/doc/releases/migration-guide-4.2.rst @@ -524,6 +524,20 @@ ZBus Modules ******* +CMSIS +===== + +* Cortex-M boards/socs now require the ``CMSIS_6`` module to build properly (instead of ``cmsis`` + which was CMSIS 5.9.0). + If trying to build a Cortex-M board, do a ``west update`` to make sure that ``CMSIS_6`` module is + available before running ``west build`` or other commands. + + Boards or SOCs or modules using the older ``cmsis`` module either with a local copy or via the + :kconfig:option:`CONFIG_ZEPHYR_CMSIS_MODULE_DIR` are requested to move to the ``CMSIS_6`` module + which can be accessed via the :kconfig:option:`CONFIG_ZEPHYR_CMSIS_6_MODULE_DIR` configuration. + + Note: Zephyr will continue using the older ``cmsis`` module for Cortex-A and Cortex-R targets. + Architectures ************* From 2ea3fe6f0e86e7648107adcb0ad49b50e1fb6531 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Wed, 14 May 2025 22:39:47 +0100 Subject: [PATCH 2/3] modules: CMSIS_6: update copyright As noted in PR #89370, the content of these files falls below the trivial threshold. Therefore, it is not necessary to retain the original copyright, which was carried over when the files were copied from the `cmsis` module. Signed-off-by: Sudan Landge --- modules/cmsis_6/CMakeLists.txt | 1 - modules/cmsis_6/cmsis_core.h | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/cmsis_6/CMakeLists.txt b/modules/cmsis_6/CMakeLists.txt index 1f501f4534274..0592be9a557c3 100644 --- a/modules/cmsis_6/CMakeLists.txt +++ b/modules/cmsis_6/CMakeLists.txt @@ -1,4 +1,3 @@ -# Copyright (c) 2023 Nordic Semiconductor ASA # Copyright 2025 Arm Limited and/or its affiliates # SPDX-License-Identifier: Apache-2.0 diff --git a/modules/cmsis_6/cmsis_core.h b/modules/cmsis_6/cmsis_core.h index 3d85be7a396fc..f28111a4435ab 100644 --- a/modules/cmsis_6/cmsis_core.h +++ b/modules/cmsis_6/cmsis_core.h @@ -1,5 +1,4 @@ /* - * Copyright (c) 2023 Nordic Semiconductor ASA * Copyright 2025 Arm Limited and/or its affiliates * SPDX-License-Identifier: Apache-2.0 */ From dcc031dfa7dda153c20d34bdd1530f6b0a943f35 Mon Sep 17 00:00:00 2001 From: Sudan Landge Date: Wed, 14 May 2025 22:09:53 +0100 Subject: [PATCH 3/3] arch: arm: update to use CMSIS_6 compatible macros Zephyr switched to using CMSIS_6 module in f726cb51 which breaks certain boards like `nucleo_h745zi_q/stm32h745xx/m7` when CONFIG_CORTEX_M_DWT, CONFIG_TIMING_FUNCTIONS are enabled and cmsis from `module/hal/cmsis` is not available (deleted explicitly after west update). This commit adds a provision to be able to use CMSIS_6 macros when the module cmsis is not available. Signed-off-by: Sudan Landge --- arch/arm/include/cortex_m/dwt.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/cortex_m/dwt.h b/arch/arm/include/cortex_m/dwt.h index 947b35dca92e8..fe946ecb590e6 100644 --- a/arch/arm/include/cortex_m/dwt.h +++ b/arch/arm/include/cortex_m/dwt.h @@ -32,12 +32,18 @@ extern "C" { /* Define DWT LSR masks which are currently not defined by the CMSIS V5.1.2. * (LSR register is defined but not its bitfields). * Reuse ITM LSR mask as it is the same offset than DWT LSR one. + * TODO: update these to use only CMSIS_6 when all of zephyr and modules have + * update to CMSIS_6. */ #if !defined DWT_LSR_Present_Msk -#define DWT_LSR_Present_Msk ITM_LSR_Present_Msk +#define DWT_LSR_Present_Msk \ + IF_ENABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_Present_Msk)) \ + IF_DISABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_PRESENT_Msk)) #endif #if !defined DWT_LSR_Access_Msk -#define DWT_LSR_Access_Msk ITM_LSR_Access_Msk +#define DWT_LSR_Access_Msk \ + IF_ENABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_Access_Msk)) \ + IF_DISABLED(CONFIG_ZEPHYR_CMSIS_MODULE, (ITM_LSR_ACCESS_Msk)) #endif static inline void dwt_access(bool ena)