25 #ifndef __CMSIS_COMPILER_H 26 #define __CMSIS_COMPILER_H 33 #if defined ( __CC_ARM ) 40 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 47 #elif defined ( __GNUC__ ) 54 #elif defined ( __ICCARM__ ) 61 #elif defined ( __TI_ARM__ ) 62 #include <cmsis_ccs.h> 68 #define __INLINE inline 70 #ifndef __STATIC_INLINE 71 #define __STATIC_INLINE static inline 73 #ifndef __STATIC_FORCEINLINE 74 #define __STATIC_FORCEINLINE __STATIC_INLINE 77 #define __NO_RETURN __attribute__((noreturn)) 80 #define __USED __attribute__((used)) 83 #define __WEAK __attribute__((weak)) 86 #define __PACKED __attribute__((packed)) 88 #ifndef __PACKED_STRUCT 89 #define __PACKED_STRUCT struct __attribute__((packed)) 91 #ifndef __PACKED_UNION 92 #define __PACKED_UNION union __attribute__((packed)) 94 #ifndef __UNALIGNED_UINT32 95 struct __attribute__((packed)) T_UINT32 { uint32_t v; };
96 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 98 #ifndef __UNALIGNED_UINT16_WRITE 99 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
100 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val)) 102 #ifndef __UNALIGNED_UINT16_READ 103 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
104 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 106 #ifndef __UNALIGNED_UINT32_WRITE 107 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
108 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 110 #ifndef __UNALIGNED_UINT32_READ 111 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
112 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 115 #define __ALIGNED(x) __attribute__((aligned(x))) 118 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 126 #elif defined ( __TASKING__ ) 137 #define __INLINE inline 139 #ifndef __STATIC_INLINE 140 #define __STATIC_INLINE static inline 142 #ifndef __STATIC_FORCEINLINE 143 #define __STATIC_FORCEINLINE __STATIC_INLINE 146 #define __NO_RETURN __attribute__((noreturn)) 149 #define __USED __attribute__((used)) 152 #define __WEAK __attribute__((weak)) 155 #define __PACKED __packed__ 157 #ifndef __PACKED_STRUCT 158 #define __PACKED_STRUCT struct __packed__ 160 #ifndef __PACKED_UNION 161 #define __PACKED_UNION union __packed__ 163 #ifndef __UNALIGNED_UINT32 164 struct __packed__ T_UINT32 { uint32_t v; };
165 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 167 #ifndef __UNALIGNED_UINT16_WRITE 168 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
169 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) 171 #ifndef __UNALIGNED_UINT16_READ 172 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
173 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 175 #ifndef __UNALIGNED_UINT32_WRITE 176 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
177 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 179 #ifndef __UNALIGNED_UINT32_READ 180 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
181 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 184 #define __ALIGNED(x) __align(x) 187 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 195 #elif defined ( __CSMC__ ) 196 #include <cmsis_csm.h> 202 #define __INLINE inline 204 #ifndef __STATIC_INLINE 205 #define __STATIC_INLINE static inline 207 #ifndef __STATIC_FORCEINLINE 208 #define __STATIC_FORCEINLINE __STATIC_INLINE 215 #warning No compiler specific solution for __USED. __USED is ignored. 219 #define __WEAK __weak 222 #define __PACKED @packed 224 #ifndef __PACKED_STRUCT 225 #define __PACKED_STRUCT @packed struct 227 #ifndef __PACKED_UNION 228 #define __PACKED_UNION @packed union 230 #ifndef __UNALIGNED_UINT32 231 @packed
struct T_UINT32 { uint32_t v; };
232 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v) 234 #ifndef __UNALIGNED_UINT16_WRITE 235 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
236 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val)) 238 #ifndef __UNALIGNED_UINT16_READ 239 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
240 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v) 242 #ifndef __UNALIGNED_UINT32_WRITE 243 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
244 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val)) 246 #ifndef __UNALIGNED_UINT32_READ 247 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
248 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v) 251 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored. 255 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored. 261 #error Unknown compiler. CMSIS compiler GCC header file.
CMSIS compiler ARMCC (Arm Compiler 5) header file.
CMSIS compiler ICCARM (IAR Compiler for Arm) header file.
CMSIS compiler armclang (Arm Compiler 6) header file.