this is using the mbed os version 5-13-1

Dependencies:   mbed-http

Revision:
84:7c7add00f4bf
Parent:
83:9c271a50a70b
Child:
86:04fc2fcda7ec
--- a/source/main-https.cpp	Tue Mar 26 23:33:51 2019 +0000
+++ b/source/main-https.cpp	Thu Mar 28 22:13:06 2019 +0000
@@ -76,18 +76,26 @@
 //unsigned char rt_stk[1024];
 //unsigned char hp_stk[1024];
 //unsigned char lp_stk[1024];
-unsigned char btle_stk[1024];
-unsigned char wifi_stk[4*1024];
-unsigned char atcmd_stk[4*1024];
 
 /* creates three tread objects with different priorities */
 //Thread real_time_thread(osPriorityRealtime, 1024, &rt_stk[0]);
 //Thread high_prio_thread(osPriorityHigh, 1024, &hp_stk[0]);
 //Thread low_prio_thread(osPriorityNormal, 1024, &lp_stk[0]);
+
+#ifdef USE_MAIN_THREAD_STACK
+// using main thread stack
+unsigned char btle_stk[1024];
+unsigned char wifi_stk[8*1024];
+unsigned char atcmd_stk[4*1024];
 Thread btle_thread(BTLE_THREAD_PRIORITY, 1024, &btle_stk[0]);
-Thread wifi_thread(WIFI_THREAD_PRIORITY, 4*1024, &wifi_stk[0]);
+Thread wifi_thread(WIFI_THREAD_PRIORITY, 8*1024, &wifi_stk[0]);
 Thread atcmd_thread(ATCMD_THREAD_PRIORITY, 4*1024, &atcmd_stk[0]);
-
+#else
+// using global heap
+Thread btle_thread(BTLE_THREAD_PRIORITY, 2*1024);
+Thread wifi_thread(WIFI_THREAD_PRIORITY, 8*1024);
+Thread atcmd_thread(ATCMD_THREAD_PRIORITY, 8*1024);
+#endif
 
 /* create a semaphore to synchronize the threads */
 Semaphore sync_sema;
@@ -391,11 +399,15 @@
 #define SKIP_WIFI_SCAN_DEMO
 #define BLE_STOP_START_ADV_SCAN_DEMO
 #define SKIP_WIFI_CONNECT_DEMO
+#define PAUSE_SECONDS   2
 int main() {
+    //print_all_thread_info();
+    //print_heap_and_isr_stack_info();
     reset_counter++;
     print_memory_info();
     printf("\r\n ++++++ PROGRAM STARTING -- reset count = %d ++++++ \r\n", reset_counter);
     device = new RawSerial(USBTX, USBRX, DEFAULT_BAUD_RATE);
+    //device = new RawSerial(PA_9, PA_10, DEFAULT_BAUD_RATE);
     
     printf("*** HELLO MESSAGE *** \n %s", (char *)&hello_msg[6]);
     setupDefaultWiFiConfig();
@@ -417,8 +429,8 @@
     peripheral->run();
     btle_thread.start(callback(&queue, &EventQueue::dispatch_forever));
     print_memory_info();
-    printWaitAbortKeyPress(120);
-    peripheral->stopAdvertising();
+    printWaitAbortKeyPress(PAUSE_SECONDS);
+    //peripheral->stopAdvertising();
 
 #ifndef DISABLE_WIFI // comment out wifi part
     int start = Kernel::get_ms_count();
@@ -450,8 +462,8 @@
     printWait(2); // lets wait for a minute before turning BLE back on
     device->printf("\n ++++++ restarting BLE ++++++ \n\n");
 #endif  /// endif DISABLE_WIFI
-    printWaitAbortKeyPress(60);
-    peripheral->startAdvertising();
+    printWaitAbortKeyPress(PAUSE_SECONDS);
+    //peripheral->startAdvertising();
 #ifdef ENABLE_UART_BACKGRND_DEMO
     for(int i=0;i<255;i++)
     {
@@ -473,7 +485,7 @@
 #endif 
 
     device->printf("\r\n++++++ Press key for Wifi demo test ++++++ \r\n");
-    printWaitAbortKeyPress(120);
+    printWaitAbortKeyPress(PAUSE_SECONDS);
 #ifndef SKIP_WIFI_SCAN_DEMO
     device->printf("\r\n++++++ Test WiFi Manager Network Scan ++++++ \r\n");
     int count;