prints the location of heap, stack, data and code
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 /** 00004 * @file StackHeapCodeDataInfo 00005 * @brief print the location of heap, stack, data and code. 00006 * @author Helmut Tschemernjak 00007 * @version 1.0 00008 */ 00009 00010 Serial *bs; 00011 00012 int main() 00013 { 00014 int temp = 0; 00015 00016 bs = new Serial(USBTX, USBRX); 00017 bs->baud(115200); 00018 00019 char *p1 = new char[4096]; 00020 00021 bs->printf(" main=0x%x\r\n", &main); 00022 bs->printf(" data=0x%x\r\n", &bs); 00023 bs->printf("stack=0x%x\r\n", &temp); 00024 bs->printf(" heap=0x%x-0x%x\r\n", p1, p1+4096); 00025 for(;;) 00026 sleep(); 00027 } 00028
Generated on Thu Jul 14 2022 07:42:33 by
1.7.2
Helmut Tschemernjak