A metronome using the FRDM K64F board

Committer:
ram54288
Date:
Sun May 14 18:40:18 2017 +0000
Revision:
0:a7a43371b306
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ram54288 0:a7a43371b306 1 /* Unity Configuration
ram54288 0:a7a43371b306 2 * As of May 11th, 2016 at ThrowTheSwitch/Unity commit 837c529
ram54288 0:a7a43371b306 3 * See Also: Unity/docs/UnityConfigurationGuide.pdf
ram54288 0:a7a43371b306 4 *
ram54288 0:a7a43371b306 5 * Unity is designed to run on almost anything that is targeted by a C compiler.
ram54288 0:a7a43371b306 6 * It would be awesome if this could be done with zero configuration. While
ram54288 0:a7a43371b306 7 * there are some targets that come close to this dream, it is sadly not
ram54288 0:a7a43371b306 8 * universal. It is likely that you are going to need at least a couple of the
ram54288 0:a7a43371b306 9 * configuration options described in this document.
ram54288 0:a7a43371b306 10 *
ram54288 0:a7a43371b306 11 * All of Unity's configuration options are `#defines`. Most of these are simple
ram54288 0:a7a43371b306 12 * definitions. A couple are macros with arguments. They live inside the
ram54288 0:a7a43371b306 13 * unity_internals.h header file. We don't necessarily recommend opening that
ram54288 0:a7a43371b306 14 * file unless you really need to. That file is proof that a cross-platform
ram54288 0:a7a43371b306 15 * library is challenging to build. From a more positive perspective, it is also
ram54288 0:a7a43371b306 16 * proof that a great deal of complexity can be centralized primarily to one
ram54288 0:a7a43371b306 17 * place in order to provide a more consistent and simple experience elsewhere.
ram54288 0:a7a43371b306 18 *
ram54288 0:a7a43371b306 19 * Using These Options
ram54288 0:a7a43371b306 20 * It doesn't matter if you're using a target-specific compiler and a simulator
ram54288 0:a7a43371b306 21 * or a native compiler. In either case, you've got a couple choices for
ram54288 0:a7a43371b306 22 * configuring these options:
ram54288 0:a7a43371b306 23 *
ram54288 0:a7a43371b306 24 * 1. Because these options are specified via C defines, you can pass most of
ram54288 0:a7a43371b306 25 * these options to your compiler through command line compiler flags. Even
ram54288 0:a7a43371b306 26 * if you're using an embedded target that forces you to use their
ram54288 0:a7a43371b306 27 * overbearing IDE for all configuration, there will be a place somewhere in
ram54288 0:a7a43371b306 28 * your project to configure defines for your compiler.
ram54288 0:a7a43371b306 29 * 2. You can create a custom `unity_config.h` configuration file (present in
ram54288 0:a7a43371b306 30 * your toolchain's search paths). In this file, you will list definitions
ram54288 0:a7a43371b306 31 * and macros specific to your target. All you must do is define
ram54288 0:a7a43371b306 32 * `UNITY_INCLUDE_CONFIG_H` and Unity will rely on `unity_config.h` for any
ram54288 0:a7a43371b306 33 * further definitions it may need.
ram54288 0:a7a43371b306 34 */
ram54288 0:a7a43371b306 35
ram54288 0:a7a43371b306 36 #ifndef UNITY_CONFIG_H
ram54288 0:a7a43371b306 37 #define UNITY_CONFIG_H
ram54288 0:a7a43371b306 38
ram54288 0:a7a43371b306 39 #ifdef __cplusplus
ram54288 0:a7a43371b306 40 extern "C"
ram54288 0:a7a43371b306 41 {
ram54288 0:a7a43371b306 42 #endif
ram54288 0:a7a43371b306 43
ram54288 0:a7a43371b306 44 /* ************************* AUTOMATIC INTEGER TYPES ***************************
ram54288 0:a7a43371b306 45 * C's concept of an integer varies from target to target. The C Standard has
ram54288 0:a7a43371b306 46 * rules about the `int` matching the register size of the target
ram54288 0:a7a43371b306 47 * microprocessor. It has rules about the `int` and how its size relates to
ram54288 0:a7a43371b306 48 * other integer types. An `int` on one target might be 16 bits while on another
ram54288 0:a7a43371b306 49 * target it might be 64. There are more specific types in compilers compliant
ram54288 0:a7a43371b306 50 * with C99 or later, but that's certainly not every compiler you are likely to
ram54288 0:a7a43371b306 51 * encounter. Therefore, Unity has a number of features for helping to adjust
ram54288 0:a7a43371b306 52 * itself to match your required integer sizes. It starts off by trying to do it
ram54288 0:a7a43371b306 53 * automatically.
ram54288 0:a7a43371b306 54 **************************************************************************** */
ram54288 0:a7a43371b306 55
ram54288 0:a7a43371b306 56 /* The first thing that Unity does to guess your types is check `stdint.h`. This
ram54288 0:a7a43371b306 57 * file includes defines like `UINT_MAX` that Unity can make use of to learn a
ram54288 0:a7a43371b306 58 * lot about your system. It's possible you don't want it to do this or it's
ram54288 0:a7a43371b306 59 * possible that your system doesn't support `stdint.h`. If that's the case,
ram54288 0:a7a43371b306 60 * you're going to want to define this. That way, Unity will know to skip the
ram54288 0:a7a43371b306 61 * inclusion of this file and you won't be left with a compiler error.
ram54288 0:a7a43371b306 62 */
ram54288 0:a7a43371b306 63 /* #define UNITY_EXCLUDE_STDINT_H */
ram54288 0:a7a43371b306 64
ram54288 0:a7a43371b306 65 /* The second attempt to guess your types is to check `limits.h`. Some compilers
ram54288 0:a7a43371b306 66 * that don't support `stdint.h` could include `limits.h` instead. If you don't
ram54288 0:a7a43371b306 67 * want Unity to check this file either, define this to make it skip the
ram54288 0:a7a43371b306 68 * inclusion.
ram54288 0:a7a43371b306 69 */
ram54288 0:a7a43371b306 70 /* #define UNITY_EXCLUDE_LIMITS_H */
ram54288 0:a7a43371b306 71
ram54288 0:a7a43371b306 72 /* The third and final attempt to guess your types is to use the `sizeof()`
ram54288 0:a7a43371b306 73 * operator. Even if the first two options don't work, this one covers most
ram54288 0:a7a43371b306 74 * cases. There _is_ a rare compiler or two out there that doesn't support
ram54288 0:a7a43371b306 75 * `sizeof()` in the preprocessing stage, though. For these, you have the
ram54288 0:a7a43371b306 76 * ability to disable this feature as well.
ram54288 0:a7a43371b306 77 */
ram54288 0:a7a43371b306 78 /* #define UNITY_EXCLUDE_SIZEOF */
ram54288 0:a7a43371b306 79
ram54288 0:a7a43371b306 80
ram54288 0:a7a43371b306 81 /* ********************** MANUAL INTEGER TYPE DEFINITION ***********************
ram54288 0:a7a43371b306 82 * If you've disabled all of the automatic options above, you're going to have
ram54288 0:a7a43371b306 83 * to do the configuration yourself. There are just a handful of defines that
ram54288 0:a7a43371b306 84 * you are going to specify if you don't like the defaults.
ram54288 0:a7a43371b306 85 **************************************************************************** */
ram54288 0:a7a43371b306 86
ram54288 0:a7a43371b306 87 /* Define this to be the number of bits an `int` takes up on your system. The
ram54288 0:a7a43371b306 88 * default, if not auto-detected, is 32 bits.
ram54288 0:a7a43371b306 89 *
ram54288 0:a7a43371b306 90 * Example:
ram54288 0:a7a43371b306 91 */
ram54288 0:a7a43371b306 92 /* #define UNITY_INT_WIDTH 16 */
ram54288 0:a7a43371b306 93
ram54288 0:a7a43371b306 94 /* Define this to be the number of bits a `long` takes up on your system. The
ram54288 0:a7a43371b306 95 * default, if not autodetected, is 32 bits. This is used to figure out what
ram54288 0:a7a43371b306 96 * kind of 64-bit support your system can handle. Does it need to specify a
ram54288 0:a7a43371b306 97 * `long` or a `long long` to get a 64-bit value. On 16-bit systems, this option
ram54288 0:a7a43371b306 98 * is going to be ignored.
ram54288 0:a7a43371b306 99 *
ram54288 0:a7a43371b306 100 * Example:
ram54288 0:a7a43371b306 101 */
ram54288 0:a7a43371b306 102 /* #define UNITY_LONG_WIDTH 16 */
ram54288 0:a7a43371b306 103
ram54288 0:a7a43371b306 104 /* Define this to be the number of bits a pointer takes up on your system. The
ram54288 0:a7a43371b306 105 * default, if not autodetected, is 32-bits. If you're getting ugly compiler
ram54288 0:a7a43371b306 106 * warnings about casting from pointers, this is the one to look at.
ram54288 0:a7a43371b306 107 *
ram54288 0:a7a43371b306 108 * Example:
ram54288 0:a7a43371b306 109 */
ram54288 0:a7a43371b306 110 /* #define UNITY_POINTER_WIDTH 64 */
ram54288 0:a7a43371b306 111
ram54288 0:a7a43371b306 112 /* Unity will automatically include 64-bit support if it auto-detects it, or if
ram54288 0:a7a43371b306 113 * your `int`, `long`, or pointer widths are greater than 32-bits. Define this
ram54288 0:a7a43371b306 114 * to enable 64-bit support if none of the other options already did it for you.
ram54288 0:a7a43371b306 115 * There can be a significant size and speed impact to enabling 64-bit support
ram54288 0:a7a43371b306 116 * on small targets, so don't define it if you don't need it.
ram54288 0:a7a43371b306 117 */
ram54288 0:a7a43371b306 118 /* #define UNITY_INCLUDE_64 */
ram54288 0:a7a43371b306 119
ram54288 0:a7a43371b306 120
ram54288 0:a7a43371b306 121 /* *************************** FLOATING POINT TYPES ****************************
ram54288 0:a7a43371b306 122 * In the embedded world, it's not uncommon for targets to have no support for
ram54288 0:a7a43371b306 123 * floating point operations at all or to have support that is limited to only
ram54288 0:a7a43371b306 124 * single precision. We are able to guess integer sizes on the fly because
ram54288 0:a7a43371b306 125 * integers are always available in at least one size. Floating point, on the
ram54288 0:a7a43371b306 126 * other hand, is sometimes not available at all. Trying to include `float.h` on
ram54288 0:a7a43371b306 127 * these platforms would result in an error. This leaves manual configuration as
ram54288 0:a7a43371b306 128 * the only option.
ram54288 0:a7a43371b306 129 **************************************************************************** */
ram54288 0:a7a43371b306 130
ram54288 0:a7a43371b306 131 /* By default, Unity guesses that you will want single precision floating point
ram54288 0:a7a43371b306 132 * support, but not double precision. It's easy to change either of these using
ram54288 0:a7a43371b306 133 * the include and exclude options here. You may include neither, either, or
ram54288 0:a7a43371b306 134 * both, as suits your needs.
ram54288 0:a7a43371b306 135 */
ram54288 0:a7a43371b306 136 /* #define UNITY_INCLUDE_FLOAT */
ram54288 0:a7a43371b306 137 /* #define UNITY_EXCLUDE_FLOAT */
ram54288 0:a7a43371b306 138 /* #define UNITY_INCLUDE_DOUBLE */
ram54288 0:a7a43371b306 139 /* #define UNITY_EXCLUDE_DOUBLE */
ram54288 0:a7a43371b306 140
ram54288 0:a7a43371b306 141 /* For features that are enabled, the following floating point options also
ram54288 0:a7a43371b306 142 * become available.
ram54288 0:a7a43371b306 143 */
ram54288 0:a7a43371b306 144
ram54288 0:a7a43371b306 145 /* Unity aims for as small of a footprint as possible and avoids most standard
ram54288 0:a7a43371b306 146 * library calls (some embedded platforms don't have a standard library!).
ram54288 0:a7a43371b306 147 * Because of this, its routines for printing integer values are minimalist and
ram54288 0:a7a43371b306 148 * hand-coded. To keep Unity universal, though, we chose to _not_ develop our
ram54288 0:a7a43371b306 149 * own floating point print routines. Instead, the display of floating point
ram54288 0:a7a43371b306 150 * values during a failure are optional. By default, Unity will not print the
ram54288 0:a7a43371b306 151 * actual results of floating point assertion failure. So a failed assertion
ram54288 0:a7a43371b306 152 * will produce a message like `"Values Not Within Delta"`. If you would like
ram54288 0:a7a43371b306 153 * verbose failure messages for floating point assertions, use these options to
ram54288 0:a7a43371b306 154 * give more explicit failure messages (e.g. `"Expected 4.56 Was 4.68"`). Note
ram54288 0:a7a43371b306 155 * that this feature requires the use of `sprintf` so might not be desirable in
ram54288 0:a7a43371b306 156 * all cases.
ram54288 0:a7a43371b306 157 */
ram54288 0:a7a43371b306 158 /* #define UNITY_FLOAT_VERBOSE */
ram54288 0:a7a43371b306 159 /* #define UNITY_DOUBLE_VERBOSE */
ram54288 0:a7a43371b306 160
ram54288 0:a7a43371b306 161 /* If enabled, Unity assumes you want your `FLOAT` asserts to compare standard C
ram54288 0:a7a43371b306 162 * floats. If your compiler supports a specialty floating point type, you can
ram54288 0:a7a43371b306 163 * always override this behavior by using this definition.
ram54288 0:a7a43371b306 164 *
ram54288 0:a7a43371b306 165 * Example:
ram54288 0:a7a43371b306 166 */
ram54288 0:a7a43371b306 167 /* #define UNITY_FLOAT_TYPE float16_t */
ram54288 0:a7a43371b306 168
ram54288 0:a7a43371b306 169 /* If enabled, Unity assumes you want your `DOUBLE` asserts to compare standard
ram54288 0:a7a43371b306 170 * C doubles. If you would like to change this, you can specify something else
ram54288 0:a7a43371b306 171 * by using this option. For example, defining `UNITY_DOUBLE_TYPE` to `long
ram54288 0:a7a43371b306 172 * double` could enable gargantuan floating point types on your 64-bit processor
ram54288 0:a7a43371b306 173 * instead of the standard `double`.
ram54288 0:a7a43371b306 174 *
ram54288 0:a7a43371b306 175 * Example:
ram54288 0:a7a43371b306 176 */
ram54288 0:a7a43371b306 177 /* #define UNITY_DOUBLE_TYPE long double */
ram54288 0:a7a43371b306 178
ram54288 0:a7a43371b306 179 /* If you look up `UNITY_ASSERT_EQUAL_FLOAT` and `UNITY_ASSERT_EQUAL_DOUBLE` as
ram54288 0:a7a43371b306 180 * documented in the Unity Assertion Guide, you will learn that they are not
ram54288 0:a7a43371b306 181 * really asserting that two values are equal but rather that two values are
ram54288 0:a7a43371b306 182 * "close enough" to equal. "Close enough" is controlled by these precision
ram54288 0:a7a43371b306 183 * configuration options. If you are working with 32-bit floats and/or 64-bit
ram54288 0:a7a43371b306 184 * doubles (the normal on most processors), you should have no need to change
ram54288 0:a7a43371b306 185 * these options. They are both set to give you approximately 1 significant bit
ram54288 0:a7a43371b306 186 * in either direction. The float precision is 0.00001 while the double is
ram54288 0:a7a43371b306 187 * 10^-12. For further details on how this works, see the appendix of the Unity
ram54288 0:a7a43371b306 188 * Assertion Guide.
ram54288 0:a7a43371b306 189 *
ram54288 0:a7a43371b306 190 * Example:
ram54288 0:a7a43371b306 191 */
ram54288 0:a7a43371b306 192 /* #define UNITY_FLOAT_PRECISION 0.001f */
ram54288 0:a7a43371b306 193 /* #define UNITY_DOUBLE_PRECISION 0.001f */
ram54288 0:a7a43371b306 194
ram54288 0:a7a43371b306 195
ram54288 0:a7a43371b306 196 /* *************************** TOOLSET CUSTOMIZATION ***************************
ram54288 0:a7a43371b306 197 * In addition to the options listed above, there are a number of other options
ram54288 0:a7a43371b306 198 * which will come in handy to customize Unity's behavior for your specific
ram54288 0:a7a43371b306 199 * toolchain. It is possible that you may not need to touch any of these but
ram54288 0:a7a43371b306 200 * certain platforms, particularly those running in simulators, may need to jump
ram54288 0:a7a43371b306 201 * through extra hoops to operate properly. These macros will help in those
ram54288 0:a7a43371b306 202 * situations.
ram54288 0:a7a43371b306 203 **************************************************************************** */
ram54288 0:a7a43371b306 204
ram54288 0:a7a43371b306 205 /* By default, Unity prints its results to `stdout` as it runs. This works
ram54288 0:a7a43371b306 206 * perfectly fine in most situations where you are using a native compiler for
ram54288 0:a7a43371b306 207 * testing. It works on some simulators as well so long as they have `stdout`
ram54288 0:a7a43371b306 208 * routed back to the command line. There are times, however, where the
ram54288 0:a7a43371b306 209 * simulator will lack support for dumping results or you will want to route
ram54288 0:a7a43371b306 210 * results elsewhere for other reasons. In these cases, you should define the
ram54288 0:a7a43371b306 211 * `UNITY_OUTPUT_CHAR` macro. This macro accepts a single character at a time
ram54288 0:a7a43371b306 212 * (as an `int`, since this is the parameter type of the standard C `putchar`
ram54288 0:a7a43371b306 213 * function most commonly used). You may replace this with whatever function
ram54288 0:a7a43371b306 214 * call you like.
ram54288 0:a7a43371b306 215 *
ram54288 0:a7a43371b306 216 * Example:
ram54288 0:a7a43371b306 217 * Say you are forced to run your test suite on an embedded processor with no
ram54288 0:a7a43371b306 218 * `stdout` option. You decide to route your test result output to a custom
ram54288 0:a7a43371b306 219 * serial `RS232_putc()` function you wrote like thus:
ram54288 0:a7a43371b306 220 */
ram54288 0:a7a43371b306 221 /* #define UNITY_OUTPUT_CHAR(a) RS232_putc(a) */
ram54288 0:a7a43371b306 222 /* #define UNITY_OUTPUT_FLUSH() RS232_config(115200,1,8,0) */
ram54288 0:a7a43371b306 223 /* #define UNITY_OUTPUT_START() RS232_flush() */
ram54288 0:a7a43371b306 224 /* #define UNITY_OUTPUT_COMPLETE() RS232_close() */
ram54288 0:a7a43371b306 225
ram54288 0:a7a43371b306 226 /* For some targets, Unity can make the otherwise required `setUp()` and
ram54288 0:a7a43371b306 227 * `tearDown()` functions optional. This is a nice convenience for test writers
ram54288 0:a7a43371b306 228 * since `setUp` and `tearDown` don't often actually _do_ anything. If you're
ram54288 0:a7a43371b306 229 * using gcc or clang, this option is automatically defined for you. Other
ram54288 0:a7a43371b306 230 * compilers can also support this behavior, if they support a C feature called
ram54288 0:a7a43371b306 231 * weak functions. A weak function is a function that is compiled into your
ram54288 0:a7a43371b306 232 * executable _unless_ a non-weak version of the same function is defined
ram54288 0:a7a43371b306 233 * elsewhere. If a non-weak version is found, the weak version is ignored as if
ram54288 0:a7a43371b306 234 * it never existed. If your compiler supports this feature, you can let Unity
ram54288 0:a7a43371b306 235 * know by defining `UNITY_SUPPORT_WEAK` as the function attributes that would
ram54288 0:a7a43371b306 236 * need to be applied to identify a function as weak. If your compiler lacks
ram54288 0:a7a43371b306 237 * support for weak functions, you will always need to define `setUp` and
ram54288 0:a7a43371b306 238 * `tearDown` functions (though they can be and often will be just empty). The
ram54288 0:a7a43371b306 239 * most common options for this feature are:
ram54288 0:a7a43371b306 240 */
ram54288 0:a7a43371b306 241 /* #define UNITY_SUPPORT_WEAK weak */
ram54288 0:a7a43371b306 242 /* #define UNITY_SUPPORT_WEAK __attribute__((weak)) */
ram54288 0:a7a43371b306 243
ram54288 0:a7a43371b306 244 /* Some compilers require a custom attribute to be assigned to pointers, like
ram54288 0:a7a43371b306 245 * `near` or `far`. In these cases, you can give Unity a safe default for these
ram54288 0:a7a43371b306 246 * by defining this option with the attribute you would like.
ram54288 0:a7a43371b306 247 *
ram54288 0:a7a43371b306 248 * Example:
ram54288 0:a7a43371b306 249 */
ram54288 0:a7a43371b306 250 /* #define UNITY_PTR_ATTRIBUTE __attribute__((far)) */
ram54288 0:a7a43371b306 251 /* #define UNITY_PTR_ATTRIBUTE near */
ram54288 0:a7a43371b306 252
ram54288 0:a7a43371b306 253 #ifdef __cplusplus
ram54288 0:a7a43371b306 254 }
ram54288 0:a7a43371b306 255 #endif /* extern "C" */
ram54288 0:a7a43371b306 256
ram54288 0:a7a43371b306 257 #endif /* UNITY_CONFIG_H */