Explicitly clear Heap pointer

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Explicitly clear Heap pointer

1,567件の閲覧回数
kpanchamia
Contributor I

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

ラベル(1)
タグ(3)
0 件の賞賛
返信
1 返信

1,322件の閲覧回数
Carlos_Musich
NXP Employee
NXP Employee

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

0 件の賞賛
返信