Skip to content

modules: CMSIS_6: fix path and use it for TF-M and Cortex-M #89370

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 14, 2025

Conversation

wearyzen
Copy link
Collaborator

@wearyzen wearyzen commented May 1, 2025

What is the change?

Switch to using CMSIS_6 module for TF-M and Cortex-M while continue to use CMSIS for Cortex-A/R.

Why do we need this change?

Pls refer to the commit messages for more details.

Signed-off-by: Sudan Landge sudan.landge@arm.com

Copy link

github-actions bot commented May 1, 2025

The following west manifest projects have changed revision in this Pull Request:

Name Old Revision New Revision Diff
cmsis_6 zephyrproject-rtos/CMSIS_6@783317a zephyrproject-rtos/CMSIS_6@6dd5043 (main) zephyrproject-rtos/CMSIS_6@783317a3..6dd50439
trusted-firmware-m zephyrproject-rtos/trusted-firmware-m@e2288c1 zephyrproject-rtos/trusted-firmware-m@6473899 (main) zephyrproject-rtos/trusted-firmware-m@e2288c13..64738996

Additional metadata changed:

Name URL Submodules West cmds module.yml
cmsis_6

DNM label due to: 1 project with metadata changes

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@github-actions github-actions bot added manifest manifest-cmsis_6 DNM (manifest) This PR should not be merged (controlled by action-manifest) labels May 1, 2025
@RobinKastberg
Copy link
Contributor

Ah. Good idea just enabling it for M only.

@github-actions github-actions bot added the platform: nRF BSIM Nordic Semiconductors, nRF BabbleSim label May 2, 2025
@github-actions github-actions bot requested a review from aescolar May 2, 2025 01:29
@wearyzen wearyzen force-pushed the cmsis_6_update branch 5 times, most recently from 7f6707d to 320db7b Compare May 2, 2025 17:03
@wearyzen
Copy link
Collaborator Author

wearyzen commented May 2, 2025

The twister failures are observed on main branch as well so they are not related to this PR.

@tomi-font
Copy link
Collaborator

Thanks for this. Could you also put up a PR in the TF-M fork that removes the copy of the CMSIS 6 files (just reverting the commit)?

Copy link

sonarqubecloud bot commented May 9, 2025

@tomi-font tomi-font removed the DNM (manifest) This PR should not be merged (controlled by action-manifest) label May 12, 2025
@wearyzen
Copy link
Collaborator Author

Hi @stephanosio , could you please have a look at this PR and help with approval/merge?

@tomi-font
Copy link
Collaborator

Replacing the assignee @stephanosio as he hasn't been active, the last GitHub activity is from two weeks ago, and this PR is now blocking other TF-M PRs.

@tomi-font tomi-font assigned wearyzen and unassigned stephanosio May 14, 2025
@tomi-font tomi-font requested a review from aescolar May 14, 2025 06:45
Copy link
Member

@aescolar aescolar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this change warrant a line in the release notes?
(CC @kartben @danieldegrasse @dkalowsk)
(I'm ok with that coming as a follow up PR)

@@ -0,0 +1,9 @@
# Copyright (c) 2023 Nordic Semiconductor ASA
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:
This file content is below the trivial threshold, you would not need to keep somebody else's copyright if you copy and modify it.
You can also just add a Copyright The Zephyr Project Contributors notice instead of adding a new line for ARM (if the file has more copyright and license lines than code it is probably overkill :))
Same applies to modules/cmsis_6/cmsis_core.h

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll push a follow up PR removing the original copyright and a note in the release note.

@kartben kartben merged commit f726cb5 into zephyrproject-rtos:main May 14, 2025
29 of 30 checks passed
@fabiobaltieri
Copy link
Member

Doesn't this change warrant a line in the release notes?

Hey, this breaks any downstream project that has hal module filtering enabled does not have cmsis listed and is using ARM.

Going to break the example app too:
https://github.com/zephyrproject-rtos/example-application/actions/runs/15025085627/job/42223734547?pr=84

 /home/runner/work/example-application/example-application/zephyr/include/zephyr/arch/arm/asm_inline_gcc.h:24:10: fatal error: cmsis_core.h: No such file or directory
   24 | #include <cmsis_core.h>
      |          ^~~~~~~~~~~~~~

it really needs this to be mentioned in the release notes, something about the requirement of using the cmsis_6 module instead of cmsis if Cortex-M is used.

Opened zephyrproject-rtos/example-application#84 for the example application.

@fabiobaltieri
Copy link
Member

Or is it meant to need both cmsis and cmsis_6? bumped into an stm32 project that fails with

In file included from /home/fabiobaltieri/zephyrproject/zephyr/arch/arm/core/cortex_m/timing.c:17:
/home/fabiobaltieri/zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h: In function 'dwt_access':
/home/fabiobaltieri/zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h:37:29: error: 'ITM_LSR_Present_Msk' undeclared (first use in this function); did you mean 'ITM_LSR_PRESENT_Msk'?
   37 | #define DWT_LSR_Present_Msk ITM_LSR_Present_Msk
      |                             ^~~~~~~~~~~~~~~~~~~

if it only has cmsis_6

@wearyzen
Copy link
Collaborator Author

wearyzen commented May 14, 2025

Or is it meant to need both cmsis and cmsis_6? bumped into an stm32 project that fails with

In file included from /home/fabiobaltieri/zephyrproject/zephyr/arch/arm/core/cortex_m/timing.c:17:
/home/fabiobaltieri/zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h: In function 'dwt_access':
/home/fabiobaltieri/zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h:37:29: error: 'ITM_LSR_Present_Msk' undeclared (first use in this function); did you mean 'ITM_LSR_PRESENT_Msk'?
   37 | #define DWT_LSR_Present_Msk ITM_LSR_Present_Msk
      |                             ^~~~~~~~~~~~~~~~~~~

