- Timestamp:
- Apr 5, 2019, 9:26:53 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
asp3_tinet_ecnl_arm/trunk/asp3_dcre/mbed/platform/mbed_toolchain.h
r352 r374 2 2 /** \addtogroup platform */ 3 3 /** @{*/ 4 /** 5 * \defgroup platform_toolchain Toolchain functions 6 * @{ 7 */ 8 4 9 /* mbed Microcontroller Library 5 10 * Copyright (c) 2006-2013 ARM Limited … … 93 98 #endif 94 99 100 /** MBED_USED 101 * Inform the compiler that a static variable is to be retained in the object file, even if it is unreferenced. 102 * 103 * @code 104 * #include "mbed_toolchain.h" 105 * 106 * MBED_USED int foo; 107 * 108 * @endcode 109 */ 110 #ifndef MBED_USED 111 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) 112 #define MBED_USED __attribute__((used)) 113 #elif defined(__ICCARM__) 114 #define MBED_USED __root 115 #else 116 #define MBED_USED 117 #endif 118 #endif 119 95 120 /** MBED_WEAK 96 121 * Mark a function as being weak. 97 122 * 98 123 * @note 99 * weak functions are not friendly to making code re-usable, as they can only 124 * Functions should only be marked as weak in the source file. The header file 125 * should contain a regular function declaration to insure the function is emitted. 126 * A function marked weak will not be emitted if an alternative non-weak 127 * implementation is defined. 128 * 129 * @note 130 * Weak functions are not friendly to making code re-usable, as they can only 100 131 * be overridden once (and if they are multiply overridden the linker will emit 101 132 * no warning). You should not normally use weak symbols as part of the API to … … 135 166 #else 136 167 #define MBED_PURE 168 #endif 169 #endif 170 171 /** MBED_NOINLINE 172 * Declare a function that must not be inlined. 173 * 174 * @code 175 * #include "mbed_toolchain.h" 176 * 177 * MBED_NOINLINE void foo() { 178 * 179 * } 180 * @endcode 181 */ 182 #ifndef MBED_NOINLINE 183 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) 184 #define MBED_NOINLINE __attribute__((noinline)) 185 #elif defined(__ICCARM__) 186 #define MBED_NOINLINE _Pragma("inline=never") 187 #else 188 #define MBED_NOINLINE 137 189 #endif 138 190 #endif … … 279 331 #endif 280 332 333 /** 334 * Macro expanding to a string literal of the enclosing function name. 335 * 336 * The string returned takes into account language specificity and yield human 337 * readable content. 338 * 339 * As an example, if the macro is used within a C++ function then the string 340 * literal containing the function name will contain the complete signature of 341 * the function - including template parameters - and namespace qualifications. 342 */ 343 #ifndef MBED_PRETTY_FUNCTION 344 #define MBED_PRETTY_FUNCTION __PRETTY_FUNCTION__ 345 #endif 346 347 #ifndef MBED_PRINTF 348 #if defined(__GNUC__) || defined(__CC_ARM) 349 #define MBED_PRINTF(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx, first_param_idx))) 350 #else 351 #define MBED_PRINTF(format_idx, first_param_idx) 352 #endif 353 #endif 354 355 #ifndef MBED_PRINTF_METHOD 356 #if defined(__GNUC__) || defined(__CC_ARM) 357 #define MBED_PRINTF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx+1, first_param_idx+1))) 358 #else 359 #define MBED_PRINTF_METHOD(format_idx, first_param_idx) 360 #endif 361 #endif 362 363 #ifndef MBED_SCANF 364 #if defined(__GNUC__) || defined(__CC_ARM) 365 #define MBED_SCANF(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx, first_param_idx))) 366 #else 367 #define MBED_SCANF(format_idx, first_param_idx) 368 #endif 369 #endif 370 371 #ifndef MBED_SCANF_METHOD 372 #if defined(__GNUC__) || defined(__CC_ARM) 373 #define MBED_SCANF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx+1, first_param_idx+1))) 374 #else 375 #define MBED_SCANF_METHOD(format_idx, first_param_idx) 376 #endif 377 #endif 378 379 // Macro containing the filename part of the value of __FILE__. Defined as 380 // string literal. 381 #ifndef MBED_FILENAME 382 #if defined(__CC_ARM) 383 #define MBED_FILENAME __MODULE__ 384 #elif defined(__GNUC__) 385 #define MBED_FILENAME (__builtin_strrchr(__FILE__, '/') ? __builtin_strrchr(__FILE__, '/') + 1 : __builtin_strrchr(__FILE__, '\\') ? __builtin_strrchr(__FILE__, '\\') + 1 : __FILE__) 386 #elif defined(__ICCARM__) 387 #define MBED_FILENAME (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : strrchr(__FILE__, '\\') ? strrchr(__FILE__, '\\') + 1 : __FILE__) 388 #else 389 #define MBED_FILENAME __FILE__ 390 #endif 391 #endif // #ifndef MBED_FILENAME 392 281 393 // FILEHANDLE declaration 282 394 #if defined(TOOLCHAIN_ARM) … … 301 413 #endif 302 414 415 /** MBED_NONSECURE_ENTRY 416 * Declare a function that can be called from non-secure world or secure world 417 * 418 * @code 419 * #include "mbed_toolchain.h" 420 * 421 * MBED_NONSECURE_ENTRY void foo() { 422 * 423 * } 424 * @endcode 425 */ 426 #if defined (__ARM_FEATURE_CMSE) && (__ARM_FEATURE_CMSE == 3L) 427 #if defined (__ICCARM__) 428 #define MBED_NONSECURE_ENTRY __cmse_nonsecure_entry 429 #else 430 #define MBED_NONSECURE_ENTRY __attribute__((cmse_nonsecure_entry)) 431 #endif 432 #else 433 #define MBED_NONSECURE_ENTRY 434 #endif 435 303 436 #endif 304 437 305 438 /** @}*/ 439 /** @}*/
Note:
See TracChangeset
for help on using the changeset viewer.