contiguous physical memory allocation
Salman
unix at gofree.indigo.ie
Wed Mar 5 14:12:12 UTC 2003
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.
Thanks,
Salman
More information about the users
mailing list