BSP and Device Driver Development Guide
Although nearly all BSPs give all possible memory to the C Program Heap
at initialization, it is possible for a BSP to configure the initial
size of the heap small and let it grow on demand. If the BSP wants
to dynamically extend the heap used by the C Library memory allocation
routines (i.e. malloc
family), then thesbrk
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 bsp_libc_init
during system initialization.
Historically initialization of the C Library was done as part of the
BSP's Pretasking Hook but now the BSP Boot Card Framework can perform
this operation.
If your BSP does not want to support dynamic heap extension, then you do not have to do anything special. However, if you want to support sbrk
, you must provide an implementation of this method and define CONFIGURE_MALLOC_BSP_SUPPORTS_SBRK
in bsp.h
. This informs rtems/confdefs.h
to configure the Malloc Family Extensions which support sbrk
.
BSP and Device Driver Development Guide
Copyright © 1988-2008 OAR Corporation