Nordic stack and drivers for the mbed BLE API. Version to work around build bug.

Dependents:   microbit_rubber_ducky microbit_mouse_BLE microbit_mouse_BLE_daybreak_version microbit_presenter

Fork of nRF51822 by Nordic Semiconductor

Committer:
JonnyA
Date:
Wed Aug 31 18:59:36 2016 +0000
Revision:
616:b52326e38ebd
Parent:
372:758e9a3a346a
Workaround for build system bug

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rgrover1 372:758e9a3a346a 1 /**************************************************************************/
rgrover1 372:758e9a3a346a 2 /*!
rgrover1 372:758e9a3a346a 3 @file compiler.h
rgrover1 372:758e9a3a346a 4 @author hathach (tinyusb.org)
rgrover1 372:758e9a3a346a 5
rgrover1 372:758e9a3a346a 6 @section LICENSE
rgrover1 372:758e9a3a346a 7
rgrover1 372:758e9a3a346a 8 Software License Agreement (BSD License)
rgrover1 372:758e9a3a346a 9
rgrover1 372:758e9a3a346a 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
rgrover1 372:758e9a3a346a 11 All rights reserved.
rgrover1 372:758e9a3a346a 12
rgrover1 372:758e9a3a346a 13 Redistribution and use in source and binary forms, with or without
rgrover1 372:758e9a3a346a 14 modification, are permitted provided that the following conditions are met:
rgrover1 372:758e9a3a346a 15 1. Redistributions of source code must retain the above copyright
rgrover1 372:758e9a3a346a 16 notice, this list of conditions and the following disclaimer.
rgrover1 372:758e9a3a346a 17 2. Redistributions in binary form must reproduce the above copyright
rgrover1 372:758e9a3a346a 18 notice, this list of conditions and the following disclaimer in the
rgrover1 372:758e9a3a346a 19 documentation and/or other materials provided with the distribution.
rgrover1 372:758e9a3a346a 20 3. Neither the name of the copyright holders nor the
rgrover1 372:758e9a3a346a 21 names of its contributors may be used to endorse or promote products
rgrover1 372:758e9a3a346a 22 derived from this software without specific prior written permission.
rgrover1 372:758e9a3a346a 23
rgrover1 372:758e9a3a346a 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
rgrover1 372:758e9a3a346a 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
rgrover1 372:758e9a3a346a 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
rgrover1 372:758e9a3a346a 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
rgrover1 372:758e9a3a346a 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
rgrover1 372:758e9a3a346a 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
rgrover1 372:758e9a3a346a 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
rgrover1 372:758e9a3a346a 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
rgrover1 372:758e9a3a346a 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
rgrover1 372:758e9a3a346a 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
rgrover1 372:758e9a3a346a 34 */
rgrover1 372:758e9a3a346a 35 /**************************************************************************/
rgrover1 372:758e9a3a346a 36
rgrover1 372:758e9a3a346a 37 /** \file
rgrover1 372:758e9a3a346a 38 * \brief GCC Header
rgrover1 372:758e9a3a346a 39 */
rgrover1 372:758e9a3a346a 40
rgrover1 372:758e9a3a346a 41 /** \ingroup Group_Compiler
rgrover1 372:758e9a3a346a 42 * \defgroup Group_GCC GNU GCC
rgrover1 372:758e9a3a346a 43 * @{
rgrover1 372:758e9a3a346a 44 */
rgrover1 372:758e9a3a346a 45
rgrover1 372:758e9a3a346a 46 #ifndef _COMPILER_GCC_H_
rgrover1 372:758e9a3a346a 47 #define _COMPILER_GCC_H_
rgrover1 372:758e9a3a346a 48
rgrover1 372:758e9a3a346a 49 #ifdef __cplusplus
rgrover1 372:758e9a3a346a 50 extern "C" {
rgrover1 372:758e9a3a346a 51 #endif
rgrover1 372:758e9a3a346a 52
rgrover1 372:758e9a3a346a 53 #include "projectconfig.h"
rgrover1 372:758e9a3a346a 54
rgrover1 372:758e9a3a346a 55 //#ifndef __GNUC__
rgrover1 372:758e9a3a346a 56 // #define ATTR_ALWAYS_INLINE
rgrover1 372:758e9a3a346a 57 // #define ATTR_CONST
rgrover1 372:758e9a3a346a 58 //#else
rgrover1 372:758e9a3a346a 59
rgrover1 372:758e9a3a346a 60 #ifdef _TEST_
rgrover1 372:758e9a3a346a 61 #define ATTR_ALWAYS_INLINE
rgrover1 372:758e9a3a346a 62 #define STATIC_
rgrover1 372:758e9a3a346a 63 #define INLINE_
rgrover1 372:758e9a3a346a 64 #else
rgrover1 372:758e9a3a346a 65 #define STATIC_ static
rgrover1 372:758e9a3a346a 66 #define INLINE_ inline
rgrover1 372:758e9a3a346a 67
rgrover1 372:758e9a3a346a 68 #if CFG_DEBUG == 3
rgrover1 372:758e9a3a346a 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
rgrover1 372:758e9a3a346a 70 #endif
rgrover1 372:758e9a3a346a 71 #endif
rgrover1 372:758e9a3a346a 72
rgrover1 372:758e9a3a346a 73 #define ALIGN_OF(x) __alignof__(x)
rgrover1 372:758e9a3a346a 74
rgrover1 372:758e9a3a346a 75 /// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section
rgrover1 372:758e9a3a346a 76 #define ATTR_SECTION(section) __attribute__ ((#section))
rgrover1 372:758e9a3a346a 77
rgrover1 372:758e9a3a346a 78 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, an error that includes message is diagnosed. This is useful for compile-time checking
rgrover1 372:758e9a3a346a 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
rgrover1 372:758e9a3a346a 80
rgrover1 372:758e9a3a346a 81 /// If this attribute is used on a function declaration and a call to such a function is not eliminated through dead code elimination or other optimizations, a warning that includes message is diagnosed. This is useful for compile-time checking
rgrover1 372:758e9a3a346a 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
rgrover1 372:758e9a3a346a 83
rgrover1 372:758e9a3a346a 84 /**
rgrover1 372:758e9a3a346a 85 * \defgroup Group_VariableAttr Variable Attributes
rgrover1 372:758e9a3a346a 86 * @{
rgrover1 372:758e9a3a346a 87 */
rgrover1 372:758e9a3a346a 88
rgrover1 372:758e9a3a346a 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
rgrover1 372:758e9a3a346a 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
rgrover1 372:758e9a3a346a 91
rgrover1 372:758e9a3a346a 92 /// The packed attribute specifies that a variable or structure field should have the smallest possible alignment—one byte for a variable, and one bit for a field, unless you specify a larger value with the aligned attribute
rgrover1 372:758e9a3a346a 93 #define ATTR_PACKED __attribute__ ((packed))
rgrover1 372:758e9a3a346a 94
rgrover1 372:758e9a3a346a 95 #define ATTR_PREPACKED
rgrover1 372:758e9a3a346a 96
rgrover1 372:758e9a3a346a 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
rgrover1 372:758e9a3a346a 98 /** @} */
rgrover1 372:758e9a3a346a 99
rgrover1 372:758e9a3a346a 100 /**
rgrover1 372:758e9a3a346a 101 * \defgroup Group_FuncAttr Function Attributes
rgrover1 372:758e9a3a346a 102 * @{
rgrover1 372:758e9a3a346a 103 */
rgrover1 372:758e9a3a346a 104
rgrover1 372:758e9a3a346a 105 #ifndef ATTR_ALWAYS_INLINE
rgrover1 372:758e9a3a346a 106 /// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified
rgrover1 372:758e9a3a346a 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
rgrover1 372:758e9a3a346a 108 #endif
rgrover1 372:758e9a3a346a 109
rgrover1 372:758e9a3a346a 110 /// The nonnull attribute specifies that some function parameters should be non-null pointers. f the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. All pointer arguments are marked as non-null
rgrover1 372:758e9a3a346a 111 #define ATTR_NON_NULL __attribute__ ((nonull))
rgrover1 372:758e9a3a346a 112
rgrover1 372:758e9a3a346a 113 /// Many functions have no effects except the return value and their return value depends only on the parameters and/or global variables. Such a function can be subject to common subexpression elimination and loop optimization just as an arithmetic operator would be. These functions should be declared with the attribute pure
rgrover1 372:758e9a3a346a 114 #define ATTR_PURE __attribute__ ((pure))
rgrover1 372:758e9a3a346a 115
rgrover1 372:758e9a3a346a 116 /// Many functions do not examine any values except their arguments, and have no effects except the return value. Basically this is just slightly more strict class than the pure attribute below, since function is not allowed to read global memory.
rgrover1 372:758e9a3a346a 117 /// Note that a function that has pointer arguments and examines the data pointed to must not be declared const. Likewise, a function that calls a non-const function usually must not be const. It does not make sense for a const function to return void
rgrover1 372:758e9a3a346a 118 #define ATTR_CONST __attribute__ ((const))
rgrover1 372:758e9a3a346a 119
rgrover1 372:758e9a3a346a 120 /// The deprecated attribute results in a warning if the function is used anywhere in the source file. This is useful when identifying functions that are expected to be removed in a future version of a program. The warning also includes the location of the declaration of the deprecated function, to enable users to easily find further information about why the function is deprecated, or what they should do instead. Note that the warnings only occurs for uses
rgrover1 372:758e9a3a346a 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
rgrover1 372:758e9a3a346a 122
rgrover1 372:758e9a3a346a 123 /// Same as the deprecated attribute with optional message in the warning
rgrover1 372:758e9a3a346a 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
rgrover1 372:758e9a3a346a 125
rgrover1 372:758e9a3a346a 126 /// The weak attribute causes the declaration to be emitted as a weak symbol rather than a global. This is primarily useful in defining library functions that can be overridden in user code
rgrover1 372:758e9a3a346a 127 #define ATTR_WEAK __attribute__ ((weak))
rgrover1 372:758e9a3a346a 128
rgrover1 372:758e9a3a346a 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
rgrover1 372:758e9a3a346a 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
rgrover1 372:758e9a3a346a 131
rgrover1 372:758e9a3a346a 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
rgrover1 372:758e9a3a346a 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
rgrover1 372:758e9a3a346a 134
rgrover1 372:758e9a3a346a 135 /// The warn_unused_result attribute causes a warning to be emitted if a caller of the function with this attribute does not use its return value. This is useful for functions where not checking the result is either a security problem or always a bug
rgrover1 372:758e9a3a346a 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
rgrover1 372:758e9a3a346a 137
rgrover1 372:758e9a3a346a 138 /// This attribute, attached to a function, means that code must be emitted for the function even if it appears that the function is not referenced. This is useful, for example, when the function is referenced only in inline assembly.
rgrover1 372:758e9a3a346a 139 #define ATTR_USED __attribute__ ((used))
rgrover1 372:758e9a3a346a 140
rgrover1 372:758e9a3a346a 141 /// This attribute, attached to a function, means that the function is meant to be possibly unused. GCC does not produce a warning for this function.
rgrover1 372:758e9a3a346a 142 #define ATTR_UNUSED __attribute__ ((unused))
rgrover1 372:758e9a3a346a 143
rgrover1 372:758e9a3a346a 144 /** @} */
rgrover1 372:758e9a3a346a 145
rgrover1 372:758e9a3a346a 146 #ifdef __cplusplus
rgrover1 372:758e9a3a346a 147 }
rgrover1 372:758e9a3a346a 148 #endif
rgrover1 372:758e9a3a346a 149
rgrover1 372:758e9a3a346a 150 #endif /* _COMPILER_GCC_H_ */
rgrover1 372:758e9a3a346a 151
rgrover1 372:758e9a3a346a 152 /// @}