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