RTEMS 6.1-rc1
cmsis_compiler.h
Go to the documentation of this file.
1/**************************************************************************/
7/*
8 * Copyright (c) 2009-2023 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 * TI Arm Clang Compiler (tiarmclang)
51 */
52#elif defined (__ti__)
53 #include "cmsis_tiarmclang.h"
54
55/*
56 * GNU Compiler
57 */
58#elif defined ( __GNUC__ )
59 #include "cmsis_gcc.h"
60
61
62/*
63 * IAR Compiler
64 */
65#elif defined ( __ICCARM__ )
66 #include <cmsis_iccarm.h>
67
68
69/*
70 * TI Arm Compiler (armcl)
71 */
72#elif defined ( __TI_ARM__ )
73 #include <cmsis_ccs.h>
74
75 #ifndef __ASM
76 #define __ASM __asm
77 #endif
78 #ifndef __INLINE
79 #define __INLINE inline
80 #endif
81 #ifndef __STATIC_INLINE
82 #define __STATIC_INLINE static inline
83 #endif
84 #ifndef __STATIC_FORCEINLINE
85 #define __STATIC_FORCEINLINE __STATIC_INLINE
86 #endif
87 #ifndef __NO_RETURN
88 #define __NO_RETURN __attribute__((noreturn))
89 #endif
90 #ifndef __USED
91 #define __USED __attribute__((used))
92 #endif
93 #ifndef __WEAK
94 #define __WEAK __attribute__((weak))
95 #endif
96 #ifndef __PACKED
97 #define __PACKED __attribute__((packed))
98 #endif
99 #ifndef __PACKED_STRUCT
100 #define __PACKED_STRUCT struct __attribute__((packed))
101 #endif
102 #ifndef __PACKED_UNION
103 #define __PACKED_UNION union __attribute__((packed))
104 #endif
105 #ifndef __UNALIGNED_UINT32 /* deprecated */
106 struct __attribute__((packed)) T_UINT32 { uint32_t v; };
107 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
108 #endif
109 #ifndef __UNALIGNED_UINT16_WRITE
110 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
111 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
112 #endif
113 #ifndef __UNALIGNED_UINT16_READ
114 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
115 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
116 #endif
117 #ifndef __UNALIGNED_UINT32_WRITE
118 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
119 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
120 #endif
121 #ifndef __UNALIGNED_UINT32_READ
122 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
123 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
124 #endif
125 #ifndef __ALIGNED
126 #define __ALIGNED(x) __attribute__((aligned(x)))
127 #endif
128 #ifndef __RESTRICT
129 #define __RESTRICT __restrict
130 #endif
131 #ifndef __COMPILER_BARRIER
132 #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
133 #define __COMPILER_BARRIER() (void)0
134 #endif
135 #ifndef __NO_INIT
136 #define __NO_INIT __attribute__ ((section (".bss.noinit")))
137 #endif
138 #ifndef __ALIAS
139 #define __ALIAS(x) __attribute__ ((alias(x)))
140 #endif
141
142/*
143 * TASKING Compiler
144 */
145#elif defined ( __TASKING__ )
146 /*
147 * The CMSIS functions have been implemented as intrinsics in the compiler.
148 * Please use "carm -?i" to get an up to date list of all intrinsics,
149 * Including the CMSIS ones.
150 */
151
152 #ifndef __ASM
153 #define __ASM __asm
154 #endif
155 #ifndef __INLINE
156 #define __INLINE inline
157 #endif
158 #ifndef __STATIC_INLINE
159 #define __STATIC_INLINE static inline
160 #endif
161 #ifndef __STATIC_FORCEINLINE
162 #define __STATIC_FORCEINLINE __STATIC_INLINE
163 #endif
164 #ifndef __NO_RETURN
165 #define __NO_RETURN __attribute__((noreturn))
166 #endif
167 #ifndef __USED
168 #define __USED __attribute__((used))
169 #endif
170 #ifndef __WEAK
171 #define __WEAK __attribute__((weak))
172 #endif
173 #ifndef __PACKED
174 #define __PACKED __packed__
175 #endif
176 #ifndef __PACKED_STRUCT
177 #define __PACKED_STRUCT struct __packed__
178 #endif
179 #ifndef __PACKED_UNION
180 #define __PACKED_UNION union __packed__
181 #endif
182 #ifndef __UNALIGNED_UINT32 /* deprecated */
183 struct __packed__ T_UINT32 { uint32_t v; };
184 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
185 #endif
186 #ifndef __UNALIGNED_UINT16_WRITE
187 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
188 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
189 #endif
190 #ifndef __UNALIGNED_UINT16_READ
191 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
192 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
193 #endif
194 #ifndef __UNALIGNED_UINT32_WRITE
195 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
196 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
197 #endif
198 #ifndef __UNALIGNED_UINT32_READ
199 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
200 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
201 #endif
202 #ifndef __ALIGNED
203 #define __ALIGNED(x) __align(x)
204 #endif
205 #ifndef __RESTRICT
206 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
207 #define __RESTRICT
208 #endif
209 #ifndef __COMPILER_BARRIER
210 #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
211 #define __COMPILER_BARRIER() (void)0
212 #endif
213 #ifndef __NO_INIT
214 #define __NO_INIT __attribute__ ((section (".bss.noinit")))
215 #endif
216 #ifndef __ALIAS
217 #define __ALIAS(x) __attribute__ ((alias(x)))
218 #endif
219
220/*
221 * COSMIC Compiler
222 */
223#elif defined ( __CSMC__ )
224 #include <cmsis_csm.h>
225
226 #ifndef __ASM
227 #define __ASM _asm
228 #endif
229 #ifndef __INLINE
230 #define __INLINE inline
231 #endif
232 #ifndef __STATIC_INLINE
233 #define __STATIC_INLINE static inline
234 #endif
235 #ifndef __STATIC_FORCEINLINE
236 #define __STATIC_FORCEINLINE __STATIC_INLINE
237 #endif
238 #ifndef __NO_RETURN
239 // NO RETURN is automatically detected hence no warning here
240 #define __NO_RETURN
241 #endif
242 #ifndef __USED
243 #warning No compiler specific solution for __USED. __USED is ignored.
244 #define __USED
245 #endif
246 #ifndef __WEAK
247 #define __WEAK __weak
248 #endif
249 #ifndef __PACKED
250 #define __PACKED @packed
251 #endif
252 #ifndef __PACKED_STRUCT
253 #define __PACKED_STRUCT @packed struct
254 #endif
255 #ifndef __PACKED_UNION
256 #define __PACKED_UNION @packed union
257 #endif
258 #ifndef __UNALIGNED_UINT32 /* deprecated */
259 @packed struct T_UINT32 { uint32_t v; };
260 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
261 #endif
262 #ifndef __UNALIGNED_UINT16_WRITE
263 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
264 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
265 #endif
266 #ifndef __UNALIGNED_UINT16_READ
267 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
268 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
269 #endif
270 #ifndef __UNALIGNED_UINT32_WRITE
271 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
272 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
273 #endif
274 #ifndef __UNALIGNED_UINT32_READ
275 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
276 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
277 #endif
278 #ifndef __ALIGNED
279 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
280 #define __ALIGNED(x)
281 #endif
282 #ifndef __RESTRICT
283 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
284 #define __RESTRICT
285 #endif
286 #ifndef __COMPILER_BARRIER
287 #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
288 #define __COMPILER_BARRIER() (void)0
289 #endif
290 #ifndef __NO_INIT
291 #define __NO_INIT __attribute__ ((section (".bss.noinit")))
292 #endif
293 #ifndef __ALIAS
294 #define __ALIAS(x) __attribute__ ((alias(x)))
295 #endif
296
297#else
298 #error Unknown compiler.
299#endif
300
301
302#endif /* __CMSIS_COMPILER_H */
303
CMSIS compiler GCC header file.
Definition: xnandpsu_onfi.h:181
unsigned v
Definition: tte.h:0