modules: CMSIS_6: Switch to CMSIS_6 for Cortex-M

What is the change?
Switch to module CMSIS_6 for Cortex-M while continuing to use
cmsis module (version 5.9.0) for Cortex-A/R.

Why do we need this change?

The current cmsis module consists of:
- Cortex-M support from upstream cmsis 5.9.0
- Cortex-A/R support which was not upstreamed to CMSIS

Upstream cmsis 5.9 was deprecated so we should be using CMSIS_6 however,
it seems due to lack of Cortex-A/R support in upstream and other reasons,
this was pushed back.

While upstreaming Cortex-A/R support to CMSIS_6 could take its time,
this shouldn't stop Cortex-M to start using CMSIS_6.

Also, if we do not use CMSIS_6 for Cortex-M then using the
newer GCC 14.2 toolchain will return below compiler error:
```
zephyrproject/modules/hal/cmsis/CMSIS/Core/Include/core_cm85.h:4406:10:
fatal error: pac_armv81.h: No such file or directory
 4406 | #include "pac_armv81.h"
```
Using CMSIS_6 for Cortex-M will fix this.

Signed-off-by: Sudan Landge <sudan.landge@arm.com>
This commit is contained in:
Sudan Landge 2025-04-29 15:05:15 +01:00 committed by Benjamin Cabé
commit f726cb5123
8 changed files with 61 additions and 28 deletions

View file

@ -3,6 +3,6 @@
add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR} cmsis)
if(CONFIG_CPU_CORTEX_M OR CONFIG_CPU_AARCH32_CORTEX_A OR CONFIG_CPU_AARCH32_CORTEX_R)
if(CONFIG_CPU_AARCH32_CORTEX_A OR CONFIG_CPU_AARCH32_CORTEX_R)
zephyr_include_directories(.)
endif()

View file

@ -8,7 +8,6 @@ config HAS_CMSIS_CORE
bool
select HAS_CMSIS_CORE_A if CPU_AARCH32_CORTEX_A
select HAS_CMSIS_CORE_R if CPU_AARCH32_CORTEX_R
select HAS_CMSIS_CORE_M if CPU_CORTEX_M
if HAS_CMSIS_CORE
@ -18,19 +17,4 @@ config HAS_CMSIS_CORE_A
config HAS_CMSIS_CORE_R
bool
config HAS_CMSIS_CORE_M
bool
config CMSIS_M_CHECK_DEVICE_DEFINES
bool "Check device defines"
default n
depends on HAS_CMSIS_CORE_M
help
This options enables the validation of CMSIS configuration flags.
config CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK
bool
help
Enable this option if CMSIS SystemCoreClock symbols is available.
endif

View file

@ -6,9 +6,7 @@
#ifndef ZEPHYR_MODULES_CMSIS_CMSIS_H_
#define ZEPHYR_MODULES_CMSIS_CMSIS_H_
#if defined(CONFIG_CPU_CORTEX_M)
#include "cmsis_core_m.h"
#elif defined(CONFIG_CPU_AARCH32_CORTEX_A) || defined(CONFIG_CPU_AARCH32_CORTEX_R)
#if defined(CONFIG_CPU_AARCH32_CORTEX_A) || defined(CONFIG_CPU_AARCH32_CORTEX_R)
#include "cmsis_core_a_r.h"
#endif

View file

@ -0,0 +1,9 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
# Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(${ZEPHYR_CURRENT_MODULE_DIR} cmsis_6)
if(CONFIG_CPU_CORTEX_M)
zephyr_include_directories(.)
endif()

28
modules/cmsis_6/Kconfig Normal file
View file

@ -0,0 +1,28 @@
# Copyright (c) 2016 Intel Corporation
# Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
# SPDX-License-Identifier: Apache-2.0
config ZEPHYR_CMSIS_6_MODULE
bool
config HAS_CMSIS_CORE
bool
select HAS_CMSIS_CORE_M if CPU_CORTEX_M
if HAS_CMSIS_CORE
config HAS_CMSIS_CORE_M
bool
config CMSIS_M_CHECK_DEVICE_DEFINES
bool "Check device defines"
depends on HAS_CMSIS_CORE_M
help
This options enables the validation of CMSIS configuration flags.
config CMSIS_CORE_HAS_SYSTEM_CORE_CLOCK
bool
help
Enable this option if CMSIS SystemCoreClock symbols is available.
endif

View file

@ -0,0 +1,14 @@
/*
* Copyright (c) 2023 Nordic Semiconductor ASA
* Copyright 2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_H_
#define ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_H_
#if defined(CONFIG_CPU_CORTEX_M)
#include "cmsis_core_m.h"
#endif
#endif /* ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_H_ */

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2017 Nordic Semiconductor ASA
* Copyright (c) 2023 Arm Limited
* Copyright 2023,2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -12,8 +12,8 @@
* This header contains the interface to the ARM CMSIS Core headers.
*/
#ifndef ZEPHYR_MODULES_CMSIS_CMSIS_M_H_
#define ZEPHYR_MODULES_CMSIS_CMSIS_M_H_
#ifndef ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_M_H_
#define ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_M_H_
#if defined(CONFIG_CMSIS_M_CHECK_DEVICE_DEFINES) && CONFIG_CMSIS_M_CHECK_DEVICE_DEFINES == 1U
#define __CHECK_DEVICE_DEFINES 1U
@ -68,4 +68,4 @@
#error "__SAUREGION_PRESENT and CONFIG_CPU_HAS_ARM_SAU are not set to the same value"
#endif
#endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_H_ */
#endif /* ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_M_H_ */

View file

@ -1,6 +1,6 @@
/*
* Copyright (c) 2017 Nordic Semiconductor ASA
* Copyright (c) 2023 Arm Limited
* Copyright 2023,2025 Arm Limited and/or its affiliates <open-source-office@arm.com>
*
* SPDX-License-Identifier: Apache-2.0
*/
@ -13,8 +13,8 @@
* ARM CMSIS Core headers.
*/
#ifndef ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_
#define ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_
#ifndef ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_M_DEFAULTS_H_
#define ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_M_DEFAULTS_H_
#include <zephyr/arch/arm/cortex_m/nvic.h>
@ -143,4 +143,4 @@ typedef enum {
#error "Unknown Cortex-M device"
#endif
#endif /* ZEPHYR_MODULES_CMSIS_CMSIS_M_DEFAULTS_H_ */
#endif /* ZEPHYR_MODULES_CMSIS_6_CMSIS_CORE_M_DEFAULTS_H_ */