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