This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Reset Heap

Hi,

I'm using a code like:

   short * x;

   x=(short*) calloc(0xff0,sizeof(short)*8);

in my program. I found, when hitting the "Restart" Button in CCS the heap pointer is not reset, but counts from already allocated memory. Is there any way to reset the heap-pointer instead of reloading the whole program?

You can easily see, that the pointer x is incremented each time I hit restart-Button of Debugger in CCS (EVM5515) until sometime the heap is full.

Micky

  • Make sure you have the linker settings to initialize at run time.  If you have it set to initialize at load time then global variables (like the pointer managing the heap) only get initialized when you load the program.  If you initialize at run time, your global variables will be re-initialized by the startup code each time you reset the program counter via a reset command.  This will increase your code size some.

    If you cannot afford the increase in code size, load your program but do not let it run to main, turn off this option in the debugging options.  Then save a copy of your memory where the global variables reside (see your map file) and then when you reset your code, you only need to load the memory to initialize the global variables.

    Jim Noxon

     

  • Hi Jim,

    Digging you old post here. How can we set the linker settings to initialize at run time in CCS ? I searched everywhere and can't seem to find it ...

    Thank you for your help !