RTEMS memory use

Joel Sherrill joel.sherrill at OARcorp.com
Thu Jan 26 15:30:33 UTC 2012





On 01/26/2012 05:57 AM, Francesco Nuzzolo wrote:
> Hi,
>
> we are developing an application with RTEMS 4.10 running on a Leon2.
>
> Trying to analyze the RAM memory usage, I have found that, starting from
> RAM base address 0x40000000, we have about 500 KB with the .text, .data
> and .bss sections, after that we have 1 MB used by the RTEMS Workspace,
> which ends at address 0x4018E200. Then, when we make calls to malloc(),
> we see that memory blocks are being taken starting at address 0x401FE980
> and proceeding in the direction of growing addresses.
>
> So, there is a "gap" between the end of the RTEMS Workspace (address
> 0x4018E200) and the beginning of the area used by malloc() (address
> 0x401FE980), and this "gap" amounts to approximately 450 KB.
>
After the .bss you will see the "Work Area" which is split into
RTEMS Workspace and the C Program Heap.

The C Program Heap begins immediately after the end of
the RTEMS Workspace.

Check the linkcmds and the files libbsp/sparc/shared/bspgetworkarea.c
libbsp/shared/bootcard.c for details.

I don't think there is really a gap but what you are seeing is
memory in the Workspace reserved for OS objects, task stacks,
etc which have not been allocated yet. Thus the gap of used
reserved but unused OS memory is smaller in hello than in a
network program.

If you can look at values in gdb, print....

+ &end
+ _Workspace_Area (area_begin and area_end)
+ RTEMS_Malloc_Heap (area_begin and area_end)

They should line up nicely with only alignment between them.
> I am wondering what this area is used for. If I put some watchpoints in
> it, they are triggered. Sometimes it seems to be the
> rtems_libio_allocate() function to  trigger these watchpoints. Could it
> be that this memory space is for data structures used by libraries or
> drivers (e.g. TCP/IP network library and Ethernet drivers)?
>
> If I try the same analysis using the simple rtems-hello program (adding
> a call to malloc), the "gap" is much smaller (just a few KB).
>
> Thanks in advance for your help,
> Francesco
>


-- 
Joel Sherrill, Ph.D.             Director of Research&   Development
joel.sherrill 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