Undefined : "__HEAP_START" Undefined : "__mem_limit" Undefined : "__stack_safety" link failed

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

Undefined : "__HEAP_START" Undefined : "__mem_limit" Undefined : "__stack_safety" link failed

ソリューションへジャンプ
1,165件の閲覧回数
changxychang
Contributor I

I am using Code Warrior 7.2 and building for the  54418 CPU, with MQX V3.7

I have ported some existing code over and fixed a bunch of compile errors. I am now stuck on some linker errors. I realise because the code uses malloc() and free() I need to define a heap.

Error   : Undefined : "__HEAP_START"

Referenced from "__break" in

Error   : Undefined : "__mem_limit"

alloc.c line 176   Referenced from "brk" in

Error   : Undefined : "__stack_safety"

alloc.c line 176   Referenced from "brk" in

Link failed.

 

I have no idea how to fix the problem with  "__mem_limit"  and "__stack_safety" variables

I have now removed all my app code and get the same link error.

I have tested a new project piece of code from MQX 3.7

Just adding the lines

#include <stdlib.h>

char *ptr;

ptr = malloc(1000)

triggers the link errors, Take out the malloc line, and link error goes away

I would appreciate any help on this problem, thanks.

0 件の賞賛
返信
1 解決策
916件の閲覧回数
BielikM
Contributor III

Hi changxychang,

STDLIB is not part of MQX. MQX has own API for standard functions ( check MQX reference manual for that).

In your case use _mem_alloc(...) instead malloc(...).

Regards,

Martin

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
917件の閲覧回数
BielikM
Contributor III

Hi changxychang,

STDLIB is not part of MQX. MQX has own API for standard functions ( check MQX reference manual for that).

In your case use _mem_alloc(...) instead malloc(...).

Regards,

Martin

0 件の賞賛
返信