[ECOS] Re: Gary, could you give me some suggestions?

Chris Zimman czimman@bloomberg.com
Wed May 14 10:17:00 GMT 2008


Hi Fisher,

__CTOR_LIST__ and __CTOR_END__ are not used under EABI.  That's what
__init_array_start and __init_array_end replace respectively.

If you are using the CodeSourcery toolchain, there's a bug in the linker
that's waiting to be fixed.  ld -r is used to combine the .o's, and it
reorders the __init_array sections incorrectly.  There is an easy workaround
though, you need to add '-T /dev/null' to the 'ld -r' step so it doesn't use
the default linker script.

The reason that malloc() etc is probably failing is because the init steps
aren't running in the right order.

--Chris

> -----Original Message-----
> From: Fisher ZHU [mailto:fisher.zhu@gmail.com]
> Sent: 14 May 2008 10:28
> To: Chris Zimman
> Cc: eCos Discussion
> Subject: Re: [ECOS] Re: Gary, could you give me some suggestions?
> 
> Dear Chris,
> 
> Thanks for your valuable help.
> 
> Yesterday, I made a little progress.
> What have been done are listed below:
> 1) modify target.ld by replacing .ctors with .init_array as below,
> __CTOR_LIST__ = ABSOLUTE(.) ;
> KEEP(*(SORT(.init_array*)))
> __CTOR_END__= ABSOLUTE(.) ;
> 2) add libc.a into GROUP(..) in target.ld and remove -nostdlib linker
> flag
> 3) make.
> 
> After done, the info of redboot.elf was dumped to check the
> constructor list, and __CTOR_LIST and __CTOR_END  have different
> addresses.
> 
> The above work removed the malloc() error encountered during flash
> initialization, then after these work, no malloc() error occurs , but
> redboot will fell in the state of waiting for BOOTP feedback after
> ethernet controller initialization.
> 
> You mentioned that hal_misc.c needs to be modified.
> Would you like to describe your work more detailedly or send me the
> related modified files in your work package?
> 
> Thanks a lot.
> --
> br,
> Fisher
> 
> On 5/13/08, Chris Zimman <czimman@bloomberg.com> wrote:
> > > > I use arm-none-eabi-ld --verbose and arm-elf-ld --verbose to
> print
> > > the detailed link script for comparison, and I also read the arm.ld
> of
> > > redboot in \src\hal\arm\arch\current\src.
> > > > I found after compiling with arm eabi tool chain, there is no
> > > ARM.exidex and ARM.extab in the generated target.ld. I edited
> target.ld
> > > and then make again. I get a redboot.elf. However, after I dumped
> the
> > > info of redboot.elf generated by arm-eabi. I found that
> __CTOR_LIST__
> > > ,__CTOR_END__, __DTOR_LIST__, and __DTOR_END__ have the same
> pointer.
> > > It means that the constructors and destructors of redboot don't be
> > > compiled correctly.
> > > >
> > > > could you give me more suggestions? I am a newbie in embedded
> linux.
> >
> > There are a few things here if you're trying to get it to work with
> EABI.
> >
> > (1)  Constructors are in a new section called .init_array -- they get
> created
> > in the opposite order that they are done under arm-elf, so you would
> need to
> > modify arm/arch/hal_misc.c as well as arm/arch/arm.ld
> >
> > (2)  You need to provide .ARM.extab and .ARM.exidx as they are
> required by
> > EABI.  They need to be added in arm/arch/arm.ld
> >
> > I have a working port of eCos w/ ARM EABI support that I've given to
> > eCosCentric.  I believe they are adding this to eCosPro (someone from
> > eCosCentric please correct me if I'm wrong here).
> >
> > --Chris
> >

--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list