Skip to content

Commit 3281406

Browse files
authored
Add TI Arm Clang Compiler Support to Core Tests (#277)
Builds on previous work in CMSIS-Toolbox to add TI Arm Clang Compiler support to CMSIS under designator `CLANG_TI`. - Adds `Clang_TI` option to Core Unit Tests scripts. - Adds new Cortex-R device selections to Core Unit Tests scripts. - Updates documentation to include new compiler and devices. - Fixes link issue with `Clang Compiler 20.1.0` which pointed to 404 website. Moved link from LLVM Embedded Toolchain to new Arm Toolchain for Embedded repo. Note: Cortex-R support is dependent on pull request [#45](#45) and future header updates.
1 parent 9f0bd5c commit 3281406

4 files changed

Lines changed: 371 additions & 199 deletions

File tree

.github/workflows/core.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ jobs:
2020

2121
env:
2222
ARM_UBL_ACTIVATION_CODE: ${{ secrets.ARM_UBL_ACTIVATION_CODE }}
23+
CLANG_TI_VERSION: "5.1.0.LTS"
24+
CLANG_TI_TC_SUFFIX: "5_1_0"
25+
CLANG_TI_INSTALL_PATH: "/home/runner/"
26+
CLANG_TI_SHA256: "c758668b78c080be5ec75393cdd09d077742fd1183aa0c181318a0119d58c4d0"
2327

2428
steps:
2529
- uses: actions/checkout@v6
@@ -52,6 +56,30 @@ jobs:
5256

5357
- uses: ammaraskar/gcc-problem-matcher@master
5458

59+
- name: Set TI ARM CLANG Environment Variables and Path
60+
run: |
61+
echo "CLANG_TI_PATH=${{ env.CLANG_TI_INSTALL_PATH }}ti-cgt-armllvm_${{ env.CLANG_TI_VERSION }}" >> $GITHUB_ENV
62+
echo "CLANG_TI_TOOLCHAIN_${{ env.CLANG_TI_TC_SUFFIX }}=${{ env.CLANG_TI_INSTALL_PATH }}ti-cgt-armllvm_${{ env.CLANG_TI_VERSION }}/bin" >> $GITHUB_ENV
63+
64+
- name: Cache TI ARM CLANG
65+
id: cache-ti-arm-clang
66+
uses: actions/cache@v5
67+
with:
68+
path: ${{ env.CLANG_TI_PATH }}
69+
key: ${{ runner.os }}-ti-arm-clang-${{ env.CLANG_TI_VERSION }}
70+
71+
- name: Download and Verify TI ARM CLANG Installer
72+
working-directory: /home/runner
73+
if: steps.cache-ti-arm-clang.outputs.cache-hit != 'true'
74+
run: |
75+
FILE="ti_cgt_armllvm_${{ env.CLANG_TI_VERSION }}_linux-x64_installer.bin"
76+
URL="https://dr-download.ti.com/software-development/ide-configuration-compiler-or-debugger/MD-ayxs93eZNN/${{ env.CLANG_TI_VERSION }}/${FILE}"
77+
78+
curl -L "$URL" -o "$FILE"
79+
echo "${{ env.CLANG_TI_SHA256 }} $FILE" | sha256sum --check
80+
chmod +x "$FILE"
81+
./"$FILE" --mode unattended --prefix "${{ env.CLANG_TI_INSTALL_PATH }}"
82+
5583
- name: Run LIT
5684
working-directory: ./CMSIS/Core/Test
5785
run: |

CMSIS/Core/Test/README.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Currently, the following build configurations are provided:
2525
- Arm Compiler 6 (AC6)
2626
- GNU Compiler (GCC)
2727
- LLVM/Clang (Clang)
28+
- TI Arm Clang (Clang_TI) (CM0/0+/3/4/33, CR4/5/52)
2829
2. Devices
2930
- Cortex-M0
3031
- Cortex-M0+
@@ -63,6 +64,18 @@ Currently, the following build configurations are provided:
6364
- Cortex-A9
6465
- w/o NEON extensions
6566
- w NEON extensions
67+
- Cortex-A53
68+
- w/o NEON extensions
69+
- w NEON extensions
70+
- Cortex-R4
71+
- w/o FPU
72+
- with DP FPU
73+
- Cortex-R5
74+
- w/o FPU
75+
- with DP FPU
76+
- Cortex-R52
77+
- w/o NEON extensions
78+
- w NEON extensions
6679
3. Optimization Levels
6780
- none
6881
- balanced
@@ -75,7 +88,8 @@ The following tools are required to build and run the Core tests:
7588

7689
- [Arm Compiler 6.23](https://artifacts.tools.arm.com/arm-compiler/6.23/32/)*
7790
- [GCC Compiler 14.2.1](https://artifacts.keil.arm.com/arm-none-eabi-gcc/14.2.1/)*
78-
- [Clang Compiler 20.1.0](https://github.com/ARM-software/LLVM-embedded-toolchain-for-Arm/releases/tag/release-20.1.0)*
91+
- [Clang Compiler 20.1.0](https://github.com/arm/arm-toolchain/releases/tag/release-20.1.0-ATfE)*
92+
- [TI Arm Clang Compiler 5.1.0](https://www.ti.com/tool/download/ARM-CGT-CLANG)
7993
- [Python 3.9](https://www.python.org/downloads/)
8094
- [LLVM FileCheck](https://github.com/llvm/llvm-project/releases/)
8195
- Ubuntu package `llvm-<version>-tools`
@@ -95,6 +109,8 @@ Install the Python packages required by `build.py`:
95109
./CMSIS/Core/Test $ pip install -r requirements.txt
96110
```
97111

112+
TI Arm Clang Compiler is not supported through vcpkg and must be manually installed. After installation, configure the environment variable `CLANG_TI_TOOLCHAIN_<version>` with the format specified by [CMSIS-Toolbox Installation -> Compiler Registration](https://open-cmsis-pack.github.io/cmsis-toolbox/installation/).
113+
98114
## Execute LIT tests
99115

100116
To build and run the CoreValidation tests for one or more configurations use the following command line.

CMSIS/Core/Test/build.py

Lines changed: 48 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# -*- coding: utf-8 -*-
33

44
import logging
5+
import os
56

67
from datetime import datetime
78
from enum import Enum
@@ -39,27 +40,29 @@ class DeviceAxis(Enum):
3940
CM85S = ('Cortex-M85S', 'CM85S')
4041
CM85NS = ('Cortex-M85NS', 'CM85NS')
4142
CA5 = ('Cortex-A5', 'CA5')
42-
CA7 = ('Cortex-A7', 'CA7')
43-
CA9 = ('Cortex-A9', 'CA9')
4443
CA5NEON = ('Cortex-A5neon', 'CA5neon')
44+
CA7 = ('Cortex-A7', 'CA7')
4545
CA7NEON = ('Cortex-A7neon', 'CA7neon')
46+
CA9 = ('Cortex-A9', 'CA9')
4647
CA9NEON = ('Cortex-A9neon', 'CA9neon')
47-
CA35 = ('Cortex-A35', 'CA35')
48-
CA35NEON = ('Cortex-A35neon', 'CA35')
49-
CA53 = ('Cortex-A53', 'CA53')
50-
CA53NEON = ('Cortex-A53neon', 'CA53')
51-
CA55 = ('Cortex-A55', 'CA55')
52-
CA55NEON = ('Cortex-A55neon', 'CA55')
53-
CR4 = ('Cortex-R4', 'CR4')
54-
CR4F = ('Cortex-R4F', 'CR4F')
55-
CR5 = ('Cortex-R5', 'CR5')
56-
CR5F = ('Cortex-R5F', 'CR5F')
57-
CR7 = ('Cortex-R7', 'CR7')
58-
CR7F = ('Cortex-R7F', 'CR7F')
59-
CR8 = ('Cortex-R8', 'CR8')
60-
CR8F = ('Cortex-R8F', 'CR8F')
61-
CR52 = ('Cortex-R52', 'CR52')
62-
CR52NEON = ('Cortex-R52neon', 'CR52neon')
48+
CA35 = ('Cortex-A35', 'CA35')
49+
CA35NEON = ('Cortex-A35neon', 'CA35neon')
50+
CA53 = ('Cortex-A53', 'CA53')
51+
CA53NEON = ('Cortex-A53neon', 'CA53neon')
52+
CA55 = ('Cortex-A55', 'CA55')
53+
CA55NEON = ('Cortex-A55neon', 'CA55neon')
54+
CA57 = ('Cortex-A57', 'CA57')
55+
CA57NEON = ('Cortex-A57neon', 'CA57neon')
56+
CR4 = ('Cortex-R4', 'CR4')
57+
CR4DP = ('Cortex-R4DP', 'CR4DP')
58+
CR5 = ('Cortex-R5', 'CR5')
59+
CR5DP = ('Cortex-R5DP', 'CR5DP')
60+
CR7 = ('Cortex-R7', 'CR7')
61+
CR7DP = ('Cortex-R7DP', 'CR7DP')
62+
CR8 = ('Cortex-R8', 'CR8')
63+
CR8DP = ('Cortex-R8DP', 'CR8DP')
64+
CR52 = ('Cortex-R52', 'CR52')
65+
CR52NEON = ('Cortex-R52neon', 'CR52neon')
6366

6467

6568
@matrix_axis("compiler", "c", "Compiler(s) to be considered.")
@@ -68,6 +71,7 @@ class CompilerAxis(Enum):
6871
GCC = ('GCC')
6972
IAR = ('IAR')
7073
CLANG = ('Clang')
74+
CLANG_TI = ('Clang_TI')
7175

7276

7377
@matrix_axis("optimize", "o", "Optimization level(s) to be considered.")
@@ -82,18 +86,19 @@ def timestamp():
8286
return datetime.now().strftime('%Y%m%d%H%M%S')
8387

8488

89+
def clean_output():
90+
os.system("rm -f ./src/Output/*")
91+
92+
8593
@matrix_action
8694
def lit(config, results):
8795
"""Run tests for the selected configurations using llvm's lit."""
96+
clean_output()
8897
yield run_lit(config.compiler[0], config.device[1], config.optimize[0])
8998
results[0].test_report.write(f"lit-{config.compiler[0]}-{config.optimize[0]}-{config.device[1]}-{timestamp()}.xunit")
9099

91100

92-
def timestamp():
93-
return datetime.now().strftime('%Y%m%d%H%M%S')
94-
95-
96-
@matrix_command(exit_code=[0, 1], test_report=FileReport(f"lit.xml") | JUnitReport())
101+
@matrix_command(exclusive=True, exit_code=[0, 1], test_report=FileReport(f"lit.xml") | JUnitReport())
97102
def run_lit(toolchain, device, optimize):
98103
return ["lit", "--xunit-xml-output", f"lit.xml", "-D", f"toolchain={toolchain}", "-D", f"device={device}", "-D", f"optimize={optimize}", "src" ]
99104

@@ -110,5 +115,25 @@ def filter_gcc_cm52(config):
110115
return device and compiler
111116

112117

118+
@matrix_filter
119+
def filter_clang_ti_supported_devices(config):
120+
device = not config.device.match('CM0')
121+
device &= not config.device.match('CM0plus')
122+
device &= not config.device.match('CM3')
123+
device &= not config.device.match('CM4')
124+
device &= not config.device.match('CM4FP')
125+
device &= not config.device.match('CM33')
126+
device &= not config.device.match('CM33S')
127+
device &= not config.device.match('CM33NS')
128+
device &= not config.device.match('CR4')
129+
device &= not config.device.match('CR4DP')
130+
device &= not config.device.match('CR5')
131+
device &= not config.device.match('CR5DP')
132+
device &= not config.device.match('CR52')
133+
device &= not config.device.match('CR52neon')
134+
compiler = config.compiler.match('Clang_TI')
135+
return device and compiler
136+
137+
113138
if __name__ == "__main__":
114139
main()

0 commit comments

Comments
 (0)