This is sample program for Nucleo L152RE (and F401RE & F411RE) mbed-rtos. You need to modify mbed-src and mbed-rtos before compile it.

Dependencies:   mbed-rtos mbed-src SetRTC

Fork of GR-PEACH_test_on_rtos_works_well by Kenji Arai

Please refer below link.
/users/kenjiArai/notebook/necleo-l152re-rtos-sample-also-for-f401re--f411re-/

Revision:
2:3747397a1618
Parent:
1:a399a743d109
Child:
3:989d13762f43
diff -r a399a743d109 -r 3747397a1618 main.cpp
--- a/main.cpp	Sat Nov 29 12:35:30 2014 +0000
+++ b/main.cpp	Thu Dec 04 12:03:04 2014 +0000
@@ -21,6 +21,22 @@
 #define LED_NAME
 //#define LED_COLOR
 
+//#define DISP_COM
+
+// Com
+#ifdef DISP_COM
+#define BAUD(x)           pcm.baud(x)
+#define PRINTF(...)       pcm.printf(__VA_ARGS__)
+#else
+#define BAUD(x)           baud(x)
+#define PRINTF(...)       printf(__VA_ARGS__)
+#endif
+
+#ifdef DISP_COM
+// com
+Serial pcm(USBTX, USBRX);
+#endif
+
 #if defined(PIN_NUM)
 DigitalOut myledR(P4_4);
 DigitalOut myledG(P3_2);
@@ -44,103 +60,103 @@
 int main() {
     uint32_t n = 0;
     
-    printf("Start mbed program\r\n");
+    PRINTF("Start mbed program\r\n");
     myledR = OFF;
-    printf("RF,");
+    PRINTF("RF,");
     myledG = OFF;
-    printf("GF,");
+    PRINTF("GF,");
     myledB = OFF;
-    printf("BF,");
+    PRINTF("BF,");
     myledU = ON;
-    printf("UN");
+    PRINTF("UN");
     while(1) {
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=ON ,G=OFF,B=OFF ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=ON ,G=OFF,B=OFF ");
         myledR = ON;
-        printf("RN,");
+        PRINTF("RN,");
         myledG = OFF;
-        printf("GF,");
+        PRINTF("GF,");
         myledB = OFF;
-        printf("BF,");
+        PRINTF("BF,");
         myledU = OFF;
-        printf("UF");
+        PRINTF("UF");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=OFF,G=OFF,B=OFF ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=OFF,G=OFF,B=OFF ");
         myledR = OFF;
-        printf("RF,");
+        PRINTF("RF,");
         myledG = OFF;
-        printf("GF,");
+        PRINTF("GF,");
         myledB = OFF;
-        printf("BF,");
+        PRINTF("BF,");
         myledU = ON;
-        printf("UN");
+        PRINTF("UN");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=OFF,G=ON ,B=OFF ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=OFF,G=ON ,B=OFF ");
         myledR = OFF;
-        printf("RF,");
+        PRINTF("RF,");
         myledG = ON;
-        printf("GN,");
+        PRINTF("GN,");
         myledB = OFF;
-        printf("BF,");
+        PRINTF("BF,");
         myledU = OFF;
-        printf("UF");
+        PRINTF("UF");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=OFF,G=OFF,B=OFF ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=OFF,G=OFF,B=OFF ");
         myledR = OFF;
-        printf("RF,");
+        PRINTF("RF,");
         myledG = OFF;
-        printf("GF,");
+        PRINTF("GF,");
         myledB = OFF;
-        printf("BF,");
+        PRINTF("BF,");
         myledU = ON;
-        printf("UN");
+        PRINTF("UN");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=OFF,G=OFF,B=ON  ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=OFF,G=OFF,B=ON  ");
         myledR = OFF;
-        printf("RF,");
+        PRINTF("RF,");
         myledG = OFF;
-        printf("GF,");
+        PRINTF("GF,");
         myledB = ON;
-        printf("BN,");
+        PRINTF("BN,");
         myledU = OFF;
-        printf("UF");
+        PRINTF("UF");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=OFF,G=OFF,B=OFF ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=OFF,G=OFF,B=OFF ");
         myledR = OFF;
-        printf("RF,");
+        PRINTF("RF,");
         myledG = OFF;
-        printf("GF,");
+        PRINTF("GF,");
         myledB = OFF;
-        printf("BF,");
+        PRINTF("BF,");
         myledU = ON;
-        printf("UN");
+        PRINTF("UN");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=ON ,G=ON ,B=ON  ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=ON ,G=ON ,B=ON  ");
         myledR = ON;
-        printf("RN,");
+        PRINTF("RN,");
         myledG = ON;
-        printf("GN,");
+        PRINTF("GN,");
         myledB = ON;
-        printf("BN,");
+        PRINTF("BN,");
         myledU = OFF;
-        printf("UF");
+        PRINTF("UF");
         wait(5.0);
-        printf(" passed %4d Sec\r\n", n +=5);
-        printf("R=OFF,G=OFF,B=OFF ");
+        PRINTF(" passed %4d Sec\r\n", n +=5);
+        PRINTF("R=OFF,G=OFF,B=OFF ");
         myledR = OFF;
-        printf("RF,");
+        PRINTF("RF,");
         myledG = OFF;
-        printf("GF,");
+        PRINTF("GF,");
         myledB = OFF;
-        printf("BF,");
+        PRINTF("BF,");
         myledU = ON;
-        printf("UN");
+        PRINTF("UN");
     }
 }