This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Newlib : Malloc & PPC
Quoting Frank Juergen-r58616 <Juergen.Frank@freescale.com>:
Hi !!
I have a problem with the malloc function of newlib. Possible someone
can help me out ...
If I call malloc in my program it returns a value of 0, if I compile
the program with -msim (for the simulator). In case I compile the
same program for an real embedded system (PowerPc based evaluation
board). The system crashed if I call the malloc function.
I didn't do anything special for malloc, so I'm wondering from where
the malloc get the info about the memory pool (size location etc). I
can imagine I should set these values in the linker script, but I
didn't found any info about this.
My understanding is this:
malloc() eventually calls sbrk() in libgloss.
sbrk() picks up _end from the linker.
You need to make sure _end is in the linker script, and points to free memory.
--
Matthew JONES
http://www.tandbergtv.com/