A patch for RTEMS4.10.0 PowerPC heap space initialization

Kate Feng feng1 at bnl.gov
Mon May 9 03:48:28 UTC 2011

Joel Sherrill wrote:
> This is deliberate due to dyanamically loaded code needing to be in the first 32 MB. 
I understand about the purpose of the first 32M. 
I am talking about the function of malloc() at run time, once the
first 32 MB of memory is used up.

In bootcard.c of RTEMS4.10.0 and its CVS:  bsp_libc_init(heap_start, 
heap_size, 0);
The '0' in the third parameter will set the RTEMS_Malloc_Sbrk_amount
to be 0 (see malloc_sbrk_helpers.c). The 
malloc_sbrk_extend_and_allocate() code
will do nothing but simply return, if RTEMS_Malloc_Sbrk=0,  which makes it
impossible for any BSP to extend and use sbrk(), once the first 32M of 
memory runs

> It is the BSP's responsibility to provide an sbrk() implementation to extend 
All PowerPC BSPs provide the same  skbrk() implementation to extend.
However, sbrk() will not be called if RTEMS_Malloc_Sbrk=0, which
is due to bsp_libc_init(heap_start, heap_size, 0);

Is there something missing ?

> Kate Feng <feng1 at bnl.gov> wrote:
>> Kate Feng wrote:
>>> Hi Joel,
>>>    There are bugs in RTEMS4.10.0 and its CVS for the PowerPC heap space
>>> allocation.  All PPC boards are limited to 32M bytes of memory space due
>>> to the change in RTEMS4.10 for its work space. The attached patch 
>>> fixed this.
>>> I consider that it is critical.  Thus, I will submit a PR.
>>>   Cheers,
>>>   Kate Feng
>> This is just a patch for the PowerPC port for your reference.  I do not know
>> how it will impact other ports since I do not have the boards.
>> Cheers,
>> Kate Feng

More information about the users mailing list