Describes predefine macros for mbed online compiler (armcc)

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Wed Mar 11 06:26:11 2020 +0000
Parent:
9:cf8652c08e46
Child:
11:d7b5a74747b2
Commit message:
Add Arm compiler 6 and GCC support

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed-os.lib Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon Dec 10 00:46:12 2018 +0000
+++ b/main.cpp	Wed Mar 11 06:26:11 2020 +0000
@@ -25,97 +25,103 @@
 #define xstr(s) str(s)
 #define str(s) #s
 
-#if defined(TARGET_SAMD21J18A)
-Serial pc(PB22, PB23); // tx, rx
-DigitalOut myled(PA17, 0);
-#elif defined(TARGET_LPC1768)
-#define LED1 P0_22
-Serial pc(USBTX, USBRX); // tx, rx
-DigitalOut myled(LED2, 1);
-#else
-Serial pc(USBTX, USBRX); // tx, rx
-DigitalOut myled(LED1, 0);
-#endif
+DigitalOut myled(LED1);
 
 int main() {
-    pc.printf("\n");
-    pc.printf("System Clock = %d\n", SystemCoreClock);
+    printf("\n");
+    printf("System Clock = %ld\n", SystemCoreClock);
 #ifdef MBED_USERNAME
-    pc.printf("mbed username: %s\n", xstr(MBED_USERNAME));
+    printf("mbed username: %s\n", xstr(MBED_USERNAME));
 #endif
 #ifdef MBED_LIBRARY_VERSION
-    pc.printf("mbed library version: %d\n", MBED_LIBRARY_VERSION);
+    printf("mbed library version: %d\n", MBED_LIBRARY_VERSION);
 #endif
 #ifdef MBED_CONF_RTOS_PRESENT
-    pc.printf("Mbed OS %d.%d.%d\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
+    printf("Mbed OS %d.%d.%d\n", MBED_MAJOR_VERSION, MBED_MINOR_VERSION, MBED_PATCH_VERSION);
 #endif
 
 #ifdef __CC_ARM
 #ifdef __MICROLIB
-    pc.printf("Built with ARM compiler and micro library (uARM)\n");
+    printf("Built with ARM compiler and micro library (uARM)\n");
 #else
-    pc.printf("Built with ARM compiler and standard library (ARM)\n");
+    printf("Built with ARM compiler and standard library (ARM)\n");
 #endif
-    pc.printf("ARM Compiler version : %d\n", __ARMCC_VERSION);
+    printf("ARM Compiler version : %d\n", __ARMCC_VERSION);
 
 #ifdef __ARM_NEON__
-    pc.printf("NEON is available\n");
+    printf("NEON is available\n");
 #else
-    pc.printf("NEON is not available\n");
+    printf("NEON is not available\n");
 #endif
 
 #ifdef __APCS_INTERWORK
-    pc.printf("ARM/Thumb Interworking is used\n");
+    printf("ARM/Thumb Interworking is used\n");
 #endif
 
 #ifdef __APCS_ROPI
-    pc.printf("--apcs /ropi is used\n");
+    printf("--apcs /ropi is used\n");
 #endif
 
 #ifdef __APCS_RWPI
-    pc.printf("--apcs /rwpi is used\n");
+    printf("--apcs /rwpi is used\n");
 #endif
 
 #ifdef __APCS_FPIC
-    pc.printf("--apcs /fpic is used\n");
+    printf("--apcs /fpic is used\n");
 #endif
 
 #ifdef __BIG_ENDIAN
-    pc.printf("Target is big endian\n");
+    printf("Target is big endian\n");
 #else
-    pc.printf("Target is little endian\n");
+    printf("Target is little endian\n");
 #endif
 
 #ifdef __CHAR_UNSIGNED__
-    pc.printf("char type is unsigned\n");
+    printf("char type is unsigned\n");
 #else
-    pc.printf("char type is signed\n");
+    printf("char type is signed\n");
 #endif
-    pc.printf("EDG front-end version : %d\n", __EDG_VERSION__);
+    printf("EDG front-end version : %d\n", __EDG_VERSION__);
 
-    pc.printf("Emulated GNU version : %d.%d\n", __GNUC__, __GNUC_MINOR__);
-    pc.printf("Current emulated GNU version : %s\n", __VERSION__);
+    printf("Emulated GNU version : %d.%d\n", __GNUC__, __GNUC_MINOR__);
+    printf("Current emulated GNU version : %s\n", __VERSION__);
 
-    pc.printf("Optimize level : %d\n", __OPTIMISE_LEVEL);
+    printf("Optimize level : %d\n", __OPTIMISE_LEVEL);
 
 #ifdef __OPTIMISE_SPACE
-    pc.printf("Optimized by size\n");
+    printf("Optimized by size\n");
 #endif
 
 #ifdef __OPTIMISE_TIME
-    pc.printf("Optimized by speed\n");
+    printf("Optimized by speed\n");
 #endif
 
-    pc.printf("Target ARM architecture : %d\n", __TARGET_ARCH_ARM);
-    pc.printf("Target Thumb architecture : %d\n", __TARGET_ARCH_THUMB);
-    pc.printf("Compile date : %s\n", __DATE__);
-    pc.printf("Compile time : %s\n", __TIME__);
+    printf("Target ARM architecture : %d\n", __TARGET_ARCH_ARM);
+    printf("Target Thumb architecture : %d\n", __TARGET_ARCH_THUMB);
+
+#elif defined (__GNUC__)
+#if defined (__ARMCC_VERSION)
+    printf("Built with ARM compiler 6\n");
+    printf("Arm compiler version %d\n", __ARMCC_VERSION);
 #else
-    pc.printf("Not build with ARM compiler\n");
+    printf("Built with GNU compiler\n");
 #endif
+    printf("Compatible GCC version %d.%d, clang version %s\n", __GNUC__, __GNUC_MINOR__, __VERSION__);
+    printf("Target ARM architecture : %d-%c\n", __ARM_ARCH, __ARM_ARCH_PROFILE);
+#else
+    printf("Not build with ARM compiler\n");
+#endif
+
+    printf("Compile date : %s\n", __DATE__);
+    printf("Compile time : %s\n", __TIME__);
+
 
     while(1) {
         myled = !myled;
+#if (MBED_MAJOR_VERSION >= 5) && (MBED_MINOR_VERSION >= 15)
+        thread_sleep_for(400);
+#else
         wait(0.4);
+#endif
     }
 }
--- a/mbed-os.lib	Mon Dec 10 00:46:12 2018 +0000
+++ b/mbed-os.lib	Wed Mar 11 06:26:11 2020 +0000
@@ -1,1 +1,1 @@
-https://github.com/ARMmbed/mbed-os/#d9625811c9193ac3ab36a969bab93e28dac03776
+https://github.com/ARMmbed/mbed-os/#c12b433026beae5b3b769c27941bc6d7fe5d4b27