NEWLIB requires the underlying function: "_sbrk" - in syscalls, In "OS"
type environment, SBRK would call the operating system requesting more
memory.
In an embedded system using NEWLIB - the SBRK function has (a) a pointer
to the current end of the heap, it sort of works like this:
Newlib impliments it this way: (newlib source, libgloss, arm, syscalls.c)
You want to set a break point at _sbrk - and step through the code.
Examine the addresses of variables as you do this.
Thank you, Duane. You hit the nail on the head: sbrk()'s check for
stack-heap collision was failing, because the user stack area happened
to be set up ahead of the heap area in my memory map. I set up the more
conventional arrangement where the heap & stack grow toward each other,
and now malloc() is working.
Thanks again,
-ted