Skip to content

Run Core tests and CoreValidation with IAR toolchain #229

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

JonatanAntoni
Copy link
Member

No description provided.

@JonatanAntoni JonatanAntoni requested a review from Copilot April 22, 2025 15:51
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for running Core tests with the IAR toolchain by updating several test check patterns and configuration files. Key changes include:

  • Updated CHECK patterns in test source files to distinguish between IAR and non-IAR output.
  • Added a new Toolchain_IAR class and modified configuration settings in lit.cfg.py.
  • Updated build scripts and workflow configurations to support IAR.

Reviewed Changes

Copilot reviewed 9 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
CMSIS/Core/Test/src/simd.c Updated CHECK patterns to separate IAR and non-IAR cases.
CMSIS/Core/Test/src/rrx.c Modified CHECK patterns to include both rrx and rrxs instructions.
CMSIS/Core/Test/src/ror.c Revised CHECK patterns to update regex for THUMB and ARM variants.
CMSIS/Core/Test/src/noreturn.c Adjusted regex checks to support both b and bl branch instructions.
CMSIS/Core/Test/src/cpsr.c Minor regex update to allow optional 's' in the AND operation check.
CMSIS/Core/Test/lit.cfg.py Added Toolchain_IAR class with new configuration settings; updated mfpu.
CMSIS/Core/Test/build.py Removed obsolete IAR matrix filter support.
CMSIS/Core/Include/m-profile/cmsis_iccarm_m.h Simplified preprocessor conditions regarding architecture features.
.github/workflows/core.yml Added IAR token environment variable for CI integration.
Files not reviewed (1)
  • CMSIS/Core/Test/vcpkg-configuration.json: Language not supported
Comments suppressed due to low confidence (2)

CMSIS/Core/Test/lit.cfg.py:891

  • The variable 'device' is used instead of 'self.device' when accessing the DEVICES configuration. Update to 'DEVICES[self.device]["header"]' for consistency.
f'--cpu={self.cpu()}', f'--fpu={self.fpu()}', '-I', os.path.abspath('../Include'), '-c', '-D', f'CORE_HEADER="{DEVICES[device]["header"]}"'

CMSIS/Core/Test/lit.cfg.py:892

  • The variable 'device' is undefined in this context; use 'self.device' to ensure the correct configuration is referenced.
if device.endswith('S') and not device.endswith('NS'):

@JonatanAntoni
Copy link
Member Author

JonatanAntoni commented Apr 22, 2025

@RobinKastberg, I enhanced CI tests with IAR toolchain. Could you please cross check at least the modification to IAR compiler header?

Looks like many test cases do not pass with IAR compiler. Could you have a look as well? We might need to enhance the test expectations as IAR compiler generates another assembly variant.

Copy link

github-actions bot commented Apr 22, 2025

Test Results

   500 files  +  128     500 suites  +128   11m 52s ⏱️ + 3m 24s
    49 tests ±    0      27 ✅  -    17      5 💤 ±    0   17 ❌ + 17 
24 500 runs  +6 272  15 787 ✅ +3 823  8 400 💤 +2 136  313 ❌ +313 

For more details on these failures, see this check.

Results for commit e224a92. ± Comparison against base commit 6f0a58d.

♻️ This comment has been updated with latest results.

@JonatanAntoni JonatanAntoni changed the title Run Core tests with IAR toolchain Run Core tests and CoreValidation with IAR toolchain Apr 23, 2025
@RobinKastberg
Copy link
Contributor

@RobinKastberg, I enhanced CI tests with IAR toolchain. Could you please cross check at least the modification to IAR compiler header?

Great work!

Looks like many test cases do not pass with IAR compiler. Could you have a look as well? We might need to enhance the test expectations as IAR compiler generates another assembly variant.

I will take a look, but I am quite busy with other things currently.
I did go through this locally some time ago finding/fixing some critical bugs in the process. I think the remaining bugs where not major (i.e. mainly related to how the tests are setup). Of course my memory is quite fuzzy now and things might have changed.

@JonatanAntoni
Copy link
Member Author

JonatanAntoni commented Apr 23, 2025

