This is the mail archive of the
ecos-devel@sourceware.org
mailing list for the eCos project.
Re: [ECOS] raw output to serial port and dataflash + legacy API questions
- From: Andrew Lunn <andrew at lunn dot ch>
- To: Evgeniy Dushistov <dushistov at mail dot ru>
- Cc: Dave Milter <davemilter at gmail dot com>, ecos-discuss at ecos dot sourceware dot org, ecos-devel at ecos dot sourceware dot org
- Date: Mon, 11 May 2009 19:57:43 +0200
- Subject: Re: [ECOS] raw output to serial port and dataflash + legacy API questions
- References: <2a382c6e0905070357u76683dacqfe8bd885c9260671@mail.gmail.com> <20090511172638.GA27330@rain>
> 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.
To stop this, you need to let the build system know. eg for a serial
driver in the CDL:
compile -library=libextras.a at91_serial.c
Andrew