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:
160:5571c4ff569f
mbed library. Release version 162

Who changed what in which revision?

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