From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6533 invoked by alias); 11 May 2009 18:35:00 -0000 Received: (qmail 6512 invoked by uid 22791); 11 May 2009 18:34:59 -0000 X-SWARE-Spam-Status: No, hits=-1.0 required=5.0 tests=AWL,BAYES_00,SARE_FREE_WEBM_RuMail,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx75.mail.ru (HELO mx75.mail.ru) (94.100.176.90) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 11 May 2009 18:34:52 +0000 Received: from [79.134.88.168] (port=44528 helo=rain) by mx75.mail.ru with asmtp id 1M3aKv-0009RP-00; Mon, 11 May 2009 22:34:49 +0400 Received: by rain (nbSMTP-1.00) for uid 1000 dushistov@mail.ru; Mon, 11 May 2009 22:17:27 +0400 (MSD) Date: Mon, 11 May 2009 18:35:00 -0000 From: Evgeniy Dushistov To: Dave Milter , ecos-discuss@ecos.sourceware.org, ecos-devel@ecos.sourceware.org Subject: Re: [ECOS] raw output to serial port and dataflash + legacy API questions Message-ID: <20090511181726.GA29238@rain> References: <2a382c6e0905070357u76683dacqfe8bd885c9260671@mail.gmail.com> <20090511172638.GA27330@rain> <20090511175743.GA4940@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20090511175743.GA4940@lunn.ch> User-Agent: Mutt/1.5.16 (2007-06-09) X-IsSubscribed: yes Mailing-List: contact ecos-devel-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: ecos-devel-owner@ecos.sourceware.org X-SW-Source: 2009-05/txt/msg00006.txt.bz2 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