Describes predefine macros for mbed online compiler (armcc)

Files at this revision

API Documentation at this revision

Comitter:
MACRUM
Date:
Thu Jan 12 01:44:21 2017 +0000
Parent:
3:b802baa84f98
Child:
5:9ccb34c1db4b
Commit message:
Add library detection and LED blinky

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Thu Oct 15 04:17:31 2015 +0000
+++ b/main.cpp	Thu Jan 12 01:44:21 2017 +0000
@@ -1,17 +1,33 @@
 #include "mbed.h"
 
+#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(P0_22, 1);
+#else
+Serial pc(USBTX, USBRX); // tx, rx
+DigitalOut myled(LED1, 0);
+#endif
 
 int main() {
+    pc.printf("\n");
+    pc.printf("System Clock = %d\n", SystemCoreClock);
 #ifdef MBED_USERNAME
-#define STRING(str) pc.printf(#str);
-    pc.printf("mbed username: ");
-    STRING(MBED_USERNAME);
-    pc.printf("\n\n");
+    pc.printf("mbed username: %s\n", xstr(MBED_USERNAME));
 #endif
     pc.printf("mbed library version: %d\n", MBED_LIBRARY_VERSION);
 #ifdef __CC_ARM
-    pc.printf("Built with ARM compiler\n\n");
+#ifdef __MICROLIB
+    pc.printf("Built with ARM compiler and micro library (uARM)\n");
+#else
+    pc.printf("Built with ARM compiler and standard library (ARM)\n");
+#endif
     pc.printf("ARM Compiler version : %d\n", __ARMCC_VERSION);
 
 #ifdef __ARM_NEON__
@@ -38,6 +54,8 @@
 
 #ifdef __BIG_ENDIAN
     pc.printf("Target is big endian\n");
+#else
+    pc.printf("Target is little endian\n");
 #endif
 
 #ifdef __CHAR_UNSIGNED__
@@ -65,8 +83,9 @@
 #else
     pc.printf("Not build with ARM compiler\n");
 #endif
-    while(1)
-        ;
+
+    while(1) {
+        myled = !myled;
+        wait(0.4);
+    }
 }
-
-
--- a/mbed.bld	Thu Oct 15 04:17:31 2015 +0000
+++ b/mbed.bld	Thu Jan 12 01:44:21 2017 +0000
@@ -1,1 +1,1 @@
-http://mbed.org/users/mbed_official/code/mbed/builds/8ed44a420e5c
\ No newline at end of file
+http://mbed.org/users/mbed_official/code/mbed/builds/99b5ccf27215
\ No newline at end of file