Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Mon Dec 10 00:46:12 2018 +0000
Revision:
9:cf8652c08e46
Parent:
8:09f55ce7afee
Child:
10:9a8be9fef9e7
Update library

Who changed what in which revision?

UserRevisionLine numberNew contents of line
MACRUM 6:40e873bbc5f7 1 /**
MACRUM 6:40e873bbc5f7 2 ******************************************************************************
MACRUM 6:40e873bbc5f7 3 * @file main.cpp
MACRUM 6:40e873bbc5f7 4 * @author Toyomasa Watarai
MACRUM 6:40e873bbc5f7 5 * @version V1.0.0
MACRUM 6:40e873bbc5f7 6 * @date 16 March 2017
MACRUM 6:40e873bbc5f7 7 * @brief armcc pre-defined macro check progmra
MACRUM 6:40e873bbc5f7 8 ******************************************************************************
MACRUM 6:40e873bbc5f7 9 * @attention
MACRUM 6:40e873bbc5f7 10 *
MACRUM 6:40e873bbc5f7 11 * Licensed under the Apache License, Version 2.0 (the "License");
MACRUM 6:40e873bbc5f7 12 * you may not use this file except in compliance with the License.
MACRUM 6:40e873bbc5f7 13 * You may obtain a copy of the License at
MACRUM 6:40e873bbc5f7 14 *
MACRUM 6:40e873bbc5f7 15 * http://www.apache.org/licenses/LICENSE-2.0
MACRUM 6:40e873bbc5f7 16 *
MACRUM 6:40e873bbc5f7 17 * Unless required by applicable law or agreed to in writing, software
MACRUM 6:40e873bbc5f7 18 * distributed under the License is distributed on an "AS IS" BASIS,
MACRUM 6:40e873bbc5f7 19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
MACRUM 6:40e873bbc5f7 20 * See the License for the specific language governing permissions and
MACRUM 6:40e873bbc5f7 21 * limitations under the License.
MACRUM 6:40e873bbc5f7 22 */
MACRUM 8:09f55ce7afee 23 #include "mbed.h"
MACRUM 0:99f7e7890e03 24
MACRUM 4:2b25b7a2c5fd 25 #define xstr(s) str(s)
MACRUM 4:2b25b7a2c5fd 26 #define str(s) #s
MACRUM 4:2b25b7a2c5fd 27
MACRUM 4:2b25b7a2c5fd 28 #if defined(TARGET_SAMD21J18A)
MACRUM 4:2b25b7a2c5fd 29 Serial pc(PB22, PB23); // tx, rx
MACRUM 4:2b25b7a2c5fd 30 DigitalOut myled(PA17, 0);
MACRUM 4:2b25b7a2c5fd 31 #elif defined(TARGET_LPC1768)
MACRUM 4:2b25b7a2c5fd 32 #define LED1 P0_22
MACRUM 0:99f7e7890e03 33 Serial pc(USBTX, USBRX); // tx, rx
MACRUM 6:40e873bbc5f7 34 DigitalOut myled(LED2, 1);
MACRUM 4:2b25b7a2c5fd 35 #else
MACRUM 4:2b25b7a2c5fd 36 Serial pc(USBTX, USBRX); // tx, rx
MACRUM 4:2b25b7a2c5fd 37 DigitalOut myled(LED1, 0);
MACRUM 4:2b25b7a2c5fd 38 #endif
MACRUM 0:99f7e7890e03 39
MACRUM 0:99f7e7890e03 40 int main() {
MACRUM 4:2b25b7a2c5fd 41 pc.printf("\n");
MACRUM 4:2b25b7a2c5fd 42 pc.printf("System Clock = %d\n", SystemCoreClock);
MACRUM 1:5d5b5bd67e5b 43 #ifdef MBED_USERNAME
MACRUM 4:2b25b7a2c5fd 44 pc.printf("mbed username: %s\n", xstr(MBED_USERNAME));
MACRUM 1:5d5b5bd67e5b 45 #endif
MACRUM 9:cf8652c08e46 46 #ifdef MBED_LIBRARY_VERSION
MACRUM 3:b802baa84f98 47 pc.printf("mbed library version: %d\n", MBED_LIBRARY_VERSION);
MACRUM 9:cf8652c08e46 48 #endif
MACRUM 8:09f55ce7afee 49 #ifdef MBED_CONF_RTOS_PRESENT
MACRUM 8:09f55ce7afee 50 pc.printf("Mbed OS %d.%d.%d\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
MACRUM 8:09f55ce7afee 51 #endif
MACRUM 8:09f55ce7afee 52
MACRUM 2:fe7a36257939 53 #ifdef __CC_ARM
MACRUM 4:2b25b7a2c5fd 54 #ifdef __MICROLIB
MACRUM 4:2b25b7a2c5fd 55 pc.printf("Built with ARM compiler and micro library (uARM)\n");
MACRUM 4:2b25b7a2c5fd 56 #else
MACRUM 4:2b25b7a2c5fd 57 pc.printf("Built with ARM compiler and standard library (ARM)\n");
MACRUM 4:2b25b7a2c5fd 58 #endif
MACRUM 0:99f7e7890e03 59 pc.printf("ARM Compiler version : %d\n", __ARMCC_VERSION);
MACRUM 0:99f7e7890e03 60
MACRUM 0:99f7e7890e03 61 #ifdef __ARM_NEON__
MACRUM 0:99f7e7890e03 62 pc.printf("NEON is available\n");
MACRUM 0:99f7e7890e03 63 #else
MACRUM 0:99f7e7890e03 64 pc.printf("NEON is not available\n");
MACRUM 0:99f7e7890e03 65 #endif
MACRUM 0:99f7e7890e03 66
MACRUM 0:99f7e7890e03 67 #ifdef __APCS_INTERWORK
MACRUM 0:99f7e7890e03 68 pc.printf("ARM/Thumb Interworking is used\n");
MACRUM 0:99f7e7890e03 69 #endif
MACRUM 0:99f7e7890e03 70
MACRUM 0:99f7e7890e03 71 #ifdef __APCS_ROPI
MACRUM 0:99f7e7890e03 72 pc.printf("--apcs /ropi is used\n");
MACRUM 0:99f7e7890e03 73 #endif
MACRUM 0:99f7e7890e03 74
MACRUM 0:99f7e7890e03 75 #ifdef __APCS_RWPI
MACRUM 0:99f7e7890e03 76 pc.printf("--apcs /rwpi is used\n");
MACRUM 0:99f7e7890e03 77 #endif
MACRUM 0:99f7e7890e03 78
MACRUM 0:99f7e7890e03 79 #ifdef __APCS_FPIC
MACRUM 0:99f7e7890e03 80 pc.printf("--apcs /fpic is used\n");
MACRUM 0:99f7e7890e03 81 #endif
MACRUM 0:99f7e7890e03 82
MACRUM 0:99f7e7890e03 83 #ifdef __BIG_ENDIAN
MACRUM 0:99f7e7890e03 84 pc.printf("Target is big endian\n");
MACRUM 4:2b25b7a2c5fd 85 #else
MACRUM 4:2b25b7a2c5fd 86 pc.printf("Target is little endian\n");
MACRUM 0:99f7e7890e03 87 #endif
MACRUM 0:99f7e7890e03 88
MACRUM 0:99f7e7890e03 89 #ifdef __CHAR_UNSIGNED__
MACRUM 0:99f7e7890e03 90 pc.printf("char type is unsigned\n");
MACRUM 0:99f7e7890e03 91 #else
MACRUM 0:99f7e7890e03 92 pc.printf("char type is signed\n");
MACRUM 0:99f7e7890e03 93 #endif
MACRUM 0:99f7e7890e03 94 pc.printf("EDG front-end version : %d\n", __EDG_VERSION__);
MACRUM 0:99f7e7890e03 95
MACRUM 0:99f7e7890e03 96 pc.printf("Emulated GNU version : %d.%d\n", __GNUC__, __GNUC_MINOR__);
MACRUM 0:99f7e7890e03 97 pc.printf("Current emulated GNU version : %s\n", __VERSION__);
MACRUM 0:99f7e7890e03 98
MACRUM 0:99f7e7890e03 99 pc.printf("Optimize level : %d\n", __OPTIMISE_LEVEL);
MACRUM 0:99f7e7890e03 100
MACRUM 0:99f7e7890e03 101 #ifdef __OPTIMISE_SPACE
MACRUM 0:99f7e7890e03 102 pc.printf("Optimized by size\n");
MACRUM 0:99f7e7890e03 103 #endif
MACRUM 0:99f7e7890e03 104
MACRUM 0:99f7e7890e03 105 #ifdef __OPTIMISE_TIME
MACRUM 0:99f7e7890e03 106 pc.printf("Optimized by speed\n");
MACRUM 0:99f7e7890e03 107 #endif
MACRUM 0:99f7e7890e03 108
MACRUM 0:99f7e7890e03 109 pc.printf("Target ARM architecture : %d\n", __TARGET_ARCH_ARM);
MACRUM 0:99f7e7890e03 110 pc.printf("Target Thumb architecture : %d\n", __TARGET_ARCH_THUMB);
MACRUM 7:31420b1e1298 111 pc.printf("Compile date : %s\n", __DATE__);
MACRUM 7:31420b1e1298 112 pc.printf("Compile time : %s\n", __TIME__);
MACRUM 0:99f7e7890e03 113 #else
MACRUM 0:99f7e7890e03 114 pc.printf("Not build with ARM compiler\n");
MACRUM 0:99f7e7890e03 115 #endif
MACRUM 4:2b25b7a2c5fd 116
MACRUM 4:2b25b7a2c5fd 117 while(1) {
MACRUM 4:2b25b7a2c5fd 118 myled = !myled;
MACRUM 4:2b25b7a2c5fd 119 wait(0.4);
MACRUM 4:2b25b7a2c5fd 120 }
MACRUM 0:99f7e7890e03 121 }