]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube/ST_Code/Drivers/CMSIS/Include/cmsis_compiler.h
Make vSetupTimerInterrupt weak in the RVDS M4 MPU port to give the
[freertos] / FreeRTOS / Demo / CORTEX_MPU_STM32L4_Discovery_Keil_STM32Cube / ST_Code / Drivers / CMSIS / Include / cmsis_compiler.h
1 /**************************************************************************//**\r
2  * @file     cmsis_compiler.h\r
3  * @brief    CMSIS compiler generic header file\r
4  * @version  V5.0.4\r
5  * @date     10. January 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 (armclang)\r
39  */\r
40 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)\r
41   #include "cmsis_armclang.h"\r
42 \r
43 \r
44 /*\r
45  * GNU Compiler\r
46  */\r
47 #elif defined ( __GNUC__ )\r
48   #include "cmsis_gcc.h"\r
49 \r
50 \r
51 /*\r
52  * IAR Compiler\r
53  */\r
54 #elif defined ( __ICCARM__ )\r
55   #include <cmsis_iccarm.h>\r
56 \r
57 \r
58 /*\r
59  * TI Arm Compiler\r
60  */\r
61 #elif defined ( __TI_ARM__ )\r
62   #include <cmsis_ccs.h>\r
63 \r
64   #ifndef   __ASM\r
65     #define __ASM                                  __asm\r
66   #endif\r
67   #ifndef   __INLINE\r
68     #define __INLINE                               inline\r
69   #endif\r
70   #ifndef   __STATIC_INLINE\r
71     #define __STATIC_INLINE                        static inline\r
72   #endif\r
73   #ifndef   __STATIC_FORCEINLINE\r
74     #define __STATIC_FORCEINLINE                   __STATIC_INLINE\r
75   #endif\r
76   #ifndef   __NO_RETURN\r
77     #define __NO_RETURN                            __attribute__((noreturn))\r
78   #endif\r
79   #ifndef   __USED\r
80     #define __USED                                 __attribute__((used))\r
81   #endif\r
82   #ifndef   __WEAK\r
83     #define __WEAK                                 __attribute__((weak))\r
84   #endif\r
85   #ifndef   __PACKED\r
86     #define __PACKED                               __attribute__((packed))\r
87   #endif\r
88   #ifndef   __PACKED_STRUCT\r
89     #define __PACKED_STRUCT                        struct __attribute__((packed))\r
90   #endif\r
91   #ifndef   __PACKED_UNION\r
92     #define __PACKED_UNION                         union __attribute__((packed))\r
93   #endif\r
94   #ifndef   __UNALIGNED_UINT32        /* deprecated */\r
95     struct __attribute__((packed)) T_UINT32 { uint32_t v; };\r
96     #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)\r
97   #endif\r
98   #ifndef   __UNALIGNED_UINT16_WRITE\r
99     __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };\r
100     #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))\r
101   #endif\r
102   #ifndef   __UNALIGNED_UINT16_READ\r
103     __PACKED_STRUCT T_UINT16_READ { uint16_t v; };\r
104     #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)\r
105   #endif\r
106   #ifndef   __UNALIGNED_UINT32_WRITE\r
107     __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };\r
108     #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))\r
109   #endif\r
110   #ifndef   __UNALIGNED_UINT32_READ\r
111     __PACKED_STRUCT T_UINT32_READ { uint32_t v; };\r
112     #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)\r
113   #endif\r
114   #ifndef   __ALIGNED\r
115     #define __ALIGNED(x)                           __attribute__((aligned(x)))\r
116   #endif\r
117   #ifndef   __RESTRICT\r
118     #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.\r
119     #define __RESTRICT\r
120   #endif\r
121 \r
122 \r
123 /*\r
124  * TASKING Compiler\r
125  */\r
126 #elif defined ( __TASKING__ )\r
127   /*\r
128    * The CMSIS functions have been implemented as intrinsics in the compiler.\r
129    * Please use "carm -?i" to get an up to date list of all intrinsics,\r
130    * Including the CMSIS ones.\r
131    */\r
132 \r
133   #ifndef   __ASM\r
134     #define __ASM                                  __asm\r
135   #endif\r
136   #ifndef   __INLINE\r
137     #define __INLINE                               inline\r
138   #endif\r
139   #ifndef   __STATIC_INLINE\r
140     #define __STATIC_INLINE                        static inline\r
141   #endif\r
142   #ifndef   __STATIC_FORCEINLINE\r
143     #define __STATIC_FORCEINLINE                   __STATIC_INLINE\r
144   #endif\r
145   #ifndef   __NO_RETURN\r
146     #define __NO_RETURN                            __attribute__((noreturn))\r
147   #endif\r
148   #ifndef   __USED\r
149     #define __USED                                 __attribute__((used))\r
150   #endif\r
151   #ifndef   __WEAK\r
152     #define __WEAK                                 __attribute__((weak))\r
153   #endif\r
154   #ifndef   __PACKED\r
155     #define __PACKED                               __packed__\r
156   #endif\r
157   #ifndef   __PACKED_STRUCT\r
158     #define __PACKED_STRUCT                        struct __packed__\r
159   #endif\r
160   #ifndef   __PACKED_UNION\r
161     #define __PACKED_UNION                         union __packed__\r
162   #endif\r
163   #ifndef   __UNALIGNED_UINT32        /* deprecated */\r
164     struct __packed__ T_UINT32 { uint32_t v; };\r
165     #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)\r
166   #endif\r
167   #ifndef   __UNALIGNED_UINT16_WRITE\r
168     __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };\r
169     #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))\r
170   #endif\r
171   #ifndef   __UNALIGNED_UINT16_READ\r
172     __PACKED_STRUCT T_UINT16_READ { uint16_t v; };\r
173     #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)\r
174   #endif\r
175   #ifndef   __UNALIGNED_UINT32_WRITE\r
176     __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };\r
177     #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))\r
178   #endif\r
179   #ifndef   __UNALIGNED_UINT32_READ\r
180     __PACKED_STRUCT T_UINT32_READ { uint32_t v; };\r
181     #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)\r
182   #endif\r
183   #ifndef   __ALIGNED\r
184     #define __ALIGNED(x)              __align(x)\r
185   #endif\r
186   #ifndef   __RESTRICT\r
187     #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.\r
188     #define __RESTRICT\r
189   #endif\r
190 \r
191 \r
192 /*\r
193  * COSMIC Compiler\r
194  */\r
195 #elif defined ( __CSMC__ )\r
196    #include <cmsis_csm.h>\r
197 \r
198  #ifndef   __ASM\r
199     #define __ASM                                  _asm\r
200   #endif\r
201   #ifndef   __INLINE\r
202     #define __INLINE                               inline\r
203   #endif\r
204   #ifndef   __STATIC_INLINE\r
205     #define __STATIC_INLINE                        static inline\r
206   #endif\r
207   #ifndef   __STATIC_FORCEINLINE\r
208     #define __STATIC_FORCEINLINE                   __STATIC_INLINE\r
209   #endif\r
210   #ifndef   __NO_RETURN\r
211     // NO RETURN is automatically detected hence no warning here\r
212     #define __NO_RETURN\r
213   #endif\r
214   #ifndef   __USED\r
215     #warning No compiler specific solution for __USED. __USED is ignored.\r
216     #define __USED\r
217   #endif\r
218   #ifndef   __WEAK\r
219     #define __WEAK                                 __weak\r
220   #endif\r
221   #ifndef   __PACKED\r
222     #define __PACKED                               @packed\r
223   #endif\r
224   #ifndef   __PACKED_STRUCT\r
225     #define __PACKED_STRUCT                        @packed struct\r
226   #endif\r
227   #ifndef   __PACKED_UNION\r
228     #define __PACKED_UNION                         @packed union\r
229   #endif\r
230   #ifndef   __UNALIGNED_UINT32        /* deprecated */\r
231     @packed struct T_UINT32 { uint32_t v; };\r
232     #define __UNALIGNED_UINT32(x)                  (((struct T_UINT32 *)(x))->v)\r
233   #endif\r
234   #ifndef   __UNALIGNED_UINT16_WRITE\r
235     __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };\r
236     #define __UNALIGNED_UINT16_WRITE(addr, val)    (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))\r
237   #endif\r
238   #ifndef   __UNALIGNED_UINT16_READ\r
239     __PACKED_STRUCT T_UINT16_READ { uint16_t v; };\r
240     #define __UNALIGNED_UINT16_READ(addr)          (((const struct T_UINT16_READ *)(const void *)(addr))->v)\r
241   #endif\r
242   #ifndef   __UNALIGNED_UINT32_WRITE\r
243     __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };\r
244     #define __UNALIGNED_UINT32_WRITE(addr, val)    (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))\r
245   #endif\r
246   #ifndef   __UNALIGNED_UINT32_READ\r
247     __PACKED_STRUCT T_UINT32_READ { uint32_t v; };\r
248     #define __UNALIGNED_UINT32_READ(addr)          (((const struct T_UINT32_READ *)(const void *)(addr))->v)\r
249   #endif\r
250   #ifndef   __ALIGNED\r
251     #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.\r
252     #define __ALIGNED(x)\r
253   #endif\r
254   #ifndef   __RESTRICT\r
255     #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.\r
256     #define __RESTRICT\r
257   #endif\r
258 \r
259 \r
260 #else\r
261   #error Unknown compiler.\r
262 #endif\r
263 \r
264 \r
265 #endif /* __CMSIS_COMPILER_H */\r
266 \r