contiguous physical memory allocation

Joel Sherrill joel.sherrill at OARcorp.com
Wed Mar 5 15:07:43 UTC 2003



Salman wrote:
> 
> On Wed, 2003-03-05 at 13:52, Camilo Alejandro Arboleda wrote:
> > Salman wrote:
> >
> > >>>hi guys,
> > >>>
> > >>>i'm looking for a function in rtems which allocates contiguous physical
> > >>>memory (somewhat similar to memalign in vxworks)
> > >>>
> > >>>
> > >>>
> > >>As far as I known, RTEMS uses a flat memory model. It means the physical
> > >>address is the same logical address and malloc should allocate
> > >>contiguous physical memory.
> > >>
> > >>
> > >>
> > >
> > >One other thing though, I need to have the allocated buffer aligned as
> > >well (so that it begins on a memory address evenly divisible by 8192),
> > >any idea on how to achieve this?
> > >
> > >thanks for the response,
> > >
> > >Salman
> > >
> > >
> > In that case you do need the partition manager (may be the region
> > manager, Joel explained me the difference some time ago, but I don't
> > remember now). You need to do a couple of things:
> > - Patch your BSP for not allocating the free memory as heap for use of
> > malloc.
> > - Allocate a partition in a known memory area and create it with 8k blocks.
> 
> I had examined partition manager before, though it gives you full
> control (eg you can specify the exact starting address of your memory
> chunk) of memory, but it would bring all other sorts of memory
> management into play.
> 
> malloc is good and simple, but I also need alignment.
> there's a memalign function within new_lib of gcc which provides that.
> I compiled gcc with new_lib, and its function definition is in
> /opt/rtems/i386-rtems/include/malloc.h
> 
> but no sign of its binary object in libraries or ar archives of rtems !!
> 
> I sent a mail around, with subject "RE: memalign", if I can't get that
> sorted, then i'll just write my own function and as suggested by others
> use malloc for allocation and modify starting address manually to be
> aligned.

There has been discussion of switching from the RTEMS malloc
implementation
to the one in newlib with appropriate mutex support as the glue.  This
has just never happened.  

> Thanks,
> 
> Salman

-- 
Joel Sherrill, Ph.D.             Director of Research & Development
joel at OARcorp.com                 On-Line Applications Research
Ask me about RTEMS: a free RTOS  Huntsville AL 35805
Support Available                (256) 722-9985



More information about the users mailing list