mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Committer:
AnnaBridge
Date:
Fri Feb 16 16:09:33 2018 +0000
Revision:
181:57724642e740
Parent:
180:96ed750bd169
Child:
184:08ed48f1de7f
mbed-dev library. Release version 159.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
<> 160:d5399cc887bb 1
<> 160:d5399cc887bb 2 /** \addtogroup platform */
<> 160:d5399cc887bb 3 /** @{*/
AnnaBridge 178:79309dc6340a 4 /**
AnnaBridge 178:79309dc6340a 5 * \defgroup platform_toolchain Toolchain functions
AnnaBridge 178:79309dc6340a 6 * @{
AnnaBridge 178:79309dc6340a 7 */
Anna Bridge 180:96ed750bd169 8
<> 160:d5399cc887bb 9 /* mbed Microcontroller Library
<> 160:d5399cc887bb 10 * Copyright (c) 2006-2013 ARM Limited
<> 160:d5399cc887bb 11 *
<> 160:d5399cc887bb 12 * Licensed under the Apache License, Version 2.0 (the "License");
<> 160:d5399cc887bb 13 * you may not use this file except in compliance with the License.
<> 160:d5399cc887bb 14 * You may obtain a copy of the License at
<> 160:d5399cc887bb 15 *
<> 160:d5399cc887bb 16 * http://www.apache.org/licenses/LICENSE-2.0
<> 160:d5399cc887bb 17 *
<> 160:d5399cc887bb 18 * Unless required by applicable law or agreed to in writing, software
<> 160:d5399cc887bb 19 * distributed under the License is distributed on an "AS IS" BASIS,
<> 160:d5399cc887bb 20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
<> 160:d5399cc887bb 21 * See the License for the specific language governing permissions and
<> 160:d5399cc887bb 22 * limitations under the License.
<> 160:d5399cc887bb 23 */
<> 160:d5399cc887bb 24 #ifndef MBED_TOOLCHAIN_H
<> 160:d5399cc887bb 25 #define MBED_TOOLCHAIN_H
<> 160:d5399cc887bb 26
<> 160:d5399cc887bb 27 #include "mbed_preprocessor.h"
<> 160:d5399cc887bb 28
<> 160:d5399cc887bb 29
<> 160:d5399cc887bb 30 // Warning for unsupported compilers
<> 160:d5399cc887bb 31 #if !defined(__GNUC__) /* GCC */ \
<> 160:d5399cc887bb 32 && !defined(__CC_ARM) /* ARMCC */ \
<> 160:d5399cc887bb 33 && !defined(__clang__) /* LLVM/Clang */ \
<> 160:d5399cc887bb 34 && !defined(__ICCARM__) /* IAR */
<> 160:d5399cc887bb 35 #warning "This compiler is not yet supported."
<> 160:d5399cc887bb 36 #endif
<> 160:d5399cc887bb 37
<> 160:d5399cc887bb 38
<> 160:d5399cc887bb 39 // Attributes
<> 160:d5399cc887bb 40
<> 160:d5399cc887bb 41 /** MBED_PACKED
<> 160:d5399cc887bb 42 * Pack a structure, preventing any padding from being added between fields.
<> 160:d5399cc887bb 43 *
<> 160:d5399cc887bb 44 * @code
<> 160:d5399cc887bb 45 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 46 *
<> 160:d5399cc887bb 47 * MBED_PACKED(struct) foo {
<> 160:d5399cc887bb 48 * char x;
<> 160:d5399cc887bb 49 * int y;
<> 160:d5399cc887bb 50 * };
<> 160:d5399cc887bb 51 * @endcode
<> 160:d5399cc887bb 52 */
<> 160:d5399cc887bb 53 #ifndef MBED_PACKED
<> 160:d5399cc887bb 54 #if defined(__ICCARM__)
<> 160:d5399cc887bb 55 #define MBED_PACKED(struct) __packed struct
<> 160:d5399cc887bb 56 #else
<> 160:d5399cc887bb 57 #define MBED_PACKED(struct) struct __attribute__((packed))
<> 160:d5399cc887bb 58 #endif
<> 160:d5399cc887bb 59 #endif
<> 160:d5399cc887bb 60
<> 160:d5399cc887bb 61 /** MBED_ALIGN(N)
<> 160:d5399cc887bb 62 * Declare a variable to be aligned on an N-byte boundary.
<> 160:d5399cc887bb 63 *
<> 160:d5399cc887bb 64 * @note
<> 160:d5399cc887bb 65 * IAR does not support alignment greater than word size on the stack
Anna Bridge 180:96ed750bd169 66 *
<> 160:d5399cc887bb 67 * @code
<> 160:d5399cc887bb 68 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 69 *
<> 160:d5399cc887bb 70 * MBED_ALIGN(16) char a;
<> 160:d5399cc887bb 71 * @endcode
<> 160:d5399cc887bb 72 */
<> 160:d5399cc887bb 73 #ifndef MBED_ALIGN
<> 160:d5399cc887bb 74 #if defined(__ICCARM__)
<> 160:d5399cc887bb 75 #define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N))
<> 160:d5399cc887bb 76 #else
<> 160:d5399cc887bb 77 #define MBED_ALIGN(N) __attribute__((aligned(N)))
<> 160:d5399cc887bb 78 #endif
<> 160:d5399cc887bb 79 #endif
<> 160:d5399cc887bb 80
<> 160:d5399cc887bb 81 /** MBED_UNUSED
<> 160:d5399cc887bb 82 * Declare a function argument to be unused, suppressing compiler warnings
<> 160:d5399cc887bb 83 *
<> 160:d5399cc887bb 84 * @code
<> 160:d5399cc887bb 85 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 86 *
<> 160:d5399cc887bb 87 * void foo(MBED_UNUSED int arg) {
<> 160:d5399cc887bb 88 *
<> 160:d5399cc887bb 89 * }
<> 160:d5399cc887bb 90 * @endcode
<> 160:d5399cc887bb 91 */
<> 160:d5399cc887bb 92 #ifndef MBED_UNUSED
<> 160:d5399cc887bb 93 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 160:d5399cc887bb 94 #define MBED_UNUSED __attribute__((__unused__))
<> 160:d5399cc887bb 95 #else
<> 160:d5399cc887bb 96 #define MBED_UNUSED
<> 160:d5399cc887bb 97 #endif
<> 160:d5399cc887bb 98 #endif
<> 160:d5399cc887bb 99
AnnaBridge 176:447f873cad2f 100 /** MBED_USED
AnnaBridge 176:447f873cad2f 101 * Inform the compiler that a static variable is to be retained in the object file, even if it is unreferenced.
AnnaBridge 176:447f873cad2f 102 *
AnnaBridge 176:447f873cad2f 103 * @code
AnnaBridge 176:447f873cad2f 104 * #include "mbed_toolchain.h"
AnnaBridge 176:447f873cad2f 105 *
AnnaBridge 176:447f873cad2f 106 * MBED_USED int foo;
AnnaBridge 176:447f873cad2f 107 *
AnnaBridge 176:447f873cad2f 108 * @endcode
AnnaBridge 176:447f873cad2f 109 */
AnnaBridge 176:447f873cad2f 110 #ifndef MBED_USED
AnnaBridge 176:447f873cad2f 111 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
AnnaBridge 176:447f873cad2f 112 #define MBED_USED __attribute__((used))
AnnaBridge 176:447f873cad2f 113 #elif defined(__ICCARM__)
AnnaBridge 176:447f873cad2f 114 #define MBED_USED __root
AnnaBridge 176:447f873cad2f 115 #else
AnnaBridge 176:447f873cad2f 116 #define MBED_USED
AnnaBridge 176:447f873cad2f 117 #endif
AnnaBridge 176:447f873cad2f 118 #endif
AnnaBridge 176:447f873cad2f 119
<> 160:d5399cc887bb 120 /** MBED_WEAK
<> 160:d5399cc887bb 121 * Mark a function as being weak.
Kojto 170:19eb464bc2be 122 *
Kojto 170:19eb464bc2be 123 * @note
Kojto 170:19eb464bc2be 124 * Functions should only be marked as weak in the source file. The header file
Kojto 170:19eb464bc2be 125 * should contain a regular function declaration to insure the function is emitted.
Kojto 170:19eb464bc2be 126 * A function marked weak will not be emitted if an alternative non-weak
Kojto 170:19eb464bc2be 127 * implementation is defined.
Anna Bridge 180:96ed750bd169 128 *
<> 160:d5399cc887bb 129 * @note
Kojto 170:19eb464bc2be 130 * Weak functions are not friendly to making code re-usable, as they can only
<> 160:d5399cc887bb 131 * be overridden once (and if they are multiply overridden the linker will emit
<> 160:d5399cc887bb 132 * no warning). You should not normally use weak symbols as part of the API to
<> 160:d5399cc887bb 133 * re-usable modules.
Anna Bridge 180:96ed750bd169 134 *
<> 160:d5399cc887bb 135 * @code
<> 160:d5399cc887bb 136 * #include "mbed_toolchain.h"
Anna Bridge 180:96ed750bd169 137 *
<> 160:d5399cc887bb 138 * MBED_WEAK void foo() {
<> 160:d5399cc887bb 139 * // a weak implementation of foo that can be overriden by a definition
<> 160:d5399cc887bb 140 * // without __weak
<> 160:d5399cc887bb 141 * }
<> 160:d5399cc887bb 142 * @endcode
<> 160:d5399cc887bb 143 */
<> 160:d5399cc887bb 144 #ifndef MBED_WEAK
<> 160:d5399cc887bb 145 #if defined(__ICCARM__)
<> 160:d5399cc887bb 146 #define MBED_WEAK __weak
<> 160:d5399cc887bb 147 #else
<> 160:d5399cc887bb 148 #define MBED_WEAK __attribute__((weak))
<> 160:d5399cc887bb 149 #endif
<> 160:d5399cc887bb 150 #endif
<> 160:d5399cc887bb 151
<> 160:d5399cc887bb 152 /** MBED_PURE
<> 160:d5399cc887bb 153 * Hint to the compiler that a function depends only on parameters
<> 160:d5399cc887bb 154 *
<> 160:d5399cc887bb 155 * @code
<> 160:d5399cc887bb 156 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 157 *
<> 160:d5399cc887bb 158 * MBED_PURE int foo(int arg){
<> 160:d5399cc887bb 159 * // no access to global variables
<> 160:d5399cc887bb 160 * }
<> 160:d5399cc887bb 161 * @endcode
<> 160:d5399cc887bb 162 */
<> 160:d5399cc887bb 163 #ifndef MBED_PURE
<> 160:d5399cc887bb 164 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 160:d5399cc887bb 165 #define MBED_PURE __attribute__((const))
<> 160:d5399cc887bb 166 #else
<> 160:d5399cc887bb 167 #define MBED_PURE
<> 160:d5399cc887bb 168 #endif
<> 160:d5399cc887bb 169 #endif
<> 160:d5399cc887bb 170
Kojto 169:e3b6fe271b81 171 /** MBED_NOINLINE
Kojto 169:e3b6fe271b81 172 * Declare a function that must not be inlined.
Kojto 169:e3b6fe271b81 173 *
Kojto 169:e3b6fe271b81 174 * @code
Kojto 169:e3b6fe271b81 175 * #include "mbed_toolchain.h"
Anna Bridge 180:96ed750bd169 176 *
Kojto 169:e3b6fe271b81 177 * MBED_NOINLINE void foo() {
Anna Bridge 180:96ed750bd169 178 *
Kojto 169:e3b6fe271b81 179 * }
Kojto 169:e3b6fe271b81 180 * @endcode
Kojto 169:e3b6fe271b81 181 */
Kojto 169:e3b6fe271b81 182 #ifndef MBED_NOINLINE
Kojto 169:e3b6fe271b81 183 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
Kojto 169:e3b6fe271b81 184 #define MBED_NOINLINE __attribute__((noinline))
Kojto 169:e3b6fe271b81 185 #elif defined(__ICCARM__)
Kojto 169:e3b6fe271b81 186 #define MBED_NOINLINE _Pragma("inline=never")
Kojto 169:e3b6fe271b81 187 #else
Kojto 169:e3b6fe271b81 188 #define MBED_NOINLINE
Kojto 169:e3b6fe271b81 189 #endif
Kojto 169:e3b6fe271b81 190 #endif
Kojto 169:e3b6fe271b81 191
<> 160:d5399cc887bb 192 /** MBED_FORCEINLINE
<> 160:d5399cc887bb 193 * Declare a function that must always be inlined. Failure to inline
<> 160:d5399cc887bb 194 * such a function will result in an error.
<> 160:d5399cc887bb 195 *
<> 160:d5399cc887bb 196 * @code
<> 160:d5399cc887bb 197 * #include "mbed_toolchain.h"
Anna Bridge 180:96ed750bd169 198 *
<> 160:d5399cc887bb 199 * MBED_FORCEINLINE void foo() {
Anna Bridge 180:96ed750bd169 200 *
<> 160:d5399cc887bb 201 * }
<> 160:d5399cc887bb 202 * @endcode
<> 160:d5399cc887bb 203 */
<> 160:d5399cc887bb 204 #ifndef MBED_FORCEINLINE
<> 160:d5399cc887bb 205 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 160:d5399cc887bb 206 #define MBED_FORCEINLINE static inline __attribute__((always_inline))
<> 160:d5399cc887bb 207 #elif defined(__ICCARM__)
<> 160:d5399cc887bb 208 #define MBED_FORCEINLINE _Pragma("inline=forced") static
<> 160:d5399cc887bb 209 #else
<> 160:d5399cc887bb 210 #define MBED_FORCEINLINE static inline
<> 160:d5399cc887bb 211 #endif
<> 160:d5399cc887bb 212 #endif
<> 160:d5399cc887bb 213
<> 160:d5399cc887bb 214 /** MBED_NORETURN
<> 160:d5399cc887bb 215 * Declare a function that will never return.
<> 160:d5399cc887bb 216 *
<> 160:d5399cc887bb 217 * @code
<> 160:d5399cc887bb 218 * #include "mbed_toolchain.h"
Anna Bridge 180:96ed750bd169 219 *
<> 160:d5399cc887bb 220 * MBED_NORETURN void foo() {
<> 160:d5399cc887bb 221 * // must never return
<> 160:d5399cc887bb 222 * while (1) {}
<> 160:d5399cc887bb 223 * }
<> 160:d5399cc887bb 224 * @endcode
<> 160:d5399cc887bb 225 */
<> 160:d5399cc887bb 226 #ifndef MBED_NORETURN
<> 160:d5399cc887bb 227 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
<> 160:d5399cc887bb 228 #define MBED_NORETURN __attribute__((noreturn))
<> 160:d5399cc887bb 229 #elif defined(__ICCARM__)
<> 160:d5399cc887bb 230 #define MBED_NORETURN __noreturn
<> 160:d5399cc887bb 231 #else
<> 160:d5399cc887bb 232 #define MBED_NORETURN
<> 160:d5399cc887bb 233 #endif
<> 160:d5399cc887bb 234 #endif
<> 160:d5399cc887bb 235
<> 160:d5399cc887bb 236 /** MBED_UNREACHABLE
<> 160:d5399cc887bb 237 * An unreachable statement. If the statement is reached,
<> 160:d5399cc887bb 238 * behaviour is undefined. Useful in situations where the compiler
<> 160:d5399cc887bb 239 * cannot deduce the unreachability of code.
<> 160:d5399cc887bb 240 *
<> 160:d5399cc887bb 241 * @code
<> 160:d5399cc887bb 242 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 243 *
<> 160:d5399cc887bb 244 * void foo(int arg) {
<> 160:d5399cc887bb 245 * switch (arg) {
<> 160:d5399cc887bb 246 * case 1: return 1;
<> 160:d5399cc887bb 247 * case 2: return 2;
<> 160:d5399cc887bb 248 * ...
<> 160:d5399cc887bb 249 * }
<> 160:d5399cc887bb 250 * MBED_UNREACHABLE;
<> 160:d5399cc887bb 251 * }
<> 160:d5399cc887bb 252 * @endcode
<> 160:d5399cc887bb 253 */
<> 160:d5399cc887bb 254 #ifndef MBED_UNREACHABLE
<> 160:d5399cc887bb 255 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
<> 160:d5399cc887bb 256 #define MBED_UNREACHABLE __builtin_unreachable()
<> 160:d5399cc887bb 257 #else
<> 160:d5399cc887bb 258 #define MBED_UNREACHABLE while (1)
<> 160:d5399cc887bb 259 #endif
<> 160:d5399cc887bb 260 #endif
<> 160:d5399cc887bb 261
<> 160:d5399cc887bb 262 /** MBED_DEPRECATED("message string")
<> 160:d5399cc887bb 263 * Mark a function declaration as deprecated, if it used then a warning will be
<> 160:d5399cc887bb 264 * issued by the compiler possibly including the provided message. Note that not
<> 160:d5399cc887bb 265 * all compilers are able to display the message.
<> 160:d5399cc887bb 266 *
<> 160:d5399cc887bb 267 * @code
<> 160:d5399cc887bb 268 * #include "mbed_toolchain.h"
Anna Bridge 180:96ed750bd169 269 *
<> 160:d5399cc887bb 270 * MBED_DEPRECATED("don't foo any more, bar instead")
<> 160:d5399cc887bb 271 * void foo(int arg);
<> 160:d5399cc887bb 272 * @endcode
<> 160:d5399cc887bb 273 */
<> 160:d5399cc887bb 274 #ifndef MBED_DEPRECATED
<> 160:d5399cc887bb 275 #if defined(__CC_ARM)
<> 160:d5399cc887bb 276 #define MBED_DEPRECATED(M) __attribute__((deprecated))
<> 160:d5399cc887bb 277 #elif defined(__GNUC__) || defined(__clang__)
<> 160:d5399cc887bb 278 #define MBED_DEPRECATED(M) __attribute__((deprecated(M)))
<> 160:d5399cc887bb 279 #else
<> 160:d5399cc887bb 280 #define MBED_DEPRECATED(M)
<> 160:d5399cc887bb 281 #endif
<> 160:d5399cc887bb 282 #endif
<> 160:d5399cc887bb 283
<> 160:d5399cc887bb 284 /** MBED_DEPRECATED_SINCE("version", "message string")
<> 160:d5399cc887bb 285 * Mark a function declaration as deprecated, noting that the declaration was
<> 160:d5399cc887bb 286 * deprecated on the specified version. If the function is used then a warning
<> 160:d5399cc887bb 287 * will be issued by the compiler possibly including the provided message.
<> 160:d5399cc887bb 288 * Note that not all compilers are able to display this message.
<> 160:d5399cc887bb 289 *
<> 160:d5399cc887bb 290 * @code
<> 160:d5399cc887bb 291 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 292 *
<> 160:d5399cc887bb 293 * MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
<> 160:d5399cc887bb 294 * void foo(int arg);
<> 160:d5399cc887bb 295 * @endcode
<> 160:d5399cc887bb 296 */
<> 160:d5399cc887bb 297 #define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]")
<> 160:d5399cc887bb 298
<> 160:d5399cc887bb 299 /** MBED_CALLER_ADDR()
<> 160:d5399cc887bb 300 * Returns the caller of the current function.
<> 160:d5399cc887bb 301 *
<> 160:d5399cc887bb 302 * @note
<> 160:d5399cc887bb 303 * This macro is only implemented for GCC and ARMCC.
<> 160:d5399cc887bb 304 *
<> 160:d5399cc887bb 305 * @code
<> 160:d5399cc887bb 306 * #include "mbed_toolchain.h"
<> 160:d5399cc887bb 307 *
<> 160:d5399cc887bb 308 * printf("This function was called from %p", MBED_CALLER_ADDR());
<> 160:d5399cc887bb 309 * @endcode
<> 160:d5399cc887bb 310 *
<> 160:d5399cc887bb 311 * @return Address of the calling function
<> 160:d5399cc887bb 312 */
<> 160:d5399cc887bb 313 #ifndef MBED_CALLER_ADDR
<> 160:d5399cc887bb 314 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
<> 160:d5399cc887bb 315 #define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0))
<> 160:d5399cc887bb 316 #elif defined(__CC_ARM)
<> 160:d5399cc887bb 317 #define MBED_CALLER_ADDR() __builtin_return_address(0)
<> 160:d5399cc887bb 318 #else
<> 160:d5399cc887bb 319 #define MBED_CALLER_ADDR() (NULL)
<> 160:d5399cc887bb 320 #endif
<> 160:d5399cc887bb 321 #endif
<> 160:d5399cc887bb 322
<> 160:d5399cc887bb 323 #ifndef MBED_SECTION
<> 160:d5399cc887bb 324 #if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM)
<> 160:d5399cc887bb 325 #define MBED_SECTION(name) __attribute__ ((section (name)))
<> 160:d5399cc887bb 326 #elif defined(__ICCARM__)
<> 160:d5399cc887bb 327 #define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name))
<> 160:d5399cc887bb 328 #else
<> 160:d5399cc887bb 329 #error "Missing MBED_SECTION directive"
<> 160:d5399cc887bb 330 #endif
<> 160:d5399cc887bb 331 #endif
<> 160:d5399cc887bb 332
Anna Bridge 180:96ed750bd169 333 /**
Anna Bridge 180:96ed750bd169 334 * Macro expanding to a string literal of the enclosing function name.
Anna Bridge 180:96ed750bd169 335 *
Anna Bridge 180:96ed750bd169 336 * The string returned takes into account language specificity and yield human
Anna Bridge 180:96ed750bd169 337 * readable content.
Anna Bridge 180:96ed750bd169 338 *
Anna Bridge 180:96ed750bd169 339 * As an example, if the macro is used within a C++ function then the string
Anna Bridge 180:96ed750bd169 340 * literal containing the function name will contain the complete signature of
Anna Bridge 180:96ed750bd169 341 * the function - including template parameters - and namespace qualifications.
Anna Bridge 180:96ed750bd169 342 */
Anna Bridge 180:96ed750bd169 343 #ifndef MBED_PRETTY_FUNCTION
Anna Bridge 180:96ed750bd169 344 #define MBED_PRETTY_FUNCTION __PRETTY_FUNCTION__
Anna Bridge 180:96ed750bd169 345 #endif
Anna Bridge 180:96ed750bd169 346
AnnaBridge 167:e84263d55307 347 #ifndef MBED_PRINTF
AnnaBridge 167:e84263d55307 348 #if defined(__GNUC__) || defined(__CC_ARM)
AnnaBridge 167:e84263d55307 349 #define MBED_PRINTF(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx, first_param_idx)))
AnnaBridge 167:e84263d55307 350 #else
AnnaBridge 167:e84263d55307 351 #define MBED_PRINTF(format_idx, first_param_idx)
AnnaBridge 167:e84263d55307 352 #endif
AnnaBridge 167:e84263d55307 353 #endif
AnnaBridge 167:e84263d55307 354
AnnaBridge 167:e84263d55307 355 #ifndef MBED_PRINTF_METHOD
AnnaBridge 167:e84263d55307 356 #if defined(__GNUC__) || defined(__CC_ARM)
AnnaBridge 167:e84263d55307 357 #define MBED_PRINTF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx+1, first_param_idx+1)))
AnnaBridge 167:e84263d55307 358 #else
AnnaBridge 167:e84263d55307 359 #define MBED_PRINTF_METHOD(format_idx, first_param_idx)
AnnaBridge 167:e84263d55307 360 #endif
AnnaBridge 167:e84263d55307 361 #endif
AnnaBridge 167:e84263d55307 362
AnnaBridge 167:e84263d55307 363 #ifndef MBED_SCANF
AnnaBridge 167:e84263d55307 364 #if defined(__GNUC__) || defined(__CC_ARM)
AnnaBridge 167:e84263d55307 365 #define MBED_SCANF(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx, first_param_idx)))
AnnaBridge 167:e84263d55307 366 #else
AnnaBridge 167:e84263d55307 367 #define MBED_SCANF(format_idx, first_param_idx)
AnnaBridge 167:e84263d55307 368 #endif
AnnaBridge 167:e84263d55307 369 #endif
AnnaBridge 167:e84263d55307 370
AnnaBridge 167:e84263d55307 371 #ifndef MBED_SCANF_METHOD
AnnaBridge 167:e84263d55307 372 #if defined(__GNUC__) || defined(__CC_ARM)
AnnaBridge 167:e84263d55307 373 #define MBED_SCANF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx+1, first_param_idx+1)))
AnnaBridge 167:e84263d55307 374 #else
AnnaBridge 167:e84263d55307 375 #define MBED_SCANF_METHOD(format_idx, first_param_idx)
AnnaBridge 167:e84263d55307 376 #endif
AnnaBridge 167:e84263d55307 377 #endif
AnnaBridge 167:e84263d55307 378
<> 160:d5399cc887bb 379 // FILEHANDLE declaration
<> 160:d5399cc887bb 380 #if defined(TOOLCHAIN_ARM)
<> 160:d5399cc887bb 381 #include <rt_sys.h>
<> 160:d5399cc887bb 382 #endif
<> 160:d5399cc887bb 383
<> 160:d5399cc887bb 384 #ifndef FILEHANDLE
<> 160:d5399cc887bb 385 typedef int FILEHANDLE;
<> 160:d5399cc887bb 386 #endif
<> 160:d5399cc887bb 387
<> 160:d5399cc887bb 388 // Backwards compatibility
<> 160:d5399cc887bb 389 #ifndef WEAK
<> 160:d5399cc887bb 390 #define WEAK MBED_WEAK
<> 160:d5399cc887bb 391 #endif
<> 160:d5399cc887bb 392
<> 160:d5399cc887bb 393 #ifndef PACKED
<> 160:d5399cc887bb 394 #define PACKED MBED_PACKED()
<> 160:d5399cc887bb 395 #endif
<> 160:d5399cc887bb 396
<> 160:d5399cc887bb 397 #ifndef EXTERN
<> 160:d5399cc887bb 398 #define EXTERN extern
<> 160:d5399cc887bb 399 #endif
<> 160:d5399cc887bb 400
<> 160:d5399cc887bb 401 #endif
<> 160:d5399cc887bb 402
<> 160:d5399cc887bb 403 /** @}*/
AnnaBridge 178:79309dc6340a 404 /** @}*/