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:
AnnaBridge
Date:
Fri Feb 16 16:16:41 2018 +0000
Revision:
161:aa5281ff4a02
Child:
169:a7c7b631e539
mbed library. Release version 159.

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