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.
Diff: platform/mbed_toolchain.h
- Revision:
- 154:fb8e0ae1cceb
- Parent:
- 148:fd96258d940d
diff -r b484a57bc302 -r fb8e0ae1cceb platform/mbed_toolchain.h --- a/platform/mbed_toolchain.h Wed Oct 11 12:36:33 2017 +0100 +++ b/platform/mbed_toolchain.h Wed Oct 25 14:40:21 2017 +0100 @@ -92,6 +92,26 @@ #endif #endif +/** MBED_USED + * Inform the compiler that a static variable is to be retained in the object file, even if it is unreferenced. + * + * @code + * #include "mbed_toolchain.h" + * + * MBED_USED int foo; + * + * @endcode + */ +#ifndef MBED_USED +#if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM) +#define MBED_USED __attribute__((used)) +#elif defined(__ICCARM__) +#define MBED_USED __root +#else +#define MBED_USED +#endif +#endif + /** MBED_WEAK * Mark a function as being weak. *