Helmut Tschemernjak
/
StackHeapCodeDataInfo
prints the location of heap, stack, data and code
Diff: main.cpp
- Revision:
- 0:29ed9d142ea8
--- /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(); +} +