if it only has cmsis_6

@fabiobaltieri, the combination is expected atm because some of the hal's like stm32 might be using the older cmsis and we'll have to wait for them to upgrade. This wasn't possible before because there was no CMSIS_6 module for them to update to but now they should be able to do so.
Also, I wasn't aware about the example-application repo so missed it before but please do let me know if there is anything else that breaks in ci because of this.

BTW, could you please share the command you tried for the above error? This looks like something that can be easily fixed with the right path.

@wearyzen
Copy link
Collaborator Author

wearyzen commented May 14, 2025

Or is it meant to need both cmsis and cmsis_6? bumped into an stm32 project that fails with

In file included from /home/fabiobaltieri/zephyrproject/zephyr/arch/arm/core/cortex_m/timing.c:17:
/home/fabiobaltieri/zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h: In function 'dwt_access':
/home/fabiobaltieri/zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h:37:29: error: 'ITM_LSR_Present_Msk' undeclared (first use in this function); did you mean 'ITM_LSR_PRESENT_Msk'?
   37 | #define DWT_LSR_Present_Msk ITM_LSR_Present_Msk
      |                             ^~~~~~~~~~~~~~~~~~~

if it only has cmsis_6

@fabiobaltieri, the combination is expected atm because some of the hal's like stm32 might be using the older cmsis and we'll have to wait for them to upgrade. This wasn't possible before because there was no CMSIS_6 module for them to update to but now they should be able to do so. Also, I wasn't aware about the example-application repo so missed it before but please do let me know if there is anything else that breaks in ci because of this.

BTW, could you please share the command you tried for the above error? This looks like something that can be easily fixed with the right path.

Tried to build a few stm32 projects (including nucleo_f429zi/stm32f429xx which includes the file dwt.h) but couldn't see the issue reported, let me know if you find the board used to reproduce this error.

Thanks!

@fabiobaltieri
Copy link
Member

fabiobaltieri commented May 14, 2025

Also, I wasn't aware about the example-application repo so missed it before but please do let me know if there is anything else that breaks in ci because of this.

All good, don't worry about it.

BTW, could you please share the command you tried for the above error? This looks like something that can be easily fixed with the right path.

Ah it was from one of my test projects, had a CI run with minimal modules, let's see you can do:

$ rm -rf ../modules/hal/cmsis
$ west build -p -b nucleo_h745zi_q/stm32h745xx/m7 samples/basic/blinky -DCONFIG_CORTEX_M_DWT=y -DCONFIG_TIMING_FUNCTIONS=y
...
zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h:37:29: error: 'ITM_LSR_Present_Msk' undeclared (first use in this function); did you mean 'ITM_LSR_PRESENT_Msk'?

I think it's enabled from these in the specific project

CONFIG_THREAD_RUNTIME_STATS=y
CONFIG_THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS=y

@wearyzen
Copy link
Collaborator Author

Also, I wasn't aware about the example-application repo so missed it before but please do let me know if there is anything else that breaks in ci because of this.

All good, don't worry about it.

BTW, could you please share the command you tried for the above error? This looks like something that can be easily fixed with the right path.

Ah it was from one of my test projects, had a CI run with minimal modules, let's see you can do:

$ rm -rf ../modules/hal/cmsis
$ west build -p -b nucleo_h745zi_q/stm32h745xx/m7 samples/basic/blinky -DCONFIG_CORTEX_M_DWT=y -DCONFIG_TIMING_FUNCTIONS=y
...
zephyrproject/zephyr/arch/arm/include/cortex_m/dwt.h:37:29: error: 'ITM_LSR_Present_Msk' undeclared (first use in this function); did you mean 'ITM_LSR_PRESENT_Msk'?

I think it's enabled from these in the specific project

CONFIG_THREAD_RUNTIME_STATS=y
CONFIG_THREAD_RUNTIME_STATS_USE_TIMING_FUNCTIONS=y

Thanks, I found the issue and will be posting a fix soon with the release notes update.

wearyzen added a commit to wearyzen/zephyr that referenced this pull request May 16, 2025
As noted in PR zephyrproject-rtos#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 <sudan.landge@arm.com>
@wearyzen wearyzen mentioned this pull request May 16, 2025
wearyzen added a commit to wearyzen/zephyr that referenced this pull request May 16, 2025
As noted in PR zephyrproject-rtos#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 <sudan.landge@arm.com>
yashi added a commit to yashi/libcsp-zephyr that referenced this pull request May 18, 2025
Zephyr has migrated to CMSIS v6. While the plan was to transition all
ARM architectures, issues with Cortex-A and Cortex-R prevented full
adoption. As a result, only Cortex-M was updated to v6 in
zephyrproject-rtos/zephyr#89370.

Since the SC-OBC module A1 uses a Cortex-M3, we need to adopt CMSIS
v6.

That PR was merged after Zephyr v4.1.0, so older versions may still
require the legacy CMSIS module. To maintain compatibility, we are
keeping the old module alongside v6.
yashi added a commit to yashi/libcsp-zephyr that referenced this pull request May 18, 2025
Zephyr has migrated to CMSIS v6. While the plan was to transition all
ARM architectures, issues with Cortex-A and Cortex-R prevented full
adoption. As a result, only Cortex-M was updated to v6 in
zephyrproject-rtos/zephyr#89370.

Since the SC-OBC module A1 uses a Cortex-M3, we need to adopt CMSIS
v6.

That PR was merged after Zephyr v4.1.0, so older versions may still
require the legacy CMSIS module. To maintain compatibility, we are
keeping the old module alongside v6.

Signed-off-by: Yasushi SHOJI <yashi@spacecubics.com>
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants