CPU : K61FX512
Using CW10.6
Language - C++
I am working on a code that uses a lot of "new" - dynamic mem allocation but doesn't delete the objects after using them.
The Code is running from ext DDR. I am doing a soft reset by jump to application (since soft reset command will send the control to 0x00000000).
I am able to re-initialize the stack pointer properly but heap pointer is managed by EWL which doesn't reset it after this soft reset.
Is it possible to explicitly clear/reset the heap pointer in C++?
Thanks
Hi Kunal,
You need to set in your project's linker file heap start and heap size as well as the stack. You can set here the address where you wish it to start.
/* Generate a link error if heap and stack don't fit into RAM */
__heap_size = 0x800; /* required amount of heap */
__stack_size = 0x800; /* required amount of stack */
/* User_heap_stack section, used to check that there is enough RAM left */
._user_heap_stack :
{
. = ALIGN(4);
PROVIDE ( end = . );
PROVIDE ( _end = . );
__heap_addr = .;
. = . + __heap_size;
. = . + __stack_size;
. = ALIGN(4);
} > m_data
If you have questions about how linker file works you can see the following document,
Relocating Code and Data Using the CW GCC Linker File for Kinetis
Regards,
Carlos