@RobinKastberg, I am now about to run CoreValidation tests. But I am seeing a weird issue on GitHub. Despite having set IAR_LMS_BEARER_TOKEN I am getting errors running IAR Toolchain commands:

> iccarm --version

Fatal error[LMSC4050]: product field missing in checkout request
   IAR ANSI C/C++ Compiler V9.60.4.438/LNX for ARM
   Copyright 1999-2025 IAR Systems AB.
Fatal error detected, aborting.

This is surprising, because in within the Core test job the toolchain has no issues.
Can you help us figuring out what is going wrong?

@RobinKastberg
Copy link
Contributor

@JonatanAntoni where did you get toolchain from? ARM artifactory?

@JonatanAntoni
Copy link
Member Author

JonatanAntoni commented Apr 23, 2025

where did you get toolchain from? ARM artifactory?

Yes, its installed to the build machine via vcpkg-shell activate.
I.e., its extracted to /home/runner/work/CMSIS_6/CMSIS_6/.vcpkg/downloads/artifacts/2139c4c6/compilers.iar.cxarm/9.60.4/, see https://github.com/ARM-software/CMSIS_6/pull/229/checks#step:8:147.

To be exact, its downloaded from https://github.com/iarsystems/arm/releases/download/9.60.4/cxarm-9.60.4-linux-x86_64-base.tar.bz2 by the vcpkg manifest distributed via Arm Artifactory.

It is working for the Core test job, without issues. In there, the compiler is launched directly via lit. But when used via cbuild/cmake in CoreValidation it is failing. I can reproduce the problem in an interactive Codespace session. On my local machine I do not see this issue. But there I have a hack anyway, because I am on a Mac and due to the lack of a Mac distribution I don't receive the asset via vcpkg. Instead, I built a Docker wrapper around the toolchain bundle.

@RobinKastberg
Copy link
Contributor

@JonatanAntoni Issue is currently being looked into. We don't know details yet.

Can you try rerunning the job a few times. Does it happen every time?

@JonatanAntoni
Copy link
Member Author

Can you try rerunning the job a few times. Does it happen every time?

Yes, the behaviour is reproducible each time.

@JonatanAntoni JonatanAntoni force-pushed the iar-toolchain branch 2 times, most recently from d3d0f84 to 8a420dc Compare June 2, 2025 09:43
@soumeh01 soumeh01 force-pushed the iar-toolchain branch 15 times, most recently from f64544b to 34df51b Compare June 3, 2025 08:26
@soumeh01 soumeh01 force-pushed the iar-toolchain branch 4 times, most recently from ed512cb to 20b1e31 Compare June 3, 2025 09:37
@JonatanAntoni
Copy link
Member Author

@RobinKastberg, now the toolchain seems to run correctly. We need to focus on fixing the tests, now. Can you help with that?

@RobinKastberg
Copy link
Contributor

@RobinKastberg, now the toolchain seems to run correctly. We need to focus on fixing the tests, now. Can you help with that?

Nice! I will get started on it next week!

@RobinKastberg
Copy link
Contributor

RobinKastberg commented Jun 11, 2025

@JonatanAntoni
Hi!

I took a look at build errors for CoreValidation to start with, couldn't get FVP running this time due to licensing issues (I mailed you regarding this)

  • NS builds fail because bootloader.c writes to MSP_NS. Root cause seems to be that this should be compiled with --cmse.
  • It looks like a bunch of Cortex-A fails due to having d16 FPUs AND NEON, so the FPU code expects >16 registers since there is NEON but there is only 16 due to the FPU type mentioned. This seems to be a build system inconsistency, maybe we should set .no_neon in devtools cmake? Looks like the other compilers does this for some reason?
  • Cortex-A9 startup doesn't support IAR:
    I see both of these issues as mostly artifacts of the testing, and not real issues.

I will take a look at the lit tests next.

@JonatanAntoni
Copy link
Member Author

Thanks for spotting such issues. Yes, I'd expect most of the issues to be some toolchain integration issues, such as wrong/misaligned compiler flags. We need to sort them out gradually.

@KeilChris
Copy link
Collaborator

Do not forget to update the README.md file with instructions on how to build with IAR. Currently, it is missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants