[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

heap initialization was Re: struct pointer initialization



This is the response I posted to the same post on crossgcc.

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


---------- Forwarded message ----------
Date: Fri, 9 Jul 1999 08:46:55 -0500 (CDT)
From: joel at OARcorp.com
To: crossgcc at cygnus.com
Subject: Re: struct pointer initialization



On 9 Jul 1999 biguo at 263.net wrote:

> hello,everyone!I find some problem in following statements :
>   the_block= (struct  Heap_Block *)0xdd800;
>   the_block->back_flag = 1;
>   the_block->front_flag = 0x22800;
>   the_block->next=(struct  Heap_Block *)0;
>   the_block->previous=(struct  Heap_Block *)0;

> In first statement,struct pointer the_block is pointed to address
> 0xdd800.But the four elements of struct the_block can't be
> initialized.Their contents all are 0xffffffff.The above initial
> statements has no effect on the content of four element.It result in
> failure in work space initialization.How to solve it?Thanks in advance
> for any help.

In case I am not the only one to recognize this code, it is from RTEMS. :)

More than likely, this indicates that:

1.  there is not really memory at 0xdd800  

2.  the memory controller is not properly initialized.

3.  If I recall correctly, you are on an i386ex, so you have to worry
    about the descriptor tables being setup correctly.  These writes
    could just be going off in the ether.

This is definitely during system initialization so any subtle HW
initialization or memory layout (linker script, etc) problem could cause
this.

hello world is a surprisingly difficult program to get running on an
embedded target. :)  Cables, development tools, linker scripts, device
drivers, hardware initialization, etc must all be right for you to print
that magic phrase.  After that, life is usually much easier.

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