Opencv 3.1 project on GR-PEACH board

Fork of gr-peach-opencv-project by the do

Committer:
thedo
Date:
Tue Jul 04 06:23:13 2017 +0000
Revision:
170:54ff26da7eb6
Parent:
167:1657b442184c
project opencv 3.1 on GR PEACH board, no use SD card.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
thedo 167:1657b442184c 1
thedo 167:1657b442184c 2 /** \addtogroup platform */
thedo 167:1657b442184c 3 /** @{*/
thedo 167:1657b442184c 4 /* mbed Microcontroller Library
thedo 167:1657b442184c 5 * Copyright (c) 2006-2013 ARM Limited
thedo 167:1657b442184c 6 *
thedo 167:1657b442184c 7 * Licensed under the Apache License, Version 2.0 (the "License");
thedo 167:1657b442184c 8 * you may not use this file except in compliance with the License.
thedo 167:1657b442184c 9 * You may obtain a copy of the License at
thedo 167:1657b442184c 10 *
thedo 167:1657b442184c 11 * http://www.apache.org/licenses/LICENSE-2.0
thedo 167:1657b442184c 12 *
thedo 167:1657b442184c 13 * Unless required by applicable law or agreed to in writing, software
thedo 167:1657b442184c 14 * distributed under the License is distributed on an "AS IS" BASIS,
thedo 167:1657b442184c 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
thedo 167:1657b442184c 16 * See the License for the specific language governing permissions and
thedo 167:1657b442184c 17 * limitations under the License.
thedo 167:1657b442184c 18 */
thedo 167:1657b442184c 19 #ifndef MBED_TOOLCHAIN_H
thedo 167:1657b442184c 20 #define MBED_TOOLCHAIN_H
thedo 167:1657b442184c 21
thedo 167:1657b442184c 22 #include "mbed_preprocessor.h"
thedo 167:1657b442184c 23
thedo 167:1657b442184c 24
thedo 167:1657b442184c 25 // Warning for unsupported compilers
thedo 167:1657b442184c 26 #if !defined(__GNUC__) /* GCC */ \
thedo 167:1657b442184c 27 && !defined(__CC_ARM) /* ARMCC */ \
thedo 167:1657b442184c 28 && !defined(__clang__) /* LLVM/Clang */ \
thedo 167:1657b442184c 29 && !defined(__ICCARM__) /* IAR */
thedo 167:1657b442184c 30 #warning "This compiler is not yet supported."
thedo 167:1657b442184c 31 #endif
thedo 167:1657b442184c 32
thedo 167:1657b442184c 33
thedo 167:1657b442184c 34 // Attributes
thedo 167:1657b442184c 35
thedo 167:1657b442184c 36 /** MBED_PACKED
thedo 167:1657b442184c 37 * Pack a structure, preventing any padding from being added between fields.
thedo 167:1657b442184c 38 *
thedo 167:1657b442184c 39 * @code
thedo 167:1657b442184c 40 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 41 *
thedo 167:1657b442184c 42 * MBED_PACKED(struct) foo {
thedo 167:1657b442184c 43 * char x;
thedo 167:1657b442184c 44 * int y;
thedo 167:1657b442184c 45 * };
thedo 167:1657b442184c 46 * @endcode
thedo 167:1657b442184c 47 */
thedo 167:1657b442184c 48 #ifndef MBED_PACKED
thedo 167:1657b442184c 49 #if defined(__ICCARM__)
thedo 167:1657b442184c 50 #define MBED_PACKED(struct) __packed struct
thedo 167:1657b442184c 51 #else
thedo 167:1657b442184c 52 #define MBED_PACKED(struct) struct __attribute__((packed))
thedo 167:1657b442184c 53 #endif
thedo 167:1657b442184c 54 #endif
thedo 167:1657b442184c 55
thedo 167:1657b442184c 56 /** MBED_ALIGN(N)
thedo 167:1657b442184c 57 * Declare a variable to be aligned on an N-byte boundary.
thedo 167:1657b442184c 58 *
thedo 167:1657b442184c 59 * @note
thedo 167:1657b442184c 60 * IAR does not support alignment greater than word size on the stack
thedo 167:1657b442184c 61 *
thedo 167:1657b442184c 62 * @code
thedo 167:1657b442184c 63 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 64 *
thedo 167:1657b442184c 65 * MBED_ALIGN(16) char a;
thedo 167:1657b442184c 66 * @endcode
thedo 167:1657b442184c 67 */
thedo 167:1657b442184c 68 #ifndef MBED_ALIGN
thedo 167:1657b442184c 69 #if defined(__ICCARM__)
thedo 167:1657b442184c 70 #define MBED_ALIGN(N) _Pragma(MBED_STRINGIFY(data_alignment=N))
thedo 167:1657b442184c 71 #else
thedo 167:1657b442184c 72 #define MBED_ALIGN(N) __attribute__((aligned(N)))
thedo 167:1657b442184c 73 #endif
thedo 167:1657b442184c 74 #endif
thedo 167:1657b442184c 75
thedo 167:1657b442184c 76 /** MBED_UNUSED
thedo 167:1657b442184c 77 * Declare a function argument to be unused, suppressing compiler warnings
thedo 167:1657b442184c 78 *
thedo 167:1657b442184c 79 * @code
thedo 167:1657b442184c 80 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 81 *
thedo 167:1657b442184c 82 * void foo(MBED_UNUSED int arg) {
thedo 167:1657b442184c 83 *
thedo 167:1657b442184c 84 * }
thedo 167:1657b442184c 85 * @endcode
thedo 167:1657b442184c 86 */
thedo 167:1657b442184c 87 #ifndef MBED_UNUSED
thedo 167:1657b442184c 88 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
thedo 167:1657b442184c 89 #define MBED_UNUSED __attribute__((__unused__))
thedo 167:1657b442184c 90 #else
thedo 167:1657b442184c 91 #define MBED_UNUSED
thedo 167:1657b442184c 92 #endif
thedo 167:1657b442184c 93 #endif
thedo 167:1657b442184c 94
thedo 167:1657b442184c 95 /** MBED_WEAK
thedo 167:1657b442184c 96 * Mark a function as being weak.
thedo 167:1657b442184c 97 *
thedo 167:1657b442184c 98 * @note
thedo 167:1657b442184c 99 * weak functions are not friendly to making code re-usable, as they can only
thedo 167:1657b442184c 100 * be overridden once (and if they are multiply overridden the linker will emit
thedo 167:1657b442184c 101 * no warning). You should not normally use weak symbols as part of the API to
thedo 167:1657b442184c 102 * re-usable modules.
thedo 167:1657b442184c 103 *
thedo 167:1657b442184c 104 * @code
thedo 167:1657b442184c 105 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 106 *
thedo 167:1657b442184c 107 * MBED_WEAK void foo() {
thedo 167:1657b442184c 108 * // a weak implementation of foo that can be overriden by a definition
thedo 167:1657b442184c 109 * // without __weak
thedo 167:1657b442184c 110 * }
thedo 167:1657b442184c 111 * @endcode
thedo 167:1657b442184c 112 */
thedo 167:1657b442184c 113 #ifndef MBED_WEAK
thedo 167:1657b442184c 114 #if defined(__ICCARM__)
thedo 167:1657b442184c 115 #define MBED_WEAK __weak
thedo 167:1657b442184c 116 #else
thedo 167:1657b442184c 117 #define MBED_WEAK __attribute__((weak))
thedo 167:1657b442184c 118 #endif
thedo 167:1657b442184c 119 #endif
thedo 167:1657b442184c 120
thedo 167:1657b442184c 121 /** MBED_PURE
thedo 167:1657b442184c 122 * Hint to the compiler that a function depends only on parameters
thedo 167:1657b442184c 123 *
thedo 167:1657b442184c 124 * @code
thedo 167:1657b442184c 125 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 126 *
thedo 167:1657b442184c 127 * MBED_PURE int foo(int arg){
thedo 167:1657b442184c 128 * // no access to global variables
thedo 167:1657b442184c 129 * }
thedo 167:1657b442184c 130 * @endcode
thedo 167:1657b442184c 131 */
thedo 167:1657b442184c 132 #ifndef MBED_PURE
thedo 167:1657b442184c 133 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
thedo 167:1657b442184c 134 #define MBED_PURE __attribute__((const))
thedo 167:1657b442184c 135 #else
thedo 167:1657b442184c 136 #define MBED_PURE
thedo 167:1657b442184c 137 #endif
thedo 167:1657b442184c 138 #endif
thedo 167:1657b442184c 139
thedo 167:1657b442184c 140 /** MBED_FORCEINLINE
thedo 167:1657b442184c 141 * Declare a function that must always be inlined. Failure to inline
thedo 167:1657b442184c 142 * such a function will result in an error.
thedo 167:1657b442184c 143 *
thedo 167:1657b442184c 144 * @code
thedo 167:1657b442184c 145 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 146 *
thedo 167:1657b442184c 147 * MBED_FORCEINLINE void foo() {
thedo 167:1657b442184c 148 *
thedo 167:1657b442184c 149 * }
thedo 167:1657b442184c 150 * @endcode
thedo 167:1657b442184c 151 */
thedo 167:1657b442184c 152 #ifndef MBED_FORCEINLINE
thedo 167:1657b442184c 153 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
thedo 167:1657b442184c 154 #define MBED_FORCEINLINE static inline __attribute__((always_inline))
thedo 167:1657b442184c 155 #elif defined(__ICCARM__)
thedo 167:1657b442184c 156 #define MBED_FORCEINLINE _Pragma("inline=forced") static
thedo 167:1657b442184c 157 #else
thedo 167:1657b442184c 158 #define MBED_FORCEINLINE static inline
thedo 167:1657b442184c 159 #endif
thedo 167:1657b442184c 160 #endif
thedo 167:1657b442184c 161
thedo 167:1657b442184c 162 /** MBED_NORETURN
thedo 167:1657b442184c 163 * Declare a function that will never return.
thedo 167:1657b442184c 164 *
thedo 167:1657b442184c 165 * @code
thedo 167:1657b442184c 166 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 167 *
thedo 167:1657b442184c 168 * MBED_NORETURN void foo() {
thedo 167:1657b442184c 169 * // must never return
thedo 167:1657b442184c 170 * while (1) {}
thedo 167:1657b442184c 171 * }
thedo 167:1657b442184c 172 * @endcode
thedo 167:1657b442184c 173 */
thedo 167:1657b442184c 174 #ifndef MBED_NORETURN
thedo 167:1657b442184c 175 #if defined(__GNUC__) || defined(__clang__) || defined(__CC_ARM)
thedo 167:1657b442184c 176 #define MBED_NORETURN __attribute__((noreturn))
thedo 167:1657b442184c 177 #elif defined(__ICCARM__)
thedo 167:1657b442184c 178 #define MBED_NORETURN __noreturn
thedo 167:1657b442184c 179 #else
thedo 167:1657b442184c 180 #define MBED_NORETURN
thedo 167:1657b442184c 181 #endif
thedo 167:1657b442184c 182 #endif
thedo 167:1657b442184c 183
thedo 167:1657b442184c 184 /** MBED_UNREACHABLE
thedo 167:1657b442184c 185 * An unreachable statement. If the statement is reached,
thedo 167:1657b442184c 186 * behaviour is undefined. Useful in situations where the compiler
thedo 167:1657b442184c 187 * cannot deduce the unreachability of code.
thedo 167:1657b442184c 188 *
thedo 167:1657b442184c 189 * @code
thedo 167:1657b442184c 190 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 191 *
thedo 167:1657b442184c 192 * void foo(int arg) {
thedo 167:1657b442184c 193 * switch (arg) {
thedo 167:1657b442184c 194 * case 1: return 1;
thedo 167:1657b442184c 195 * case 2: return 2;
thedo 167:1657b442184c 196 * ...
thedo 167:1657b442184c 197 * }
thedo 167:1657b442184c 198 * MBED_UNREACHABLE;
thedo 167:1657b442184c 199 * }
thedo 167:1657b442184c 200 * @endcode
thedo 167:1657b442184c 201 */
thedo 167:1657b442184c 202 #ifndef MBED_UNREACHABLE
thedo 167:1657b442184c 203 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
thedo 167:1657b442184c 204 #define MBED_UNREACHABLE __builtin_unreachable()
thedo 167:1657b442184c 205 #else
thedo 167:1657b442184c 206 #define MBED_UNREACHABLE while (1)
thedo 167:1657b442184c 207 #endif
thedo 167:1657b442184c 208 #endif
thedo 167:1657b442184c 209
thedo 167:1657b442184c 210 /** MBED_DEPRECATED("message string")
thedo 167:1657b442184c 211 * Mark a function declaration as deprecated, if it used then a warning will be
thedo 167:1657b442184c 212 * issued by the compiler possibly including the provided message. Note that not
thedo 167:1657b442184c 213 * all compilers are able to display the message.
thedo 167:1657b442184c 214 *
thedo 167:1657b442184c 215 * @code
thedo 167:1657b442184c 216 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 217 *
thedo 167:1657b442184c 218 * MBED_DEPRECATED("don't foo any more, bar instead")
thedo 167:1657b442184c 219 * void foo(int arg);
thedo 167:1657b442184c 220 * @endcode
thedo 167:1657b442184c 221 */
thedo 167:1657b442184c 222 #ifndef MBED_DEPRECATED
thedo 167:1657b442184c 223 #if defined(__CC_ARM)
thedo 167:1657b442184c 224 #define MBED_DEPRECATED(M) __attribute__((deprecated))
thedo 167:1657b442184c 225 #elif defined(__GNUC__) || defined(__clang__)
thedo 167:1657b442184c 226 #define MBED_DEPRECATED(M) __attribute__((deprecated(M)))
thedo 167:1657b442184c 227 #else
thedo 167:1657b442184c 228 #define MBED_DEPRECATED(M)
thedo 167:1657b442184c 229 #endif
thedo 167:1657b442184c 230 #endif
thedo 167:1657b442184c 231
thedo 167:1657b442184c 232 /** MBED_DEPRECATED_SINCE("version", "message string")
thedo 167:1657b442184c 233 * Mark a function declaration as deprecated, noting that the declaration was
thedo 167:1657b442184c 234 * deprecated on the specified version. If the function is used then a warning
thedo 167:1657b442184c 235 * will be issued by the compiler possibly including the provided message.
thedo 167:1657b442184c 236 * Note that not all compilers are able to display this message.
thedo 167:1657b442184c 237 *
thedo 167:1657b442184c 238 * @code
thedo 167:1657b442184c 239 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 240 *
thedo 167:1657b442184c 241 * MBED_DEPRECATED_SINCE("mbed-os-5.1", "don't foo any more, bar instead")
thedo 167:1657b442184c 242 * void foo(int arg);
thedo 167:1657b442184c 243 * @endcode
thedo 167:1657b442184c 244 */
thedo 167:1657b442184c 245 #define MBED_DEPRECATED_SINCE(D, M) MBED_DEPRECATED(M " [since " D "]")
thedo 167:1657b442184c 246
thedo 167:1657b442184c 247 /** MBED_CALLER_ADDR()
thedo 167:1657b442184c 248 * Returns the caller of the current function.
thedo 167:1657b442184c 249 *
thedo 167:1657b442184c 250 * @note
thedo 167:1657b442184c 251 * This macro is only implemented for GCC and ARMCC.
thedo 167:1657b442184c 252 *
thedo 167:1657b442184c 253 * @code
thedo 167:1657b442184c 254 * #include "mbed_toolchain.h"
thedo 167:1657b442184c 255 *
thedo 167:1657b442184c 256 * printf("This function was called from %p", MBED_CALLER_ADDR());
thedo 167:1657b442184c 257 * @endcode
thedo 167:1657b442184c 258 *
thedo 167:1657b442184c 259 * @return Address of the calling function
thedo 167:1657b442184c 260 */
thedo 167:1657b442184c 261 #ifndef MBED_CALLER_ADDR
thedo 167:1657b442184c 262 #if (defined(__GNUC__) || defined(__clang__)) && !defined(__CC_ARM)
thedo 167:1657b442184c 263 #define MBED_CALLER_ADDR() __builtin_extract_return_addr(__builtin_return_address(0))
thedo 167:1657b442184c 264 #elif defined(__CC_ARM)
thedo 167:1657b442184c 265 #define MBED_CALLER_ADDR() __builtin_return_address(0)
thedo 167:1657b442184c 266 #else
thedo 167:1657b442184c 267 #define MBED_CALLER_ADDR() (NULL)
thedo 167:1657b442184c 268 #endif
thedo 167:1657b442184c 269 #endif
thedo 167:1657b442184c 270
thedo 167:1657b442184c 271 #ifndef MBED_SECTION
thedo 167:1657b442184c 272 #if (defined(__GNUC__) || defined(__clang__)) || defined(__CC_ARM)
thedo 167:1657b442184c 273 #define MBED_SECTION(name) __attribute__ ((section (name)))
thedo 167:1657b442184c 274 #elif defined(__ICCARM__)
thedo 167:1657b442184c 275 #define MBED_SECTION(name) _Pragma(MBED_STRINGIFY(location=name))
thedo 167:1657b442184c 276 #else
thedo 167:1657b442184c 277 #error "Missing MBED_SECTION directive"
thedo 167:1657b442184c 278 #endif
thedo 167:1657b442184c 279 #endif
thedo 167:1657b442184c 280
thedo 167:1657b442184c 281 #ifndef MBED_PRINTF
thedo 167:1657b442184c 282 #if defined(__GNUC__) || defined(__CC_ARM)
thedo 167:1657b442184c 283 #define MBED_PRINTF(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx, first_param_idx)))
thedo 167:1657b442184c 284 #else
thedo 167:1657b442184c 285 #define MBED_PRINTF(format_idx, first_param_idx)
thedo 167:1657b442184c 286 #endif
thedo 167:1657b442184c 287 #endif
thedo 167:1657b442184c 288
thedo 167:1657b442184c 289 #ifndef MBED_PRINTF_METHOD
thedo 167:1657b442184c 290 #if defined(__GNUC__) || defined(__CC_ARM)
thedo 167:1657b442184c 291 #define MBED_PRINTF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__printf__, format_idx+1, first_param_idx+1)))
thedo 167:1657b442184c 292 #else
thedo 167:1657b442184c 293 #define MBED_PRINTF_METHOD(format_idx, first_param_idx)
thedo 167:1657b442184c 294 #endif
thedo 167:1657b442184c 295 #endif
thedo 167:1657b442184c 296
thedo 167:1657b442184c 297 #ifndef MBED_SCANF
thedo 167:1657b442184c 298 #if defined(__GNUC__) || defined(__CC_ARM)
thedo 167:1657b442184c 299 #define MBED_SCANF(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx, first_param_idx)))
thedo 167:1657b442184c 300 #else
thedo 167:1657b442184c 301 #define MBED_SCANF(format_idx, first_param_idx)
thedo 167:1657b442184c 302 #endif
thedo 167:1657b442184c 303 #endif
thedo 167:1657b442184c 304
thedo 167:1657b442184c 305 #ifndef MBED_SCANF_METHOD
thedo 167:1657b442184c 306 #if defined(__GNUC__) || defined(__CC_ARM)
thedo 167:1657b442184c 307 #define MBED_SCANF_METHOD(format_idx, first_param_idx) __attribute__ ((__format__(__scanf__, format_idx+1, first_param_idx+1)))
thedo 167:1657b442184c 308 #else
thedo 167:1657b442184c 309 #define MBED_SCANF_METHOD(format_idx, first_param_idx)
thedo 167:1657b442184c 310 #endif
thedo 167:1657b442184c 311 #endif
thedo 167:1657b442184c 312
thedo 167:1657b442184c 313 // FILEHANDLE declaration
thedo 167:1657b442184c 314 #if defined(TOOLCHAIN_ARM)
thedo 167:1657b442184c 315 #include <rt_sys.h>
thedo 167:1657b442184c 316 #endif
thedo 167:1657b442184c 317
thedo 167:1657b442184c 318 #ifndef FILEHANDLE
thedo 167:1657b442184c 319 typedef int FILEHANDLE;
thedo 167:1657b442184c 320 #endif
thedo 167:1657b442184c 321
thedo 167:1657b442184c 322 // Backwards compatibility
thedo 167:1657b442184c 323 #ifndef WEAK
thedo 167:1657b442184c 324 #define WEAK MBED_WEAK
thedo 167:1657b442184c 325 #endif
thedo 167:1657b442184c 326
thedo 167:1657b442184c 327 #ifndef PACKED
thedo 167:1657b442184c 328 #define PACKED MBED_PACKED()
thedo 167:1657b442184c 329 #endif
thedo 167:1657b442184c 330
thedo 167:1657b442184c 331 #ifndef EXTERN
thedo 167:1657b442184c 332 #define EXTERN extern
thedo 167:1657b442184c 333 #endif
thedo 167:1657b442184c 334
thedo 167:1657b442184c 335 #endif
thedo 167:1657b442184c 336
thedo 167:1657b442184c 337 /** @}*/
thedo 167:1657b442184c 338