test firmware for BLE Micro V1.3 1. test io, vcc and ble 2. act as a UART to BLE bridge

Dependencies:   BLE_API Buffer mbed

Fork of BLE_LEDBlinker by Bluetooth Low Energy

Committer:
arch
Date:
Tue Dec 08 08:34:22 2015 +0000
Revision:
12:c4090cb58976
Parent:
11:c8cbc4bc2c17
fix USBTX/USBRX pins config

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arch 11:c8cbc4bc2c17 1 /**************************************************************************/
arch 11:c8cbc4bc2c17 2 /*!
arch 11:c8cbc4bc2c17 3 @file compiler.h
arch 11:c8cbc4bc2c17 4 @author hathach (tinyusb.org)
arch 11:c8cbc4bc2c17 5
arch 11:c8cbc4bc2c17 6 @section LICENSE
arch 11:c8cbc4bc2c17 7
arch 11:c8cbc4bc2c17 8 Software License Agreement (BSD License)
arch 11:c8cbc4bc2c17 9
arch 11:c8cbc4bc2c17 10 Copyright (c) 2013, K. Townsend (microBuilder.eu)
arch 11:c8cbc4bc2c17 11 All rights reserved.
arch 11:c8cbc4bc2c17 12
arch 11:c8cbc4bc2c17 13 Redistribution and use in source and binary forms, with or without
arch 11:c8cbc4bc2c17 14 modification, are permitted provided that the following conditions are met:
arch 11:c8cbc4bc2c17 15 1. Redistributions of source code must retain the above copyright
arch 11:c8cbc4bc2c17 16 notice, this list of conditions and the following disclaimer.
arch 11:c8cbc4bc2c17 17 2. Redistributions in binary form must reproduce the above copyright
arch 11:c8cbc4bc2c17 18 notice, this list of conditions and the following disclaimer in the
arch 11:c8cbc4bc2c17 19 documentation and/or other materials provided with the distribution.
arch 11:c8cbc4bc2c17 20 3. Neither the name of the copyright holders nor the
arch 11:c8cbc4bc2c17 21 names of its contributors may be used to endorse or promote products
arch 11:c8cbc4bc2c17 22 derived from this software without specific prior written permission.
arch 11:c8cbc4bc2c17 23
arch 11:c8cbc4bc2c17 24 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
arch 11:c8cbc4bc2c17 25 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
arch 11:c8cbc4bc2c17 26 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
arch 11:c8cbc4bc2c17 27 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
arch 11:c8cbc4bc2c17 28 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
arch 11:c8cbc4bc2c17 29 INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
arch 11:c8cbc4bc2c17 30 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND
arch 11:c8cbc4bc2c17 31 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
arch 11:c8cbc4bc2c17 32 INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS
arch 11:c8cbc4bc2c17 33 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
arch 11:c8cbc4bc2c17 34 */
arch 11:c8cbc4bc2c17 35 /**************************************************************************/
arch 11:c8cbc4bc2c17 36
arch 11:c8cbc4bc2c17 37 /** \file
arch 11:c8cbc4bc2c17 38 * \brief GCC Header
arch 11:c8cbc4bc2c17 39 */
arch 11:c8cbc4bc2c17 40
arch 11:c8cbc4bc2c17 41 /** \ingroup Group_Compiler
arch 11:c8cbc4bc2c17 42 * \defgroup Group_GCC GNU GCC
arch 11:c8cbc4bc2c17 43 * @{
arch 11:c8cbc4bc2c17 44 */
arch 11:c8cbc4bc2c17 45
arch 11:c8cbc4bc2c17 46 #ifndef _COMPILER_GCC_H_
arch 11:c8cbc4bc2c17 47 #define _COMPILER_GCC_H_
arch 11:c8cbc4bc2c17 48
arch 11:c8cbc4bc2c17 49 #ifdef __cplusplus
arch 11:c8cbc4bc2c17 50 extern "C" {
arch 11:c8cbc4bc2c17 51 #endif
arch 11:c8cbc4bc2c17 52
arch 11:c8cbc4bc2c17 53 #include "projectconfig.h"
arch 11:c8cbc4bc2c17 54
arch 11:c8cbc4bc2c17 55 //#ifndef __GNUC__
arch 11:c8cbc4bc2c17 56 // #define ATTR_ALWAYS_INLINE
arch 11:c8cbc4bc2c17 57 // #define ATTR_CONST
arch 11:c8cbc4bc2c17 58 //#else
arch 11:c8cbc4bc2c17 59
arch 11:c8cbc4bc2c17 60 #ifdef _TEST_
arch 11:c8cbc4bc2c17 61 #define ATTR_ALWAYS_INLINE
arch 11:c8cbc4bc2c17 62 #define STATIC_
arch 11:c8cbc4bc2c17 63 #define INLINE_
arch 11:c8cbc4bc2c17 64 #else
arch 11:c8cbc4bc2c17 65 #define STATIC_ static
arch 11:c8cbc4bc2c17 66 #define INLINE_ inline
arch 11:c8cbc4bc2c17 67
arch 11:c8cbc4bc2c17 68 #if CFG_DEBUG == 3
arch 11:c8cbc4bc2c17 69 #define ATTR_ALWAYS_INLINE // no inline for debug = 3
arch 11:c8cbc4bc2c17 70 #endif
arch 11:c8cbc4bc2c17 71 #endif
arch 11:c8cbc4bc2c17 72
arch 11:c8cbc4bc2c17 73 #define ALIGN_OF(x) __alignof__(x)
arch 11:c8cbc4bc2c17 74
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 76 #define ATTR_SECTION(section) __attribute__ ((#section))
arch 11:c8cbc4bc2c17 77
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 79 #define ATTR_ERROR(Message) __attribute__ ((error(Message)))
arch 11:c8cbc4bc2c17 80
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 82 #define ATTR_WARNING(Message) __attribute__ ((warning(Message)))
arch 11:c8cbc4bc2c17 83
arch 11:c8cbc4bc2c17 84 /**
arch 11:c8cbc4bc2c17 85 * \defgroup Group_VariableAttr Variable Attributes
arch 11:c8cbc4bc2c17 86 * @{
arch 11:c8cbc4bc2c17 87 */
arch 11:c8cbc4bc2c17 88
arch 11:c8cbc4bc2c17 89 /// This attribute specifies a minimum alignment for the variable or structure field, measured in bytes
arch 11:c8cbc4bc2c17 90 #define ATTR_ALIGNED(Bytes) __attribute__ ((aligned(Bytes)))
arch 11:c8cbc4bc2c17 91
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 93 #define ATTR_PACKED __attribute__ ((packed))
arch 11:c8cbc4bc2c17 94
arch 11:c8cbc4bc2c17 95 #define ATTR_PREPACKED
arch 11:c8cbc4bc2c17 96
arch 11:c8cbc4bc2c17 97 #define ATTR_PACKED_STRUCT(x) x __attribute__ ((packed))
arch 11:c8cbc4bc2c17 98 /** @} */
arch 11:c8cbc4bc2c17 99
arch 11:c8cbc4bc2c17 100 /**
arch 11:c8cbc4bc2c17 101 * \defgroup Group_FuncAttr Function Attributes
arch 11:c8cbc4bc2c17 102 * @{
arch 11:c8cbc4bc2c17 103 */
arch 11:c8cbc4bc2c17 104
arch 11:c8cbc4bc2c17 105 #ifndef ATTR_ALWAYS_INLINE
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 107 #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
arch 11:c8cbc4bc2c17 108 #endif
arch 11:c8cbc4bc2c17 109
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 111 #define ATTR_NON_NULL __attribute__ ((nonull))
arch 11:c8cbc4bc2c17 112
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 114 #define ATTR_PURE __attribute__ ((pure))
arch 11:c8cbc4bc2c17 115
arch 11:c8cbc4bc2c17 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.
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 118 #define ATTR_CONST __attribute__ ((const))
arch 11:c8cbc4bc2c17 119
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 121 #define ATTR_DEPRECATED __attribute__ ((deprecated))
arch 11:c8cbc4bc2c17 122
arch 11:c8cbc4bc2c17 123 /// Same as the deprecated attribute with optional message in the warning
arch 11:c8cbc4bc2c17 124 #define ATTR_DEPRECATED_MESS(mess) __attribute__ ((deprecated(mess)))
arch 11:c8cbc4bc2c17 125
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 127 #define ATTR_WEAK __attribute__ ((weak))
arch 11:c8cbc4bc2c17 128
arch 11:c8cbc4bc2c17 129 /// The alias attribute causes the declaration to be emitted as an alias for another symbol, which must be specified
arch 11:c8cbc4bc2c17 130 #define ATTR_ALIAS(func) __attribute__ ((alias(#func)))
arch 11:c8cbc4bc2c17 131
arch 11:c8cbc4bc2c17 132 /// The weakref attribute marks a declaration as a weak reference. It is equivalent with weak + alias attribute, but require function is static
arch 11:c8cbc4bc2c17 133 #define ATTR_WEAKREF(func) __attribute__ ((weakref(#func)))
arch 11:c8cbc4bc2c17 134
arch 11:c8cbc4bc2c17 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
arch 11:c8cbc4bc2c17 136 #define ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
arch 11:c8cbc4bc2c17 137
arch 11:c8cbc4bc2c17 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.
arch 11:c8cbc4bc2c17 139 #define ATTR_USED __attribute__ ((used))
arch 11:c8cbc4bc2c17 140
arch 11:c8cbc4bc2c17 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.
arch 11:c8cbc4bc2c17 142 #define ATTR_UNUSED __attribute__ ((unused))
arch 11:c8cbc4bc2c17 143
arch 11:c8cbc4bc2c17 144 /** @} */
arch 11:c8cbc4bc2c17 145
arch 11:c8cbc4bc2c17 146 #ifdef __cplusplus
arch 11:c8cbc4bc2c17 147 }
arch 11:c8cbc4bc2c17 148 #endif
arch 11:c8cbc4bc2c17 149
arch 11:c8cbc4bc2c17 150 #endif /* _COMPILER_GCC_H_ */
arch 11:c8cbc4bc2c17 151
arch 11:c8cbc4bc2c17 152 /// @}