EmbDev.net

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


Author: Francesco Salvatore (Guest)
Posted on:

Rate this post
0 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'

Author: Bronco (Guest)
Posted on:

Rate this post
0 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.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.