Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-dev by
Diff: platform/mbed_toolchain.h
- Revision:
- 176:447f873cad2f
- Parent:
- 170:19eb464bc2be
- Child:
- 178:79309dc6340a
--- a/platform/mbed_toolchain.h Wed Oct 11 12:45:49 2017 +0100 +++ b/platform/mbed_toolchain.h Wed Oct 25 14:53:38 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. *
