Skip to content

Commit f090171

Browse files
committed
Fix arch profile detection:
cmsis_compiler.h must be independent from being included after core_xx.h which sets __CORTEX_x defines.
1 parent 0ad3936 commit f090171

7 files changed

Lines changed: 30 additions & 23 deletions

File tree

CMSIS/Core/Include/cmsis_compiler.h

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,73 +31,73 @@
3131
* Arm Compiler above 6.10.1 (armclang)
3232
*/
3333
#if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
34-
#if defined __CORTEX_A
34+
#if __ARM_ARCH_PROFILE == 'A'
3535
#include "./a-profile/cmsis_armclang_a.h"
36-
#elif defined __CORTEX_R
36+
#elif __ARM_ARCH_PROFILE == 'R'
3737
#include "./r-profile/cmsis_armclang_r.h"
38-
#elif defined __CORTEX_M
38+
#elif __ARM_ARCH_PROFILE == 'M'
3939
#include "./m-profile/cmsis_armclang_m.h"
4040
#else
41-
#error "Unknown architecture"
41+
#error "Unknown Arm architecture profile"
4242
#endif
4343

4444
/*
4545
* TI Arm Clang Compiler (tiarmclang)
4646
*/
4747
#elif defined (__ti__)
48-
#if defined __CORTEX_A
48+
#if __ARM_ARCH_PROFILE == 'A'
4949
#error "Core-A is not supported for this compiler"
50-
#elif defined __CORTEX_R
50+
#elif __ARM_ARCH_PROFILE == 'R'
5151
#error "Core-R is not supported for this compiler"
52-
#elif defined __CORTEX_M
52+
#elif __ARM_ARCH_PROFILE == 'M'
5353
#include "m-profile/cmsis_tiarmclang_m.h"
5454
#else
55-
#error "Unknown architecture"
55+
#error "Unknown Arm architecture profile"
5656
#endif
5757

5858

5959
/*
6060
* LLVM/Clang Compiler
6161
*/
6262
#elif defined ( __clang__ )
63-
#if defined __CORTEX_A
63+
#if __ARM_ARCH_PROFILE == 'A'
6464
#include "a-profile/cmsis_clang_a.h"
65-
#elif defined __CORTEX_R
65+
#elif __ARM_ARCH_PROFILE == 'R'
6666
#include "r-profile/cmsis_clang_r.h"
67-
#elif defined __CORTEX_M
67+
#elif __ARM_ARCH_PROFILE == 'M'
6868
#include "m-profile/cmsis_clang_m.h"
6969
#else
70-
#error "Unknown architecture"
70+
#error "Unknown Arm architecture profile"
7171
#endif
7272

7373

7474
/*
7575
* GNU Compiler
7676
*/
7777
#elif defined ( __GNUC__ )
78-
#if defined __CORTEX_A
78+
#if __ARM_ARCH_PROFILE == 'A'
7979
#include "a-profile/cmsis_gcc_a.h"
80-
#elif defined __CORTEX_R
80+
#elif __ARM_ARCH_PROFILE == 'R'
8181
#include "r-profile/cmsis_gcc_r.h"
82-
#elif defined __CORTEX_M
82+
#elif __ARM_ARCH_PROFILE == 'M'
8383
#include "m-profile/cmsis_gcc_m.h"
8484
#else
85-
#error "Unknown architecture"
85+
#error "Unknown Arm architecture profile"
8686
#endif
8787

8888

8989
/*
9090
* IAR Compiler
9191
*/
9292
#elif defined ( __ICCARM__ )
93-
#if defined __CORTEX_A
93+
#if __ARM_ARCH_PROFILE == 'A'
9494
#include "a-profile/cmsis_iccarm_a.h"
95-
#elif defined __CORTEX_R
95+
#elif __ARM_ARCH_PROFILE == 'R'
9696
#include "r-profile/cmsis_iccarm_r.h"
97-
#elif defined __CORTEX_M
97+
#elif __ARM_ARCH_PROFILE == 'M'
9898
#include "m-profile/cmsis_iccarm_m.h"
9999
#else
100-
#error "Unknown architecture"
100+
#error "Unknown Arm architecture profile"
101101
#endif
102102

103103

CMSIS/CoreValidation/Project/build.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ def bl_device(self):
6969
@matrix_axis("compiler", "c", "Compiler(s) to be considered.")
7070
class CompilerAxis(Enum):
7171
AC6 = ('AC6')
72-
AC6LTM = ('AC6LTM')
7372
GCC = ('GCC')
7473
IAR = ('IAR')
7574
CLANG = ('Clang')
@@ -78,7 +77,6 @@ class CompilerAxis(Enum):
7877
def image_ext(self):
7978
ext = {
8079
CompilerAxis.AC6: 'axf',
81-
CompilerAxis.AC6LTM: 'axf',
8280
CompilerAxis.GCC: 'elf',
8381
CompilerAxis.IAR: 'elf',
8482
CompilerAxis.CLANG: 'elf',
@@ -89,7 +87,6 @@ def image_ext(self):
8987
def toolchain(self):
9088
ext = {
9189
CompilerAxis.AC6: 'AC6',
92-
CompilerAxis.AC6LTM: 'AC6@6.16.2',
9390
CompilerAxis.GCC: 'GCC',
9491
CompilerAxis.IAR: 'IAR',
9592
CompilerAxis.CLANG: 'CLANG'

CMSIS/CoreValidation/Source/CV_CoreAFunc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright (c) 2017 ARM Limited. All rights reserved.
66
*----------------------------------------------------------------------------*/
77

8+
#include "cmsis_compiler.h"
9+
810
#include "CV_Framework.h"
911
#include "cmsis_cv.h"
1012

CMSIS/CoreValidation/Source/CV_CoreFunc.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright (c) 2017 - 2023 Arm Limited. All rights reserved.
66
*----------------------------------------------------------------------------*/
77

8+
#include "cmsis_compiler.h"
9+
810
#include "CV_Framework.h"
911
#include "cmsis_cv.h"
1012

CMSIS/CoreValidation/Source/CV_CoreInstr.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright (c) 2017 - 2021 Arm Limited. All rights reserved.
66
*----------------------------------------------------------------------------*/
77

8+
#include "cmsis_compiler.h"
9+
810
#include "CV_Framework.h"
911
#include "cmsis_cv.h"
1012

CMSIS/CoreValidation/Source/CV_CoreSimd.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright (c) 2018 Arm Limited. All rights reserved.
66
*----------------------------------------------------------------------------*/
77

8+
#include "cmsis_compiler.h"
9+
810
#include "CV_Framework.h"
911
#include "cmsis_cv.h"
1012

CMSIS/CoreValidation/Source/CV_GenTimer.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
* Copyright (c) 2017 ARM Limited. All rights reserved.
66
*----------------------------------------------------------------------------*/
77

8+
#include "cmsis_compiler.h"
9+
810
#include "CV_Framework.h"
911
#include "cmsis_cv.h"
1012

0 commit comments

Comments
 (0)