Disable Heap

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,319件の閲覧回数
twp
Contributor III

We are using the standard linker file for the MPC5643L flash build "MPC5643L_FLASH.lcf" on a product that is required not to use dynamic memory allocation.  What is the best way to disable the heap?  Removing it from the .lcf file still leaves symbols in the map file. Alternatively, changing the size in the project settings C/C++ Build -> Settings -> PowerPC Linker -> Output, to 0K doesn't seem to have any effect.  Is there a safe way to go about this and disable dynamic allocation library functions?

ラベル(1)
タグ(4)
0 件の賞賛
返信
1 解決策
1,103件の閲覧回数
stanish
NXP Employee
NXP Employee

Hello twp,

It should be enough to remove/comment out the heap memory section from .lcf:

//heap: org = 0x40014000, len = 0x00008000 /* 32K heap core_lsm */

and also linker expressions:

//_heap_addr  = ADDR(heap);

//_heap_end   = ADDR(heap)+SIZEOF(heap);

The linker generates some heap symbols anyway (see the .map file):

_heap_addr 003d7ff0

_heap_end 003d7ff0

but these symbols are equal so the size of heap memory pool is 0. Any attemp to allocate memory using malloc() will not allocate any memory and return 0. You are save and you don't overwrite anything in your SRAM.

Hope it helps.

Stan

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
1,104件の閲覧回数
stanish
NXP Employee
NXP Employee

Hello twp,

It should be enough to remove/comment out the heap memory section from .lcf:

//heap: org = 0x40014000, len = 0x00008000 /* 32K heap core_lsm */

and also linker expressions:

//_heap_addr  = ADDR(heap);

//_heap_end   = ADDR(heap)+SIZEOF(heap);

The linker generates some heap symbols anyway (see the .map file):

_heap_addr 003d7ff0

_heap_end 003d7ff0

but these symbols are equal so the size of heap memory pool is 0. Any attemp to allocate memory using malloc() will not allocate any memory and return 0. You are save and you don't overwrite anything in your SRAM.

Hope it helps.

Stan

0 件の賞賛
返信