Dumb Question - Linkcmds and Heap initialization

Joel Sherrill joel.sherrill at OARcorp.com
Wed Mar 10 15:31:34 UTC 2010


On 03/10/2010 09:07 AM, Robert S. Grimes 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?
>
In 4.10, this is much neater and easier to answer since it
is done in the same way across the BSPs.  But in 4.9, the
code was in each BSP.

virtex/startup/bspstart.c has the code which does the heap in
bsp_pretasking_hook.  Workspace is carved out in bsp_start().

It is possible that moving the base address up somehow caused
an overlap. Is the section .textrom in the linker script causing issues?

Check that the workspace, heap, interrupt stack , .bss, etc do not overlap.
Make a good memory map.

Check for overlaps. :)
> 2. Is it possible that an uninitialized heap could actually work?
>
No. :)
> 3. How could the start location of .text cause an (presumably 
> uninitialized) heap to either work or not?
>
It could mess up the math in the BSP.
> 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?
>
If there was one of the common overlaps, it would be caught
and reported now.  If there was a math error, it would have been
eliminated as that code is now shared across more BSPs.

The old way had per BSP duplication of this and led to unique
ways of doing it and unique bugs. :)

--joel
> 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
>
>    


-- 
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