[ECOS] raw output to serial port and dataflash + legacy API questions

Andrew Lunn andrew@lunn.ch
Mon May 11 17:57:00 GMT 2009

> 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


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