Core Base Classes for the Light Endpoints

Dependencies:   BufferedSerial

Dependents:   mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more

Revision:
66:3361be4bfd38
Parent:
64:7e494186e2ec
Child:
68:e6431dfe2f30
--- a/ErrorHandler.cpp	Mon Mar 03 17:02:44 2014 +0000
+++ b/ErrorHandler.cpp	Mon Mar 03 19:12:21 2014 +0000
@@ -18,14 +18,13 @@
  
  #include "ErrorHandler.h"
  
- /*    __heapvalid((__heapprt)fprintf,stdout, 1);\*/
-#define MEM_VALID(x) \
+ // Memory statistics macro
+ #define MEM_STATS(x) \
     int s##x=0;\
     int *h##x = new int [1];\
-    this->m_pc->printf("\r\nMEMORY[stack]0x%08x\t[heap]0x%08x\t[memory avail]%d bytes\r\n", &s##x, h##x, &s##x-h##x);\
+    this->m_pc->printf("\r\nMEMORY: stack: 0x%08x  heap: 0x%08x  avail: %d bytes\r\n", &s##x, h##x, &s##x-h##x);\
     if (h##x > &s##x)\
     error("collision\n");\
-    else\
     delete [] h##x;\
     __nop()
  
@@ -75,7 +74,7 @@
     va_end(args);
     this->m_pc->printf(this->m_message);
     #ifdef ENABLE_MEMORY_DEBUG
-    MEM_VALID(1);
+    MEM_STATS(0);
     #endif
     this->m_pc->printf("\r\n");
     this->m_lcd->cls();