Dumb Question - Linkcmds and Heap initialization

Gedare Bloom gedare at gwu.edu
Wed Mar 10 16:30:52 UTC 2010

Well, I forgot to send my response to the list, so I'll do that,
although looks like Joel answered too. :)

---------- Forwarded message ----------
From: Gedare Bloom <gedare at gwu.edu>
Date: Wed, Mar 10, 2010 at 11:28 AM
Subject: Re: Dumb Question - Linkcmds and Heap initialization
To: rsg at alum.mit.edu

On Wed, Mar 10, 2010 at 10:07 AM, Robert S. Grimes <rsg at alum.mit.edu> wrote:
> Okay, some clarification and news...
> 1. Some of the output, such as the "calling ..." and "bsp_pretasking_hook
> called..." are simple printk debugging messages I had added.
> 2. I've added some more debugging calls that indicate the heap walker is
> being called from malloc, but there is no evidence that the heap was ever
> initialized to begin with.  This certainly would explain the following
> messages!
> It seems the problem lies within the BSP startup, or maybe what the RTEMS
> startup sequence expects from the BSP (and how linkcmds affects that, I
> suppose).  So, my questions become thus:
> 1. When (and where) is the heap set up?
This version appears to be using the old way of setting up the
workspace / heap, which is a BSP-specific implementation provided by
$BSP/startup/bspstart.c -- see the bsp_start function. For some
explanation, see the BSP HowTo in the RTEMS documentation, section
7.3.3 in particular for this note.

> 2. Is it possible that an uninitialized heap could actually work?
The heap has to be initialized, but where it gets located could be an
issue. Can you check what is the value of
Configuration.work_space_start ?  If you add a printk in
bspstart.c:bsp_start after it is set, you can see where the
application work space is located.

> 3. How could the start location of .text cause an (presumably uninitialized)
> heap to either work or not?
By moving .text in memory, you also move the placement of the
workspace.  This could be causing some kind of problems with the
memory layout.

> 4. Again, I'm using powerpc/virtex BSP, under 4.9.0; has the startup been
> changed such that this problem has already been addressed?
Probably. I can't speak from experience, but that BSP in the CVS is
using the boot card method of providing a workspace and application
heap.  I'm not sure what would happen if you shifted the start of
.text, but my guess is that it will work fine, since the newer method
is somewhat more robust.
> Thanks again,
> -Bob
> Robert S. Grimes
> RSG Associates
> Embedded Systems and Software Development
> for Military, Aerospace, Industry - and beyond!
> 617.697.8579
> www.rsgassoc.com
> _______________________________________________
> rtems-users mailing list
> rtems-users at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-users

More information about the users mailing list