BSP and Device Driver Development Guide
If the BSP wants to dynamically extend the heap used by the
C Library memory allocation routines (i.e. malloc family),
then this routine must be functional. The following is the
prototype for this routine:
void * sbrk(size_t increment)
The increment amount is based upon the sbrk_amount
parameter passed to the RTEMS_Malloc_Initialize during system
initialization.
See Initialization Code RTEMS Pretasking Callback for more
information.
There is a default implementation which returns an error to indicate
that the heap can not be extended. This implementation can be
found in c/src/lib/libbsp/shared/sbrk.c. Many of the BSPs
use this shared implementation. In order to use this implementation,
the file Makefile.am in the BSP's startup directory
must be modified so that the $VPATH variable searches
both the startup directory and the shared directory. The following
illustates the VPATH setting in the PowerPC psim BSP's
startup/Makefile.am:
VPATH = @srcdir@:@srcdir@/../../../shared
This instructs make to look in all of the directories in the VPATH
for the source files. The directories will be examined in the order
they are specified.
BSP and Device Driver Development Guide
Copyright © 1988-2004 OAR Corporation