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)
46#elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6100100)
58#elif defined ( __GNUC__ )
65#elif defined ( __ICCARM__ )
72#elif defined ( __TI_ARM__ )
73 #include <cmsis_ccs.h>
79 #define __INLINE inline
81 #ifndef __STATIC_INLINE
82 #define __STATIC_INLINE static inline
84 #ifndef __STATIC_FORCEINLINE
85 #define __STATIC_FORCEINLINE __STATIC_INLINE
88 #define __NO_RETURN __attribute__((noreturn))
91 #define __USED __attribute__((used))
94 #define __WEAK __attribute__((weak))
97 #define __PACKED __attribute__((packed))
99 #ifndef __PACKED_STRUCT
100 #define __PACKED_STRUCT struct __attribute__((packed))
102 #ifndef __PACKED_UNION
103 #define __PACKED_UNION union __attribute__((packed))
105 #ifndef __UNALIGNED_UINT32
107 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
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))
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)
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))
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)
126 #define __ALIGNED(x) __attribute__((aligned(x)))
129 #define __RESTRICT __restrict
131 #ifndef __COMPILER_BARRIER
132 #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
133 #define __COMPILER_BARRIER() (void)0
136 #define __NO_INIT __attribute__ ((section (".bss.noinit")))
139 #define __ALIAS(x) __attribute__ ((alias(x)))
145#elif defined ( __TASKING__ )
156 #define __INLINE inline
158 #ifndef __STATIC_INLINE
159 #define __STATIC_INLINE static inline
161 #ifndef __STATIC_FORCEINLINE
162 #define __STATIC_FORCEINLINE __STATIC_INLINE
165 #define __NO_RETURN __attribute__((noreturn))
168 #define __USED __attribute__((used))
171 #define __WEAK __attribute__((weak))
174 #define __PACKED __packed__
176 #ifndef __PACKED_STRUCT
177 #define __PACKED_STRUCT struct __packed__
179 #ifndef __PACKED_UNION
180 #define __PACKED_UNION union __packed__
182 #ifndef __UNALIGNED_UINT32
183 struct __packed__ T_UINT32 { uint32_t v; };
184 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
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))
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)
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))
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)
203 #define __ALIGNED(x) __align(x)
206 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
209 #ifndef __COMPILER_BARRIER
210 #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
211 #define __COMPILER_BARRIER() (void)0
214 #define __NO_INIT __attribute__ ((section (".bss.noinit")))
217 #define __ALIAS(x) __attribute__ ((alias(x)))
223#elif defined ( __CSMC__ )
224 #include <cmsis_csm.h>
230 #define __INLINE inline
232 #ifndef __STATIC_INLINE
233 #define __STATIC_INLINE static inline
235 #ifndef __STATIC_FORCEINLINE
236 #define __STATIC_FORCEINLINE __STATIC_INLINE
243 #warning No compiler specific solution for __USED. __USED is ignored.
247 #define __WEAK __weak
250 #define __PACKED @packed
252 #ifndef __PACKED_STRUCT
253 #define __PACKED_STRUCT @packed struct
255 #ifndef __PACKED_UNION
256 #define __PACKED_UNION @packed union
258 #ifndef __UNALIGNED_UINT32
259 @packed
struct T_UINT32 { uint32_t v; };
260 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
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))
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)
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))
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)
279 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
283 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
286 #ifndef __COMPILER_BARRIER
287 #warning No compiler specific solution for __COMPILER_BARRIER. __COMPILER_BARRIER is ignored.
288 #define __COMPILER_BARRIER() (void)0
291 #define __NO_INIT __attribute__ ((section (".bss.noinit")))
294 #define __ALIAS(x) __attribute__ ((alias(x)))
298 #error Unknown compiler.
CMSIS compiler ARMCC (Arm Compiler 5) header file.
CMSIS compiler armclang (Arm Compiler 6) header file.
CMSIS compiler armclang (Arm Compiler 6) header file.
CMSIS compiler GCC header file.
CMSIS compiler ICCARM (IAR Compiler for Arm) header file.
CMSIS compiler tiarmclang header file.
void __attribute__((noreturn))(*rom_reset_usb_boot_fn)(uint32_t
Reboot the device into BOOTSEL mode.