NuMaker Ethernet TCP

Revision:
14:7a9e90b34298
Parent:
10:717012361a47
Child:
16:5df36a9f0f60
--- a/main.cpp	Tue Oct 16 13:56:45 2018 +0800
+++ b/main.cpp	Tue Oct 16 14:09:51 2018 +0800
@@ -9,13 +9,6 @@
 #include "greentea-client/test_env.h"
 #include "unity/unity.h"
 
-#ifndef __CC_ARM 
-#ifdef __GNUC__
-extern "C" caddr_t _sbrk(int incr);
-#endif
-#endif
-
-
 //#define LOCAL_LAN
 
 namespace {
@@ -54,18 +47,16 @@
 }
 
 int main() {
+#if MBED_HEAP_STATS_ENABLED
+    mbed_stats_heap_t heap_stats;
+#endif
+
     printf(" Start TCP test \r\n");
 //    GREENTEA_SETUP(20, "default_auto");
 
     bool result = true;
 
     EthernetInterface eth;
-#ifndef __CC_ARM 
-#ifdef __GNUC__
-    printf("sbrk=%x:\r\n", (unsigned int)_sbrk(0));
-#endif
-#endif 
-
 
     eth.connect(); //Use DHCP
         
@@ -103,13 +94,14 @@
         printf("HTTP: Received massage:\r\n\r\n");
         printf("%s", buffer);
     }
- 
-#ifndef __CC_ARM 
-#ifdef __GNUC__
-    printf("sbrk=%x:\r\n", (unsigned int)_sbrk(0));
-#endif
-#endif 
+
     sock.close();
     eth.disconnect();
 //    GREENTEA_TESTSUITE_RESULT(result);
+
+#if MBED_HEAP_STATS_ENABLED
+    mbed_stats_heap_get(&heap_stats);
+    printf("Current heap: %lu\r\n", heap_stats.current_size);
+    printf("Max heap size: %lu\r\n", heap_stats.max_size);
+#endif
 }