]> begriffs open source - cmsis/blob - CMSIS/Core_A/Include/cmsis_compiler.h
Make CV execution optional
[cmsis] / CMSIS / Core_A / Include / cmsis_compiler.h
1 /**************************************************************************//**
2  * @file     cmsis_compiler.h
3  * @brief    CMSIS compiler specific macros, functions, instructions
4  * @version  V1.0.3
5  * @date     13. November 2022
6  ******************************************************************************/
7 /*
8  * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
9  *
10  * SPDX-License-Identifier: Apache-2.0
11  *
12  * Licensed under the Apache License, Version 2.0 (the License); you may
13  * not use this file except in compliance with the License.
14  * You may obtain a copy of the License at
15  *
16  * www.apache.org/licenses/LICENSE-2.0
17  *
18  * Unless required by applicable law or agreed to in writing, software
19  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21  * See the License for the specific language governing permissions and
22  * limitations under the License.
23  */
24
25 #ifndef __CMSIS_COMPILER_H
26 #define __CMSIS_COMPILER_H
27
28 #include <stdint.h>
29
30 /*
31  * Arm Compiler 4/5
32  */
33 #if   defined ( __CC_ARM )
34   #include "cmsis_armcc.h"
35
36
37 /*
38  * Arm Compiler 6.6 LTM (armclang)
39  */
40 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100)
41   #include "cmsis_armclang_ltm.h"
42
43   /*
44  * Arm Compiler above 6.10.1 (armclang)
45  */
46 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
47   #include "cmsis_armclang.h"
48
49
50 /*
51  * GNU Compiler
52  */
53 #elif defined ( __GNUC__ )
54   #include "cmsis_gcc.h"
55
56
57 /*
58  * IAR Compiler
59  */
60 #elif defined ( __ICCARM__ )
61   #include <cmsis_iccarm.h>
62
63
64 /*
65  * TI Arm Compiler
66  */
67 #elif defined ( __TI_ARM__ )
68   #include <cmsis_ccs.h>
69
70   #ifndef   __ASM
71     #define __ASM                     __asm
72   #endif
73   #ifndef   __INLINE
74     #define __INLINE                  inline
75   #endif
76   #ifndef   __STATIC_INLINE
77     #define __STATIC_INLINE           static inline
78   #endif
79   #ifndef   __STATIC_FORCEINLINE
80     #define __STATIC_FORCEINLINE      __STATIC_INLINE
81   #endif
82   #ifndef   __NO_RETURN
83     #define __NO_RETURN               __attribute__((noreturn))
84   #endif
85   #ifndef   CMSIS_DEPRECATED
86     #define CMSIS_DEPRECATED          __attribute__((deprecated))
87   #endif
88   #ifndef   __USED
89     #define __USED                    __attribute__((used))
90   #endif
91   #ifndef   __WEAK
92     #define __WEAK                    __attribute__((weak))
93   #endif
94   #ifndef   __PACKED
95     #define __PACKED                               __attribute__((packed))
96   #endif
97   #ifndef   __PACKED_STRUCT
98     #define __PACKED_STRUCT                        struct __attribute__((packed))
99   #endif
100   #ifndef   __PACKED_UNION
101     #define __PACKED_UNION                         union __attribute__((packed))
102   #endif
103   #ifndef   __UNALIGNED_UINT32        /* deprecated */
104     struct __attribute__((packed)) T_UINT32 { uint32_t v; };
105     #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)
106   #endif
107   #ifndef   __ALIGNED
108     #define __ALIGNED(x)              __attribute__((aligned(x)))
109   #endif
110   #ifndef   __RESTRICT
111     #define __RESTRICT                             __restrict
112   #endif
113   #ifndef   __COMPILER_BARRIER
114     #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
115     #define __COMPILER_BARRIER()      (void)0
116   #endif
117
118
119 /*
120  * TASKING Compiler
121  */
122 #elif defined ( __TASKING__ )
123   /*
124    * The CMSIS functions have been implemented as intrinsics in the compiler.
125    * Please use "carm -?i" to get an up to date list of all intrinsics,
126    * Including the CMSIS ones.
127    */
128
129   #ifndef   __ASM
130     #define __ASM                     __asm
131   #endif
132   #ifndef   __INLINE
133     #define __INLINE                  inline
134   #endif
135   #ifndef   __STATIC_INLINE
136     #define __STATIC_INLINE           static inline
137   #endif
138   #ifndef   __STATIC_FORCEINLINE
139     #define __STATIC_FORCEINLINE      __STATIC_INLINE
140   #endif
141   #ifndef   __NO_RETURN
142     #define __NO_RETURN               __attribute__((noreturn))
143   #endif
144   #ifndef   CMSIS_DEPRECATED
145     #define CMSIS_DEPRECATED          __attribute__((deprecated))
146   #endif
147   #ifndef   __USED
148     #define __USED                    __attribute__((used))
149   #endif
150   #ifndef   __WEAK
151     #define __WEAK                    __attribute__((weak))
152   #endif
153   #ifndef   __PACKED
154     #define __PACKED                               __packed__
155   #endif
156   #ifndef   __PACKED_STRUCT
157     #define __PACKED_STRUCT                        struct __packed__
158   #endif
159   #ifndef   __PACKED_UNION
160     #define __PACKED_UNION                         union __packed__
161   #endif
162   #ifndef   __UNALIGNED_UINT32        /* deprecated */
163     struct __packed__ T_UINT32 { uint32_t v; };
164     #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)
165   #endif
166   #ifndef   __ALIGNED
167     #define __ALIGNED(x)              __align(x)
168   #endif
169   #ifndef   __RESTRICT
170     #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
171     #define __RESTRICT
172   #endif
173   #ifndef   __COMPILER_BARRIER
174     #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
175     #define __COMPILER_BARRIER()      (void)0
176   #endif
177
178
179 /*
180  * COSMIC Compiler
181  */
182 #elif defined ( __CSMC__ )
183    #include <cmsis_csm.h>
184
185  #ifndef   __ASM
186     #define __ASM                     _asm
187   #endif
188   #ifndef   __INLINE
189     #define __INLINE                  inline
190   #endif
191   #ifndef   __STATIC_INLINE
192     #define __STATIC_INLINE           static inline
193   #endif
194   #ifndef   __STATIC_FORCEINLINE
195     #define __STATIC_FORCEINLINE      __STATIC_INLINE
196   #endif
197   #ifndef   __NO_RETURN
198     // NO RETURN is automatically detected hence no warning here
199     #define __NO_RETURN
200   #endif
201   #ifndef   __USED
202     #warning No compiler specific solution for __USED. __USED is ignored.
203     #define __USED
204   #endif
205   #ifndef   CMSIS_DEPRECATED
206     #warning No compiler specific solution for CMSIS_DEPRECATED. CMSIS_DEPRECATED is ignored.
207     #define CMSIS_DEPRECATED
208   #endif
209   #ifndef   __WEAK
210     #define __WEAK                    __weak
211   #endif
212   #ifndef   __PACKED
213     #define __PACKED                               @packed
214   #endif
215   #ifndef   __PACKED_STRUCT
216     #define __PACKED_STRUCT                        @packed struct
217   #endif
218   #ifndef   __PACKED_UNION
219     #define __PACKED_UNION                         @packed union
220   #endif
221   #ifndef   __UNALIGNED_UINT32        /* deprecated */
222     @packed struct T_UINT32 { uint32_t v; };
223     #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)
224   #endif
225   #ifndef   __ALIGNED
226     #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
227     #define __ALIGNED(x)
228   #endif
229   #ifndef   __RESTRICT
230     #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
231     #define __RESTRICT
232   #endif
233   #ifndef   __COMPILER_BARRIER
234     #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
235     #define __COMPILER_BARRIER()      (void)0
236   #endif
237
238
239 #else
240   #error Unknown compiler.
241 #endif
242
243
244 #endif /* __CMSIS_COMPILER_H */
245