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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,656 次查看
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

 

 

 

 

 

 

 

 

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

I would appreciate any help on this problem, thanks.

标签 (1)
0 项奖励
回复
1 解答
1,151 次查看
jorge_plascencia
NXP TechSupport
NXP TechSupport

All these variables are defined in the linker parameter file.

Attached you will find an example using the malloc function.

Rename it to 7_2.zip.

Please have a look to the \lcf\MCF54418_CONSOLE_INTERNAL_RAM.lcf file

Hope this will help you.

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,152 次查看
jorge_plascencia
NXP TechSupport
NXP TechSupport

All these variables are defined in the linker parameter file.

Attached you will find an example using the malloc function.

Rename it to 7_2.zip.

Please have a look to the \lcf\MCF54418_CONSOLE_INTERNAL_RAM.lcf file

Hope this will help you.

0 项奖励
回复