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:
Wed Jan 17 16:13:02 2018 +0000
Revision:
160:5571c4ff569f
Parent:
156:ff21514d8981
mbed library. Release version 158

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
AnnaBridge 156:ff21514d8981 4 * @version V5.0.2
AnnaBridge 156:ff21514d8981 5 * @date 13. February 2017
AnnaBridge 156:ff21514d8981 6 ******************************************************************************/
AnnaBridge 156:ff21514d8981 7 /*
AnnaBridge 156:ff21514d8981 8 * Copyright (c) 2009-2017 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 /*
AnnaBridge 156:ff21514d8981 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 /*
AnnaBridge 156:ff21514d8981 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 160:5571c4ff569f 57
AnnaBridge 156:ff21514d8981 58 /*
AnnaBridge 156:ff21514d8981 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
AnnaBridge 156:ff21514d8981 73 #ifndef __NO_RETURN
AnnaBridge 156:ff21514d8981 74 #define __NO_RETURN __attribute__((noreturn))
AnnaBridge 156:ff21514d8981 75 #endif
AnnaBridge 156:ff21514d8981 76 #ifndef __USED
AnnaBridge 156:ff21514d8981 77 #define __USED __attribute__((used))
AnnaBridge 156:ff21514d8981 78 #endif
AnnaBridge 156:ff21514d8981 79 #ifndef __WEAK
AnnaBridge 156:ff21514d8981 80 #define __WEAK __attribute__((weak))
AnnaBridge 156:ff21514d8981 81 #endif
AnnaBridge 156:ff21514d8981 82 #ifndef __PACKED
AnnaBridge 156:ff21514d8981 83 #define __PACKED __attribute__((packed))
AnnaBridge 156:ff21514d8981 84 #endif
AnnaBridge 156:ff21514d8981 85 #ifndef __PACKED_STRUCT
AnnaBridge 156:ff21514d8981 86 #define __PACKED_STRUCT struct __attribute__((packed))
AnnaBridge 156:ff21514d8981 87 #endif
Anna Bridge 160:5571c4ff569f 88 #ifndef __PACKED_UNION
Anna Bridge 160:5571c4ff569f 89 #define __PACKED_UNION union __attribute__((packed))
Anna Bridge 160:5571c4ff569f 90 #endif
AnnaBridge 156:ff21514d8981 91 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 156:ff21514d8981 92 struct __attribute__((packed)) T_UINT32 { uint32_t v; };
AnnaBridge 156:ff21514d8981 93 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
AnnaBridge 156:ff21514d8981 94 #endif
AnnaBridge 156:ff21514d8981 95 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 156:ff21514d8981 96 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
AnnaBridge 156:ff21514d8981 97 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void*)(addr))->v) = (val))
AnnaBridge 156:ff21514d8981 98 #endif
AnnaBridge 156:ff21514d8981 99 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 156:ff21514d8981 100 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
AnnaBridge 156:ff21514d8981 101 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
AnnaBridge 156:ff21514d8981 102 #endif
AnnaBridge 156:ff21514d8981 103 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 156:ff21514d8981 104 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
AnnaBridge 156:ff21514d8981 105 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 156:ff21514d8981 106 #endif
AnnaBridge 156:ff21514d8981 107 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 156:ff21514d8981 108 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
AnnaBridge 156:ff21514d8981 109 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
AnnaBridge 156:ff21514d8981 110 #endif
AnnaBridge 156:ff21514d8981 111 #ifndef __ALIGNED
AnnaBridge 156:ff21514d8981 112 #define __ALIGNED(x) __attribute__((aligned(x)))
AnnaBridge 156:ff21514d8981 113 #endif
Anna Bridge 160:5571c4ff569f 114 #ifndef __RESTRICT
Anna Bridge 160:5571c4ff569f 115 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
Anna Bridge 160:5571c4ff569f 116 #define __RESTRICT
Anna Bridge 160:5571c4ff569f 117 #endif
AnnaBridge 156:ff21514d8981 118
AnnaBridge 156:ff21514d8981 119
AnnaBridge 156:ff21514d8981 120 /*
AnnaBridge 156:ff21514d8981 121 * TASKING Compiler
AnnaBridge 156:ff21514d8981 122 */
AnnaBridge 156:ff21514d8981 123 #elif defined ( __TASKING__ )
AnnaBridge 156:ff21514d8981 124 /*
AnnaBridge 156:ff21514d8981 125 * The CMSIS functions have been implemented as intrinsics in the compiler.
AnnaBridge 156:ff21514d8981 126 * Please use "carm -?i" to get an up to date list of all intrinsics,
AnnaBridge 156:ff21514d8981 127 * Including the CMSIS ones.
AnnaBridge 156:ff21514d8981 128 */
AnnaBridge 156:ff21514d8981 129
AnnaBridge 156:ff21514d8981 130 #ifndef __ASM
AnnaBridge 156:ff21514d8981 131 #define __ASM __asm
AnnaBridge 156:ff21514d8981 132 #endif
AnnaBridge 156:ff21514d8981 133 #ifndef __INLINE
AnnaBridge 156:ff21514d8981 134 #define __INLINE inline
AnnaBridge 156:ff21514d8981 135 #endif
AnnaBridge 156:ff21514d8981 136 #ifndef __STATIC_INLINE
AnnaBridge 156:ff21514d8981 137 #define __STATIC_INLINE static inline
AnnaBridge 156:ff21514d8981 138 #endif
AnnaBridge 156:ff21514d8981 139 #ifndef __NO_RETURN
AnnaBridge 156:ff21514d8981 140 #define __NO_RETURN __attribute__((noreturn))
AnnaBridge 156:ff21514d8981 141 #endif
AnnaBridge 156:ff21514d8981 142 #ifndef __USED
AnnaBridge 156:ff21514d8981 143 #define __USED __attribute__((used))
AnnaBridge 156:ff21514d8981 144 #endif
AnnaBridge 156:ff21514d8981 145 #ifndef __WEAK
AnnaBridge 156:ff21514d8981 146 #define __WEAK __attribute__((weak))
AnnaBridge 156:ff21514d8981 147 #endif
AnnaBridge 156:ff21514d8981 148 #ifndef __PACKED
AnnaBridge 156:ff21514d8981 149 #define __PACKED __packed__
AnnaBridge 156:ff21514d8981 150 #endif
AnnaBridge 156:ff21514d8981 151 #ifndef __PACKED_STRUCT
AnnaBridge 156:ff21514d8981 152 #define __PACKED_STRUCT struct __packed__
AnnaBridge 156:ff21514d8981 153 #endif
Anna Bridge 160:5571c4ff569f 154 #ifndef __PACKED_UNION
Anna Bridge 160:5571c4ff569f 155 #define __PACKED_UNION union __packed__
Anna Bridge 160:5571c4ff569f 156 #endif
AnnaBridge 156:ff21514d8981 157 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 156:ff21514d8981 158 struct __packed__ T_UINT32 { uint32_t v; };
AnnaBridge 156:ff21514d8981 159 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
AnnaBridge 156:ff21514d8981 160 #endif
AnnaBridge 156:ff21514d8981 161 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 156:ff21514d8981 162 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
AnnaBridge 156:ff21514d8981 163 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 156:ff21514d8981 164 #endif
AnnaBridge 156:ff21514d8981 165 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 156:ff21514d8981 166 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
AnnaBridge 156:ff21514d8981 167 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
AnnaBridge 156:ff21514d8981 168 #endif
AnnaBridge 156:ff21514d8981 169 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 156:ff21514d8981 170 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
AnnaBridge 156:ff21514d8981 171 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 156:ff21514d8981 172 #endif
AnnaBridge 156:ff21514d8981 173 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 156:ff21514d8981 174 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
AnnaBridge 156:ff21514d8981 175 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
AnnaBridge 156:ff21514d8981 176 #endif
AnnaBridge 156:ff21514d8981 177 #ifndef __ALIGNED
AnnaBridge 156:ff21514d8981 178 #define __ALIGNED(x) __align(x)
AnnaBridge 156:ff21514d8981 179 #endif
Anna Bridge 160:5571c4ff569f 180 #ifndef __RESTRICT
Anna Bridge 160:5571c4ff569f 181 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
Anna Bridge 160:5571c4ff569f 182 #define __RESTRICT
Anna Bridge 160:5571c4ff569f 183 #endif
AnnaBridge 156:ff21514d8981 184
AnnaBridge 156:ff21514d8981 185
AnnaBridge 156:ff21514d8981 186 /*
AnnaBridge 156:ff21514d8981 187 * COSMIC Compiler
AnnaBridge 156:ff21514d8981 188 */
AnnaBridge 156:ff21514d8981 189 #elif defined ( __CSMC__ )
AnnaBridge 156:ff21514d8981 190 #include <cmsis_csm.h>
AnnaBridge 156:ff21514d8981 191
AnnaBridge 156:ff21514d8981 192 #ifndef __ASM
AnnaBridge 156:ff21514d8981 193 #define __ASM _asm
AnnaBridge 156:ff21514d8981 194 #endif
AnnaBridge 156:ff21514d8981 195 #ifndef __INLINE
AnnaBridge 156:ff21514d8981 196 #define __INLINE inline
AnnaBridge 156:ff21514d8981 197 #endif
AnnaBridge 156:ff21514d8981 198 #ifndef __STATIC_INLINE
AnnaBridge 156:ff21514d8981 199 #define __STATIC_INLINE static inline
AnnaBridge 156:ff21514d8981 200 #endif
AnnaBridge 156:ff21514d8981 201 #ifndef __NO_RETURN
AnnaBridge 156:ff21514d8981 202 // NO RETURN is automatically detected hence no warning here
AnnaBridge 156:ff21514d8981 203 #define __NO_RETURN
AnnaBridge 156:ff21514d8981 204 #endif
AnnaBridge 156:ff21514d8981 205 #ifndef __USED
AnnaBridge 156:ff21514d8981 206 #warning No compiler specific solution for __USED. __USED is ignored.
AnnaBridge 156:ff21514d8981 207 #define __USED
AnnaBridge 156:ff21514d8981 208 #endif
AnnaBridge 156:ff21514d8981 209 #ifndef __WEAK
AnnaBridge 156:ff21514d8981 210 #define __WEAK __weak
AnnaBridge 156:ff21514d8981 211 #endif
AnnaBridge 156:ff21514d8981 212 #ifndef __PACKED
AnnaBridge 156:ff21514d8981 213 #define __PACKED @packed
AnnaBridge 156:ff21514d8981 214 #endif
AnnaBridge 156:ff21514d8981 215 #ifndef __PACKED_STRUCT
AnnaBridge 156:ff21514d8981 216 #define __PACKED_STRUCT @packed struct
AnnaBridge 156:ff21514d8981 217 #endif
Anna Bridge 160:5571c4ff569f 218 #ifndef __PACKED_UNION
Anna Bridge 160:5571c4ff569f 219 #define __PACKED_UNION @packed union
Anna Bridge 160:5571c4ff569f 220 #endif
AnnaBridge 156:ff21514d8981 221 #ifndef __UNALIGNED_UINT32 /* deprecated */
AnnaBridge 156:ff21514d8981 222 @packed struct T_UINT32 { uint32_t v; };
AnnaBridge 156:ff21514d8981 223 #define __UNALIGNED_UINT32(x) (((struct T_UINT32 *)(x))->v)
AnnaBridge 156:ff21514d8981 224 #endif
AnnaBridge 156:ff21514d8981 225 #ifndef __UNALIGNED_UINT16_WRITE
AnnaBridge 156:ff21514d8981 226 __PACKED_STRUCT T_UINT16_WRITE { uint16_t v; };
AnnaBridge 156:ff21514d8981 227 #define __UNALIGNED_UINT16_WRITE(addr, val) (void)((((struct T_UINT16_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 156:ff21514d8981 228 #endif
AnnaBridge 156:ff21514d8981 229 #ifndef __UNALIGNED_UINT16_READ
AnnaBridge 156:ff21514d8981 230 __PACKED_STRUCT T_UINT16_READ { uint16_t v; };
AnnaBridge 156:ff21514d8981 231 #define __UNALIGNED_UINT16_READ(addr) (((const struct T_UINT16_READ *)(const void *)(addr))->v)
AnnaBridge 156:ff21514d8981 232 #endif
AnnaBridge 156:ff21514d8981 233 #ifndef __UNALIGNED_UINT32_WRITE
AnnaBridge 156:ff21514d8981 234 __PACKED_STRUCT T_UINT32_WRITE { uint32_t v; };
AnnaBridge 156:ff21514d8981 235 #define __UNALIGNED_UINT32_WRITE(addr, val) (void)((((struct T_UINT32_WRITE *)(void *)(addr))->v) = (val))
AnnaBridge 156:ff21514d8981 236 #endif
AnnaBridge 156:ff21514d8981 237 #ifndef __UNALIGNED_UINT32_READ
AnnaBridge 156:ff21514d8981 238 __PACKED_STRUCT T_UINT32_READ { uint32_t v; };
AnnaBridge 156:ff21514d8981 239 #define __UNALIGNED_UINT32_READ(addr) (((const struct T_UINT32_READ *)(const void *)(addr))->v)
AnnaBridge 156:ff21514d8981 240 #endif
AnnaBridge 156:ff21514d8981 241 #ifndef __ALIGNED
AnnaBridge 156:ff21514d8981 242 #warning No compiler specific solution for __ALIGNED. __ALIGNED is ignored.
AnnaBridge 156:ff21514d8981 243 #define __ALIGNED(x)
AnnaBridge 156:ff21514d8981 244 #endif
Anna Bridge 160:5571c4ff569f 245 #ifndef __RESTRICT
Anna Bridge 160:5571c4ff569f 246 #warning No compiler specific solution for __RESTRICT. __RESTRICT is ignored.
Anna Bridge 160:5571c4ff569f 247 #define __RESTRICT
Anna Bridge 160:5571c4ff569f 248 #endif
AnnaBridge 156:ff21514d8981 249
AnnaBridge 156:ff21514d8981 250
AnnaBridge 156:ff21514d8981 251 #else
AnnaBridge 156:ff21514d8981 252 #error Unknown compiler.
AnnaBridge 156:ff21514d8981 253 #endif
AnnaBridge 156:ff21514d8981 254
AnnaBridge 156:ff21514d8981 255
AnnaBridge 156:ff21514d8981 256 #endif /* __CMSIS_COMPILER_H */
AnnaBridge 156:ff21514d8981 257