Describes predefine macros for mbed online compiler (armcc)

Committer:
MACRUM
Date:
Wed Jun 13 09:00:02 2018 +0000
Revision:
8:09f55ce7afee
Parent:
7:31420b1e1298
Child:
9:cf8652c08e46
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 3:b802baa84f98 46 pc.printf("mbed library version: %d\n", MBED_LIBRARY_VERSION);
MACRUM 8:09f55ce7afee 47
MACRUM 8:09f55ce7afee 48 #ifdef MBED_CONF_RTOS_PRESENT
MACRUM 8:09f55ce7afee 49 pc.printf("Mbed OS %d.%d.%d\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
MACRUM 8:09f55ce7afee 50 #endif
MACRUM 8:09f55ce7afee 51
MACRUM 2:fe7a36257939 52 #ifdef __CC_ARM
MACRUM 4:2b25b7a2c5fd 53 #ifdef __MICROLIB
MACRUM 4:2b25b7a2c5fd 54 pc.printf("Built with ARM compiler and micro library (uARM)\n");
MACRUM 4:2b25b7a2c5fd 55 #else
MACRUM 4:2b25b7a2c5fd 56 pc.printf("Built with ARM compiler and standard library (ARM)\n");
MACRUM 4:2b25b7a2c5fd 57 #endif
MACRUM 0:99f7e7890e03 58 pc.printf("ARM Compiler version : %d\n", __ARMCC_VERSION);
MACRUM 0:99f7e7890e03 59
MACRUM 0:99f7e7890e03 60 #ifdef __ARM_NEON__
MACRUM 0:99f7e7890e03 61 pc.printf("NEON is available\n");
MACRUM 0:99f7e7890e03 62 #else
MACRUM 0:99f7e7890e03 63 pc.printf("NEON is not available\n");
MACRUM 0:99f7e7890e03 64 #endif
MACRUM 0:99f7e7890e03 65
MACRUM 0:99f7e7890e03 66 #ifdef __APCS_INTERWORK
MACRUM 0:99f7e7890e03 67 pc.printf("ARM/Thumb Interworking is used\n");
MACRUM 0:99f7e7890e03 68 #endif
MACRUM 0:99f7e7890e03 69
MACRUM 0:99f7e7890e03 70 #ifdef __APCS_ROPI
MACRUM 0:99f7e7890e03 71 pc.printf("--apcs /ropi is used\n");
MACRUM 0:99f7e7890e03 72 #endif
MACRUM 0:99f7e7890e03 73
MACRUM 0:99f7e7890e03 74 #ifdef __APCS_RWPI
MACRUM 0:99f7e7890e03 75 pc.printf("--apcs /rwpi is used\n");
MACRUM 0:99f7e7890e03 76 #endif
MACRUM 0:99f7e7890e03 77
MACRUM 0:99f7e7890e03 78 #ifdef __APCS_FPIC
MACRUM 0:99f7e7890e03 79 pc.printf("--apcs /fpic is used\n");
MACRUM 0:99f7e7890e03 80 #endif
MACRUM 0:99f7e7890e03 81
MACRUM 0:99f7e7890e03 82 #ifdef __BIG_ENDIAN
MACRUM 0:99f7e7890e03 83 pc.printf("Target is big endian\n");
MACRUM 4:2b25b7a2c5fd 84 #else
MACRUM 4:2b25b7a2c5fd 85 pc.printf("Target is little endian\n");
MACRUM 0:99f7e7890e03 86 #endif
MACRUM 0:99f7e7890e03 87
MACRUM 0:99f7e7890e03 88 #ifdef __CHAR_UNSIGNED__
MACRUM 0:99f7e7890e03 89 pc.printf("char type is unsigned\n");
MACRUM 0:99f7e7890e03 90 #else
MACRUM 0:99f7e7890e03 91 pc.printf("char type is signed\n");
MACRUM 0:99f7e7890e03 92 #endif
MACRUM 0:99f7e7890e03 93 pc.printf("EDG front-end version : %d\n", __EDG_VERSION__);
MACRUM 0:99f7e7890e03 94
MACRUM 0:99f7e7890e03 95 pc.printf("Emulated GNU version : %d.%d\n", __GNUC__, __GNUC_MINOR__);
MACRUM 0:99f7e7890e03 96 pc.printf("Current emulated GNU version : %s\n", __VERSION__);
MACRUM 0:99f7e7890e03 97
MACRUM 0:99f7e7890e03 98 pc.printf("Optimize level : %d\n", __OPTIMISE_LEVEL);
MACRUM 0:99f7e7890e03 99
MACRUM 0:99f7e7890e03 100 #ifdef __OPTIMISE_SPACE
MACRUM 0:99f7e7890e03 101 pc.printf("Optimized by size\n");
MACRUM 0:99f7e7890e03 102 #endif
MACRUM 0:99f7e7890e03 103
MACRUM 0:99f7e7890e03 104 #ifdef __OPTIMISE_TIME
MACRUM 0:99f7e7890e03 105 pc.printf("Optimized by speed\n");
MACRUM 0:99f7e7890e03 106 #endif
MACRUM 0:99f7e7890e03 107
MACRUM 0:99f7e7890e03 108 pc.printf("Target ARM architecture : %d\n", __TARGET_ARCH_ARM);
MACRUM 0:99f7e7890e03 109 pc.printf("Target Thumb architecture : %d\n", __TARGET_ARCH_THUMB);
MACRUM 7:31420b1e1298 110 pc.printf("Compile date : %s\n", __DATE__);
MACRUM 7:31420b1e1298 111 pc.printf("Compile time : %s\n", __TIME__);
MACRUM 0:99f7e7890e03 112 #else
MACRUM 0:99f7e7890e03 113 pc.printf("Not build with ARM compiler\n");
MACRUM 0:99f7e7890e03 114 #endif
MACRUM 4:2b25b7a2c5fd 115
MACRUM 4:2b25b7a2c5fd 116 while(1) {
MACRUM 4:2b25b7a2c5fd 117 myled = !myled;
MACRUM 4:2b25b7a2c5fd 118 wait(0.4);
MACRUM 4:2b25b7a2c5fd 119 }
MACRUM 0:99f7e7890e03 120 }