25#ifndef __CMSIS_COMPILER_H
26#define __CMSIS_COMPILER_H
33#if defined ( __CC_ARM )
40#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) && (__ARMCC_VERSION < 6100100)
41 #include "cmsis_armclang_ltm.h"
46#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
53#elif defined ( __GNUC__ )
60#elif defined ( __ICCARM__ )
67#elif defined ( __TI_ARM__ )
68 #include <cmsis_ccs.h>
74 #define __INLINE inline
76 #ifndef __STATIC_INLINE
77 #define __STATIC_INLINE static inline
79 #ifndef __STATIC_FORCEINLINE
80 #define __STATIC_FORCEINLINE __STATIC_INLINE
83 #define __NO_RETURN __attribute__((noreturn))
86 #define __USED __attribute__((used))
89 #define __WEAK __attribute__((weak))
92 #define __PACKED __attribute__((packed))
94 #ifndef __PACKED_STRUCT
95 #define __PACKED_STRUCT struct __attribute__((packed))
97 #ifndef __PACKED_UNION
98 #define __PACKED_UNION union __attribute__((packed))
100 #ifndef __UNALIGNED_UINT32
102 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
104 #ifndef __UNALIGNED_UINT16_WRITE
105 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
106 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
108 #ifndef __UNALIGNED_UINT16_READ
109 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
110 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
112 #ifndef __UNALIGNED_UINT32_WRITE
113 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
114 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
116 #ifndef __UNALIGNED_UINT32_READ
117 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
118 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
121 #define __ALIGNED(x) __attribute__((aligned(x)))
124 #define __RESTRICT __restrict
131#elif defined ( __TASKING__ )
142 #define __INLINE inline
144 #ifndef __STATIC_INLINE
145 #define __STATIC_INLINE static inline
147 #ifndef __STATIC_FORCEINLINE
148 #define __STATIC_FORCEINLINE __STATIC_INLINE
151 #define __NO_RETURN __attribute__((noreturn))
154 #define __USED __attribute__((used))
157 #define __WEAK __attribute__((weak))
160 #define __PACKED __packed__
162 #ifndef __PACKED_STRUCT
163 #define __PACKED_STRUCT struct __packed__
165 #ifndef __PACKED_UNION
166 #define __PACKED_UNION union __packed__
168 #ifndef __UNALIGNED_UINT32
169 struct __packed__ T_UINT32 { uint32_t v; };
170 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
172 #ifndef __UNALIGNED_UINT16_WRITE
173 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
174 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
176 #ifndef __UNALIGNED_UINT16_READ
177 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
178 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
180 #ifndef __UNALIGNED_UINT32_WRITE
181 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
182 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
184 #ifndef __UNALIGNED_UINT32_READ
185 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
186 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
189 #define __ALIGNED(x) __align(x)
192 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
200#elif defined ( __CSMC__ )
201 #include <cmsis_csm.h>
207 #define __INLINE inline
209 #ifndef __STATIC_INLINE
210 #define __STATIC_INLINE static inline
212 #ifndef __STATIC_FORCEINLINE
213 #define __STATIC_FORCEINLINE __STATIC_INLINE
220 #warning No compiler specific solution for __USED. __USED is ignored.
224 #define __WEAK __weak
227 #define __PACKED @packed
229 #ifndef __PACKED_STRUCT
230 #define __PACKED_STRUCT @packed struct
232 #ifndef __PACKED_UNION
233 #define __PACKED_UNION @packed union
235 #ifndef __UNALIGNED_UINT32
236 @packed
struct T_UINT32 { uint32_t v; };
237 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
239 #ifndef __UNALIGNED_UINT16_WRITE
240 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
241 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
243 #ifndef __UNALIGNED_UINT16_READ
244 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
245 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
247 #ifndef __UNALIGNED_UINT32_WRITE
248 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
249 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
251 #ifndef __UNALIGNED_UINT32_READ
252 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
253 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
256 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
260 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
267#elif defined ( __ghs__ )
271 #error Unknown compiler.
CMSIS compiler ARMCC (Arm Compiler 5) header file.
CMSIS compiler armclang (Arm Compiler 6) header file.
CMSIS compiler GCC header file.
CMSIS compiler GHS header file.
CMSIS compiler ICCARM (IAR Compiler for Arm) header file.
__attribute__((section(".rev16_text"))) __STATIC_INLINE __ASM uint32_t __REV16(uint32_t value)
Reverse byte order (16 bit).
Definition cmsis_armcc.h:467