This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: raw output to serial port and dataflash + legacy API questions


On Mon, May 11, 2009 at 07:57:43PM +0200, Andrew Lunn wrote:
> > For example, you write this code in some ".c" file:
> > 
> > __externC cyg_spi_at91_device_t spi_dataflash_dev0;
> > 
> > CYG_DATAFLASH_FLASH_DRIVER( cyg_eb55_dataflash,
> >                             &spi_dataflash_dev0,
> >                             0x08000000,
> >                             0,
> >                             16 );
> > 
> > this file contains only definitions of variables,
> > no code. For some reasons linker will remove
> > such kind of object file in the resulting binary, and also all the stuff like dataflash module, because
> > without this file there are no links to dataflash module functions.
> > 
> > I suppose, this is bug either in build system of ecos, or in arm-eabi toolchain.
> > 
> > The workaround for this issue, that I used, is simple. I add after
> > CYG_DATAFLASH_FLASH_DRIVER the dummy function:
> > 
> > CYG_DATAFLASH_FLASH_DRIVER( cyg_eb55_dataflash,
> >                              0,
> >                              16 );
> >  
> > +void cyg_eb55_dataflash_func(int p)
> > +{
> > +}
> > +
> 
> If something is not referenced, the linker will throw it away. It is
> unwanted bloat.
> 

The variable that is not referenced is marked as __attribute__((used)).

So compiler doesn't inform linker that there is no need to throw it
away?

And as you see, actually I not add reference to variable in
workaround, I add function to which add reference.
So reference count to flash driver descriptions hasn't changed,
but linker do not remove it.

-- 
/Evgeniy


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]