Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Thu Mar 16 21:58:09 2017 +0900
Revision:
6:40e873bbc5f7
Add licence header info

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 6:40e873bbc5f7 1
MACRUM 6:40e873bbc5f7 2 /** \addtogroup platform */
MACRUM 6:40e873bbc5f7 3 /** @{*/
MACRUM 6:40e873bbc5f7 4 /* mbed Microcontroller Library
MACRUM 6:40e873bbc5f7 5 * Copyright (c) 2006-2013 ARM Limited
MACRUM 6:40e873bbc5f7 6 *
MACRUM 6:40e873bbc5f7 7 * Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 6:40e873bbc5f7 8 * you may not use this file except in compliance with the License.
MACRUM 6:40e873bbc5f7 9 * You may obtain a copy of the License at
MACRUM 6:40e873bbc5f7 10 *
MACRUM 6:40e873bbc5f7 11 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 6:40e873bbc5f7 12 *
MACRUM 6:40e873bbc5f7 13 * Unless required by applicable law or agreed to in writing, software
MACRUM 6:40e873bbc5f7 14 * distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 6:40e873bbc5f7 15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 6:40e873bbc5f7 16 * See the License for the specific language governing permissions and
MACRUM 6:40e873bbc5f7 17 * limitations under the License.
MACRUM 6:40e873bbc5f7 18 */
MACRUM 6:40e873bbc5f7 19 #ifndef MBED_ERROR_H
MACRUM 6:40e873bbc5f7 20 #define MBED_ERROR_H
MACRUM 6:40e873bbc5f7 21
MACRUM 6:40e873bbc5f7 22 /** To generate a fatal compile-time error, you can use the pre-processor #error directive.
MACRUM 6:40e873bbc5f7 23 *
MACRUM 6:40e873bbc5f7 24 * @code
MACRUM 6:40e873bbc5f7 25 * #error "That shouldn't have happened!"
MACRUM 6:40e873bbc5f7 26 * @endcode
MACRUM 6:40e873bbc5f7 27 *
MACRUM 6:40e873bbc5f7 28 * If the compiler evaluates this line, it will report the error and stop the compile.
MACRUM 6:40e873bbc5f7 29 *
MACRUM 6:40e873bbc5f7 30 * For example, you could use this to check some user-defined compile-time variables:
MACRUM 6:40e873bbc5f7 31 *
MACRUM 6:40e873bbc5f7 32 * @code
MACRUM 6:40e873bbc5f7 33 * #define NUM_PORTS 7
MACRUM 6:40e873bbc5f7 34 * #if (NUM_PORTS > 4)
MACRUM 6:40e873bbc5f7 35 * #error "NUM_PORTS must be less than 4"
MACRUM 6:40e873bbc5f7 36 * #endif
MACRUM 6:40e873bbc5f7 37 * @endcode
MACRUM 6:40e873bbc5f7 38 *
MACRUM 6:40e873bbc5f7 39 * Reporting Run-Time Errors:
MACRUM 6:40e873bbc5f7 40 * To generate a fatal run-time error, you can use the mbed error() function.
MACRUM 6:40e873bbc5f7 41 *
MACRUM 6:40e873bbc5f7 42 * @code
MACRUM 6:40e873bbc5f7 43 * error("That shouldn't have happened!");
MACRUM 6:40e873bbc5f7 44 * @endcode
MACRUM 6:40e873bbc5f7 45 *
MACRUM 6:40e873bbc5f7 46 * If the mbed running the program executes this function, it will print the
MACRUM 6:40e873bbc5f7 47 * message via the USB serial port, and then die with the blue lights of death!
MACRUM 6:40e873bbc5f7 48 *
MACRUM 6:40e873bbc5f7 49 * The message can use printf-style formatting, so you can report variables in the
MACRUM 6:40e873bbc5f7 50 * message too. For example, you could use this to check a run-time condition:
MACRUM 6:40e873bbc5f7 51 *
MACRUM 6:40e873bbc5f7 52 * @code
MACRUM 6:40e873bbc5f7 53 * if(x >= 5) {
MACRUM 6:40e873bbc5f7 54 * error("expected x to be less than 5, but got %d", x);
MACRUM 6:40e873bbc5f7 55 * }
MACRUM 6:40e873bbc5f7 56 * #endcode
MACRUM 6:40e873bbc5f7 57 */
MACRUM 6:40e873bbc5f7 58
MACRUM 6:40e873bbc5f7 59 #ifdef __cplusplus
MACRUM 6:40e873bbc5f7 60 extern "C" {
MACRUM 6:40e873bbc5f7 61 #endif
MACRUM 6:40e873bbc5f7 62
MACRUM 6:40e873bbc5f7 63 void error(const char* format, ...);
MACRUM 6:40e873bbc5f7 64
MACRUM 6:40e873bbc5f7 65 #ifdef __cplusplus
MACRUM 6:40e873bbc5f7 66 }
MACRUM 6:40e873bbc5f7 67 #endif
MACRUM 6:40e873bbc5f7 68
MACRUM 6:40e873bbc5f7 69 #endif
MACRUM 6:40e873bbc5f7 70
MACRUM 6:40e873bbc5f7 71 /** @}*/