Core Base Classes for the Light Endpoints
Dependents: mbed_mqtt_endpoint_ublox_ethernet mbed_mqtt_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_cellular mbed_nsp_endpoint_ublox_ethernet ... more
Diff: ErrorHandler.cpp
- Revision:
- 64:7e494186e2ec
- Parent:
- 61:6012d61573ea
- Child:
- 66:3361be4bfd38
diff -r ce4d20dcae6e -r 7e494186e2ec ErrorHandler.cpp --- a/ErrorHandler.cpp Mon Mar 03 16:19:20 2014 +0000 +++ b/ErrorHandler.cpp Mon Mar 03 17:00:49 2014 +0000 @@ -18,6 +18,17 @@ #include "ErrorHandler.h" + /* __heapvalid((__heapprt)fprintf,stdout, 1);\*/ +#define MEM_VALID(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);\ + if (h##x > &s##x)\ + error("collision\n");\ + else\ + delete [] h##x;\ + __nop() + // Annunciations DigitalOut led1(LED1); DigitalOut led2(LED2); @@ -63,6 +74,9 @@ vsprintf(this->m_message, format, args); va_end(args); this->m_pc->printf(this->m_message); + #ifdef ENABLE_MEMORY_DEBUG + MEM_VALID(1); + #endif this->m_pc->printf("\r\n"); this->m_lcd->cls(); this->m_lcd->locate(0,0);