prints the location of heap, stack, data and code

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
Helmut64
Date:
Sun Sep 20 08:54:32 2015 +0000
Commit message:
Initial checkin of stack/data/heap testing app

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 29ed9d142ea8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Sep 20 08:54:32 2015 +0000
@@ -0,0 +1,28 @@
+#include "mbed.h"
+
+/**
+ * @file    StackHeapCodeDataInfo
+ * @brief   print the location of heap, stack, data and code.
+ * @author  Helmut Tschemernjak
+ * @version 1.0
+ */
+ 
+Serial *bs;
+
+int main()
+{
+    int temp = 0;
+    
+    bs = new Serial(USBTX, USBRX);
+    bs->baud(115200);
+    
+    char *p1 = new  char[4096];
+
+    bs->printf(" main=0x%x\r\n", &main);
+    bs->printf(" data=0x%x\r\n", &bs);
+    bs->printf("stack=0x%x\r\n", &temp);
+    bs->printf(" heap=0x%x-0x%x\r\n", p1, p1+4096);
+    for(;;)
+        sleep();
+}
+
diff -r 000000000000 -r 29ed9d142ea8 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Sep 20 08:54:32 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4f6c30876dfa
\ No newline at end of file