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