The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.

Dependents:   hello SerialTestv11 SerialTestv12 Sierpinski ... more

mbed 2

This is the mbed 2 library. If you'd like to learn about Mbed OS please see the mbed-os docs.

Committer:
Anna Bridge
Date:
Fri Jun 22 15:38:59 2018 +0100
Revision:
169:a7c7b631e539
Parent:
161:aa5281ff4a02
mbed library. Release version 162

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AnnaBridge 161:aa5281ff4a02 1 /**************************************************************************//**
AnnaBridge 161:aa5281ff4a02 2 * @file cmsis_compiler.h
AnnaBridge 161:aa5281ff4a02 3 * @brief CMSIS compiler generic header file
Anna Bridge 169:a7c7b631e539 4 * @version V5.0.4
Anna Bridge 169:a7c7b631e539 5 * @date 10. January 2018
AnnaBridge 161:aa5281ff4a02 6 ******************************************************************************/
AnnaBridge 161:aa5281ff4a02 7 /*
Anna Bridge 169:a7c7b631e539 8 * Copyright (c) 2009-2018 Arm Limited. All rights reserved.
AnnaBridge 161:aa5281ff4a02 9 *
AnnaBridge 161:aa5281ff4a02 10 * SPDX-License-Identifier: Apache-2.0
AnnaBridge 161:aa5281ff4a02 11 *
AnnaBridge 161:aa5281ff4a02 12 * Licensed under the Apache License, Version 2.0 (the License); you may
AnnaBridge 161:aa5281ff4a02 13 * not use this file except in compliance with the License.
AnnaBridge 161:aa5281ff4a02 14 * You may obtain a copy of the License at
AnnaBridge 161:aa5281ff4a02 15 *
AnnaBridge 161:aa5281ff4a02 16 * www.apache.org/licenses/LICENSE-2.0
AnnaBridge 161:aa5281ff4a02 17 *
AnnaBridge 161:aa5281ff4a02 18 * Unless required by applicable law or agreed to in writing, software
AnnaBridge 161:aa5281ff4a02 19 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
AnnaBridge 161:aa5281ff4a02 20 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AnnaBridge 161:aa5281ff4a02 21 * See the License for the specific language governing permissions and
AnnaBridge 161:aa5281ff4a02 22 * limitations under the License.
AnnaBridge 161:aa5281ff4a02 23 */
AnnaBridge 161:aa5281ff4a02 24
AnnaBridge 161:aa5281ff4a02 25 #ifndef __CMSIS_COMPILER_H
AnnaBridge 161:aa5281ff4a02 26 #define __CMSIS_COMPILER_H
AnnaBridge 161:aa5281ff4a02 27
AnnaBridge 161:aa5281ff4a02 28 #include <stdint.h>
AnnaBridge 161:aa5281ff4a02 29
AnnaBridge 161:aa5281ff4a02 30 /*
Anna Bridge 169:a7c7b631e539 31 * Arm Compiler 4/5
AnnaBridge 161:aa5281ff4a02 32 */
AnnaBridge 161:aa5281ff4a02 33 #if defined ( __CC_ARM )
AnnaBridge 161:aa5281ff4a02 34 #include "cmsis_armcc.h"
AnnaBridge 161:aa5281ff4a02 35
AnnaBridge 161:aa5281ff4a02 36
AnnaBridge 161:aa5281ff4a02 37 /*
Anna Bridge 169:a7c7b631e539 38 * Arm Compiler 6 (armclang)
AnnaBridge 161:aa5281ff4a02 39 */
AnnaBridge 161:aa5281ff4a02 40 #elif defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
AnnaBridge 161:aa5281ff4a02 41 #include "cmsis_armclang.h"
AnnaBridge 161:aa5281ff4a02 42
AnnaBridge 161:aa5281ff4a02 43
AnnaBridge 161:aa5281ff4a02 44 /*
AnnaBridge 161:aa5281ff4a02 45 * GNU Compiler
AnnaBridge 161:aa5281ff4a02 46 */
AnnaBridge 161:aa5281ff4a02 47 #elif defined ( __GNUC__ )
AnnaBridge 161:aa5281ff4a02 48 #include "cmsis_gcc.h"
AnnaBridge 161:aa5281ff4a02 49
AnnaBridge 161:aa5281ff4a02 50
AnnaBridge 161:aa5281ff4a02 51 /*
AnnaBridge 161:aa5281ff4a02 52 * IAR Compiler
AnnaBridge 161:aa5281ff4a02 53 */
AnnaBridge 161:aa5281ff4a02 54 #elif defined ( __ICCARM__ )
AnnaBridge 161:aa5281ff4a02 55 #include <cmsis_iccarm.h>
AnnaBridge 161:aa5281ff4a02 56
Anna Bridge 169:a7c7b631e539 57
AnnaBridge 161:aa5281ff4a02 58 /*
Anna Bridge 169:a7c7b631e539 59 * TI Arm Compiler
AnnaBridge 161:aa5281ff4a02 60 */
AnnaBridge 161:aa5281ff4a02 61 #elif defined ( __TI_ARM__ )
AnnaBridge 161:aa5281ff4a02 62 #include <cmsis_ccs.h>
AnnaBridge 161:aa5281ff4a02 63
AnnaBridge 161:aa5281ff4a02 64 #ifndef __ASM
AnnaBridge 161:aa5281ff4a02 65 #define __ASM __asm
AnnaBridge 161:aa5281ff4a02 66 #endif
AnnaBridge 161:aa5281ff4a02 67 #ifndef __INLINE
AnnaBridge 161:aa5281ff4a02 68 #define __INLINE inline
AnnaBridge 161:aa5281ff4a02 69 #endif
AnnaBridge 161:aa5281ff4a02 70 #ifndef __STATIC_INLINE
AnnaBridge 161:aa5281ff4a02 71 #define __STATIC_INLINE static inline
AnnaBridge 161:aa5281ff4a02 72 #endif
Anna Bridge 169:a7c7b631e539 73 #ifndef __STATIC_FORCEINLINE
Anna Bridge 169:a7c7b631e539 74 #define __STATIC_FORCEINLINE __STATIC_INLINE
Anna Bridge 169:a7c7b631e539 75 #endif
AnnaBridge 161:aa5281ff4a02 76 #ifndef __NO_RETURN
AnnaBridge 161:aa5281ff4a02 77 #define __NO_RETURN __attribute__((noreturn))
AnnaBridge 161:aa5281ff4a02 78 #endif
AnnaBridge 161:aa5281ff4a02 79 #ifndef __USED
AnnaBridge 161:aa5281ff4a02 80 #define __USED __attribute__((used))
AnnaBridge 161:aa5281ff4a02 81 #endif
AnnaBridge 161:aa5281ff4a02 82 #ifndef __WEAK
AnnaBridge 161:aa5281ff4a02 83 #define __WEAK __attribute__((weak))
AnnaBridge 161:aa5281ff4a02 84 #endif
AnnaBridge 161:aa5281ff4a02 85 #ifndef __PACKED
AnnaBridge 161:aa5281ff4a02 86 #define __PACKED __attribute__((packed))
AnnaBridge 161:aa5281ff4a02 87 #endif
AnnaBridge 161:aa5281ff4a02 88 #ifndef __PACKED_STRUCT
AnnaBridge 161:aa5281ff4a02 89 #define __PACKED_STRUCT struct __attribute__((packed))
AnnaBridge 161:aa5281ff4a02 90 #endif
AnnaBridge 161:aa5281ff4a02 91 #ifndef __PACKED_UNION
AnnaBridge 161:aa5281ff4a02 92 #define __PACKED_UNION union __attribute__((packed))
AnnaBridge 161:aa5281ff4a02 93 #endif
AnnaBridge 161:aa5281ff4a02 94 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 161:aa5281ff4a02 95 struct __attribute__((packed)) T_UINT32 { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 96 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
AnnaBridge 161:aa5281ff4a02 97 #endif
AnnaBridge 161:aa5281ff4a02 98 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 161:aa5281ff4a02 99 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
AnnaBridge 161:aa5281ff4a02 100 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
AnnaBridge 161:aa5281ff4a02 101 #endif
AnnaBridge 161:aa5281ff4a02 102 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 161:aa5281ff4a02 103 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
AnnaBridge 161:aa5281ff4a02 104 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
AnnaBridge 161:aa5281ff4a02 105 #endif
AnnaBridge 161:aa5281ff4a02 106 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 161:aa5281ff4a02 107 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 108 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 161:aa5281ff4a02 109 #endif
AnnaBridge 161:aa5281ff4a02 110 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 161:aa5281ff4a02 111 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 112 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
AnnaBridge 161:aa5281ff4a02 113 #endif
AnnaBridge 161:aa5281ff4a02 114 #ifndef __ALIGNED
AnnaBridge 161:aa5281ff4a02 115 #define __ALIGNED(x) __attribute__((aligned(x)))
AnnaBridge 161:aa5281ff4a02 116 #endif
AnnaBridge 161:aa5281ff4a02 117 #ifndef __RESTRICT
AnnaBridge 161:aa5281ff4a02 118 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
AnnaBridge 161:aa5281ff4a02 119 #define __RESTRICT
AnnaBridge 161:aa5281ff4a02 120 #endif
AnnaBridge 161:aa5281ff4a02 121
AnnaBridge 161:aa5281ff4a02 122
AnnaBridge 161:aa5281ff4a02 123 /*
AnnaBridge 161:aa5281ff4a02 124 * TASKING Compiler
AnnaBridge 161:aa5281ff4a02 125 */
AnnaBridge 161:aa5281ff4a02 126 #elif defined ( __TASKING__ )
AnnaBridge 161:aa5281ff4a02 127 /*
AnnaBridge 161:aa5281ff4a02 128 * The CMSIS functions have been implemented as intrinsics in the compiler.
AnnaBridge 161:aa5281ff4a02 129 * Please use "carm -?i" to get an up to date list of all intrinsics,
AnnaBridge 161:aa5281ff4a02 130 * Including the CMSIS ones.
AnnaBridge 161:aa5281ff4a02 131 */
AnnaBridge 161:aa5281ff4a02 132
AnnaBridge 161:aa5281ff4a02 133 #ifndef __ASM
AnnaBridge 161:aa5281ff4a02 134 #define __ASM __asm
AnnaBridge 161:aa5281ff4a02 135 #endif
AnnaBridge 161:aa5281ff4a02 136 #ifndef __INLINE
AnnaBridge 161:aa5281ff4a02 137 #define __INLINE inline
AnnaBridge 161:aa5281ff4a02 138 #endif
AnnaBridge 161:aa5281ff4a02 139 #ifndef __STATIC_INLINE
AnnaBridge 161:aa5281ff4a02 140 #define __STATIC_INLINE static inline
AnnaBridge 161:aa5281ff4a02 141 #endif
Anna Bridge 169:a7c7b631e539 142 #ifndef __STATIC_FORCEINLINE
Anna Bridge 169:a7c7b631e539 143 #define __STATIC_FORCEINLINE __STATIC_INLINE
Anna Bridge 169:a7c7b631e539 144 #endif
AnnaBridge 161:aa5281ff4a02 145 #ifndef __NO_RETURN
AnnaBridge 161:aa5281ff4a02 146 #define __NO_RETURN __attribute__((noreturn))
AnnaBridge 161:aa5281ff4a02 147 #endif
AnnaBridge 161:aa5281ff4a02 148 #ifndef __USED
AnnaBridge 161:aa5281ff4a02 149 #define __USED __attribute__((used))
AnnaBridge 161:aa5281ff4a02 150 #endif
AnnaBridge 161:aa5281ff4a02 151 #ifndef __WEAK
AnnaBridge 161:aa5281ff4a02 152 #define __WEAK __attribute__((weak))
AnnaBridge 161:aa5281ff4a02 153 #endif
AnnaBridge 161:aa5281ff4a02 154 #ifndef __PACKED
AnnaBridge 161:aa5281ff4a02 155 #define __PACKED __packed__
AnnaBridge 161:aa5281ff4a02 156 #endif
AnnaBridge 161:aa5281ff4a02 157 #ifndef __PACKED_STRUCT
AnnaBridge 161:aa5281ff4a02 158 #define __PACKED_STRUCT struct __packed__
AnnaBridge 161:aa5281ff4a02 159 #endif
AnnaBridge 161:aa5281ff4a02 160 #ifndef __PACKED_UNION
AnnaBridge 161:aa5281ff4a02 161 #define __PACKED_UNION union __packed__
AnnaBridge 161:aa5281ff4a02 162 #endif
AnnaBridge 161:aa5281ff4a02 163 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 161:aa5281ff4a02 164 struct __packed__ T_UINT32 { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 165 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
AnnaBridge 161:aa5281ff4a02 166 #endif
AnnaBridge 161:aa5281ff4a02 167 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 161:aa5281ff4a02 168 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
AnnaBridge 161:aa5281ff4a02 169 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 161:aa5281ff4a02 170 #endif
AnnaBridge 161:aa5281ff4a02 171 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 161:aa5281ff4a02 172 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
AnnaBridge 161:aa5281ff4a02 173 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
AnnaBridge 161:aa5281ff4a02 174 #endif
AnnaBridge 161:aa5281ff4a02 175 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 161:aa5281ff4a02 176 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 177 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 161:aa5281ff4a02 178 #endif
AnnaBridge 161:aa5281ff4a02 179 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 161:aa5281ff4a02 180 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 181 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
AnnaBridge 161:aa5281ff4a02 182 #endif
AnnaBridge 161:aa5281ff4a02 183 #ifndef __ALIGNED
AnnaBridge 161:aa5281ff4a02 184 #define __ALIGNED(x) __align(x)
AnnaBridge 161:aa5281ff4a02 185 #endif
AnnaBridge 161:aa5281ff4a02 186 #ifndef __RESTRICT
AnnaBridge 161:aa5281ff4a02 187 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
AnnaBridge 161:aa5281ff4a02 188 #define __RESTRICT
AnnaBridge 161:aa5281ff4a02 189 #endif
AnnaBridge 161:aa5281ff4a02 190
AnnaBridge 161:aa5281ff4a02 191
AnnaBridge 161:aa5281ff4a02 192 /*
AnnaBridge 161:aa5281ff4a02 193 * COSMIC Compiler
AnnaBridge 161:aa5281ff4a02 194 */
AnnaBridge 161:aa5281ff4a02 195 #elif defined ( __CSMC__ )
AnnaBridge 161:aa5281ff4a02 196 #include <cmsis_csm.h>
AnnaBridge 161:aa5281ff4a02 197
AnnaBridge 161:aa5281ff4a02 198 #ifndef __ASM
AnnaBridge 161:aa5281ff4a02 199 #define __ASM _asm
AnnaBridge 161:aa5281ff4a02 200 #endif
AnnaBridge 161:aa5281ff4a02 201 #ifndef __INLINE
AnnaBridge 161:aa5281ff4a02 202 #define __INLINE inline
AnnaBridge 161:aa5281ff4a02 203 #endif
AnnaBridge 161:aa5281ff4a02 204 #ifndef __STATIC_INLINE
AnnaBridge 161:aa5281ff4a02 205 #define __STATIC_INLINE static inline
AnnaBridge 161:aa5281ff4a02 206 #endif
Anna Bridge 169:a7c7b631e539 207 #ifndef __STATIC_FORCEINLINE
Anna Bridge 169:a7c7b631e539 208 #define __STATIC_FORCEINLINE __STATIC_INLINE
Anna Bridge 169:a7c7b631e539 209 #endif
AnnaBridge 161:aa5281ff4a02 210 #ifndef __NO_RETURN
AnnaBridge 161:aa5281ff4a02 211 // NO RETURN is automatically detected hence no warning here
AnnaBridge 161:aa5281ff4a02 212 #define __NO_RETURN
AnnaBridge 161:aa5281ff4a02 213 #endif
AnnaBridge 161:aa5281ff4a02 214 #ifndef __USED
AnnaBridge 161:aa5281ff4a02 215 #warning No compiler specific solution for __USED. __USED is ignored.
AnnaBridge 161:aa5281ff4a02 216 #define __USED
AnnaBridge 161:aa5281ff4a02 217 #endif
AnnaBridge 161:aa5281ff4a02 218 #ifndef __WEAK
AnnaBridge 161:aa5281ff4a02 219 #define __WEAK __weak
AnnaBridge 161:aa5281ff4a02 220 #endif
AnnaBridge 161:aa5281ff4a02 221 #ifndef __PACKED
AnnaBridge 161:aa5281ff4a02 222 #define __PACKED @packed
AnnaBridge 161:aa5281ff4a02 223 #endif
AnnaBridge 161:aa5281ff4a02 224 #ifndef __PACKED_STRUCT
AnnaBridge 161:aa5281ff4a02 225 #define __PACKED_STRUCT @packed struct
AnnaBridge 161:aa5281ff4a02 226 #endif
AnnaBridge 161:aa5281ff4a02 227 #ifndef __PACKED_UNION
AnnaBridge 161:aa5281ff4a02 228 #define __PACKED_UNION @packed union
AnnaBridge 161:aa5281ff4a02 229 #endif
AnnaBridge 161:aa5281ff4a02 230 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 161:aa5281ff4a02 231 @packed struct T_UINT32 { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 232 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
AnnaBridge 161:aa5281ff4a02 233 #endif
AnnaBridge 161:aa5281ff4a02 234 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 161:aa5281ff4a02 235 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
AnnaBridge 161:aa5281ff4a02 236 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 161:aa5281ff4a02 237 #endif
AnnaBridge 161:aa5281ff4a02 238 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 161:aa5281ff4a02 239 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
AnnaBridge 161:aa5281ff4a02 240 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
AnnaBridge 161:aa5281ff4a02 241 #endif
AnnaBridge 161:aa5281ff4a02 242 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 161:aa5281ff4a02 243 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 244 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 161:aa5281ff4a02 245 #endif
AnnaBridge 161:aa5281ff4a02 246 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 161:aa5281ff4a02 247 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
AnnaBridge 161:aa5281ff4a02 248 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
AnnaBridge 161:aa5281ff4a02 249 #endif
AnnaBridge 161:aa5281ff4a02 250 #ifndef __ALIGNED
AnnaBridge 161:aa5281ff4a02 251 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
AnnaBridge 161:aa5281ff4a02 252 #define __ALIGNED(x)
AnnaBridge 161:aa5281ff4a02 253 #endif
AnnaBridge 161:aa5281ff4a02 254 #ifndef __RESTRICT
AnnaBridge 161:aa5281ff4a02 255 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
AnnaBridge 161:aa5281ff4a02 256 #define __RESTRICT
AnnaBridge 161:aa5281ff4a02 257 #endif
AnnaBridge 161:aa5281ff4a02 258
AnnaBridge 161:aa5281ff4a02 259
AnnaBridge 161:aa5281ff4a02 260 #else
AnnaBridge 161:aa5281ff4a02 261 #error Unknown compiler.
AnnaBridge 161:aa5281ff4a02 262 #endif
AnnaBridge 161:aa5281ff4a02 263
AnnaBridge 161:aa5281ff4a02 264
AnnaBridge 161:aa5281ff4a02 265 #endif /* __CMSIS_COMPILER_H */
AnnaBridge 161:aa5281ff4a02 266