malloc() never returns

Torsten Mohr tmohr@s.netic.de
Thu Jun 8 18:26:00 GMT 2006


Hi,

i use newlib-1.14 for V850E.

In the simulator (insight-weekly-6.5-50) i found out that
when i do a malloc(1024) as a first step in main() the
program flow goes to:

malloc(1024)
_malloc_r(_REENT, 1024)
...
mALLOc(RARG size_t bytes)

In there it hangs in the for() at 2392:

for (victim = last(bin); victim != bin; victim = victim->bk)
{
...
}
In the simulator i see that victim is 0x0 and victim->bk is
also 0x0.

What could i have done wrong to make this fail?

What is strange is that i have set a breakpoint on sbrk(), which
does not seem to get called before this infinite loop.


In my own startup code i do:
- set up stack, ep, gp, ctbp, r20 and r21
- clear .bss
- copy from ROM: .zdata, .sdata and .data

Is there anything missing?


Best regards,
Torsten.



More information about the Newlib mailing list