EmbDev.net

Forum: ARM programming with GCC/GNU tools problem with malloc


von Francesco Salvatore (Guest)


Rate this post
useful
not useful
Hi, I'm programming a Lpc1343.
I have to create a list of elements,

struct lista {
   uint16_t inf;
   struct lista *pun;
};

struct lista *punt;
punt = (struct lista *)malloc(sizeof(struct lista));

but when i call the malloc, the compiler returns me the following error:

home/francesco/Programs/arm-2011.03/bin/../lib/gcc/arm-none-eabi/4.5.2/. 
./../../../arm-none-eabi/lib/thumb2/libc.a(lib_a-sbrkr.o):  In function 
`_sbrk_r':
sbrkr.c:(.text+0x12): undefined reference to `_sbrk'

von Bronco (Guest)


Rate this post
useful
not useful
Looks like you use a memory model without heap management.
You need to use a memory model which supports heap (malloc etc).
In your C compiler there should be a setting to select the memory model 
somewhere. Check the compiler manual for details.

Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
No account? Register here.