Subversion Repositories dashGPS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 mjames 1
/**************************************************************************//**
2
 * @file     cmsis_compiler.h
3
 * @brief    CMSIS compiler specific macros, functions, instructions
4
 * @version  V1.0.2
5
 * @date     10. January 2018
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 (armclang)
39
 */
40
#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
41
  #include "cmsis_armclang.h"
42
 
43
 
44
/*
45
 * GNU Compiler
46
 */
47
#elif defined ( __GNUC__ )
48
  #include "cmsis_gcc.h"
49
 
50
 
51
/*
52
 * IAR Compiler
53
 */
54
#elif defined ( __ICCARM__ )
55
  #include "cmsis_iccarm.h"
56
 
57
 
58
/*
59
 * TI Arm Compiler
60
 */
61
#elif defined ( __TI_ARM__ )
62
  #include <cmsis_ccs.h>
63
 
64
  #ifndef   __ASM
65
    #define __ASM                     __asm
66
  #endif
67
  #ifndef   __INLINE
68
    #define __INLINE                  inline
69
  #endif
70
  #ifndef   __STATIC_INLINE
71
    #define __STATIC_INLINE           static inline
72
  #endif
73
  #ifndef   __STATIC_INLINE
74
    #define __STATIC_INLINE           static inline
75
  #endif
76
  #ifndef   __STATIC_FORCEINLINE
77
    #define __STATIC_FORCEINLINE      __STATIC_INLINE
78
  #endif
79
  #ifndef   __NO_RETURN
80
    #define __NO_RETURN               __attribute__((noreturn))
81
  #endif
82
  #ifndef   CMSIS_DEPRECATED
83
    #define CMSIS_DEPRECATED          __attribute__((deprecated))
84
  #endif
85
  #ifndef   __USED
86
    #define __USED                    __attribute__((used))
87
  #endif
88
  #ifndef   __WEAK
89
    #define __WEAK                    __attribute__((weak))
90
  #endif
91
  #ifndef   __UNALIGNED_UINT32
92
    struct __attribute__((packed)) T_UINT32 { uint32_t v; };
93
    #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)
94
  #endif
95
  #ifndef   __ALIGNED
96
    #define __ALIGNED(x)              __attribute__((aligned(x)))
97
  #endif
98
  #ifndef   __PACKED
99
    #define __PACKED                  __attribute__((packed))
100
  #endif
101
 
102
 
103
/*
104
 * TASKING Compiler
105
 */
106
#elif defined ( __TASKING__ )
107
  /*
108
   * The CMSIS functions have been implemented as intrinsics in the compiler.
109
   * Please use "carm -?i" to get an up to date list of all intrinsics,
110
   * Including the CMSIS ones.
111
   */
112
 
113
  #ifndef   __ASM
114
    #define __ASM                     __asm
115
  #endif
116
  #ifndef   __INLINE
117
    #define __INLINE                  inline
118
  #endif
119
  #ifndef   __STATIC_INLINE
120
    #define __STATIC_INLINE           static inline
121
  #endif
122
  #ifndef   __STATIC_FORCEINLINE
123
    #define __STATIC_FORCEINLINE      __STATIC_INLINE
124
  #endif
125
  #ifndef   __NO_RETURN
126
    #define __NO_RETURN               __attribute__((noreturn))
127
  #endif
128
  #ifndef   CMSIS_DEPRECATED
129
    #define CMSIS_DEPRECATED          __attribute__((deprecated))
130
  #endif
131
  #ifndef   __USED
132
    #define __USED                    __attribute__((used))
133
  #endif
134
  #ifndef   __WEAK
135
    #define __WEAK                    __attribute__((weak))
136
  #endif
137
  #ifndef   __UNALIGNED_UINT32
138
    struct __packed__ T_UINT32 { uint32_t v; };
139
    #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)
140
  #endif
141
  #ifndef   __ALIGNED
142
    #define __ALIGNED(x)              __align(x)
143
  #endif
144
  #ifndef   __PACKED
145
    #define __PACKED                  __packed__
146
  #endif
147
 
148
 
149
/*
150
 * COSMIC Compiler
151
 */
152
#elif defined ( __CSMC__ )
153
   #include <cmsis_csm.h>
154
 
155
 #ifndef   __ASM
156
    #define __ASM                     _asm
157
  #endif
158
  #ifndef   __INLINE
159
    #define __INLINE                  inline
160
  #endif
161
  #ifndef   __STATIC_INLINE
162
    #define __STATIC_INLINE           static inline
163
  #endif
164
  #ifndef   __STATIC_FORCEINLINE
165
    #define __STATIC_FORCEINLINE      __STATIC_INLINE
166
  #endif
167
  #ifndef   __NO_RETURN
168
    // NO RETURN is automatically detected hence no warning here
169
    #define __NO_RETURN
170
  #endif
171
  #ifndef   __USED
172
    #warning No compiler specific solution for __USED. __USED is ignored.
173
    #define __USED
174
  #endif
175
  #ifndef   CMSIS_DEPRECATED
176
    #warning No compiler specific solution for CMSIS_DEPRECATED. CMSIS_DEPRECATED is ignored.
177
    #define CMSIS_DEPRECATED
178
  #endif
179
  #ifndef   __WEAK
180
    #define __WEAK                    __weak
181
  #endif
182
  #ifndef   __UNALIGNED_UINT32
183
    @packed struct T_UINT32 { uint32_t v; };
184
    #define __UNALIGNED_UINT32(x)     (((struct T_UINT32 *)(x))->v)
185
  #endif
186
  #ifndef   __ALIGNED
187
    #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
188
    #define __ALIGNED(x)
189
  #endif
190
  #ifndef   __PACKED
191
    #define __PACKED                  @packed
192
  #endif
193
 
194
 
195
#else
196
  #error Unknown compiler.
197
#endif
198
 
199
 
200
#endif /* __CMSIS_COMPILER_H */
201