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: Dual Init of SPI on at91sam7x-based system


Am 07.12.2010, 23:07 Uhr, schrieb Christophe Coutand <ccoutand@stmi.com>:

It seems to be a bug in there. From spi_at91_init.cxx, the following
definition is not visible : CYGBLD_ATTRIB_C_INIT_PRI

Possibly because of the compiler switch (__cplusplus) ?

-----------   cyg_type.h  -------------
#if defined(__GNUC__) && !defined(__cplusplus) && (__GNUC_VERSION__ >=
40300)
// Equivalents of the above for C functions, available from gcc 4.3
onwards.
# define CYGBLD_ATTRIB_C_INIT_PRI( _pri_)
__attribute__((constructor (_pri_)))
# define CYGBLD_ATTRIB_C_INIT_BEFORE( _pri_ )
__attribute__((constructor (_pri_-100)))
# define CYGBLD_ATTRIB_C_INIT_AFTER( _pri_ )
__attribute__((constructor (_pri_+100)))
#endif

An easy work around is to keep the C++ constructor only:
#1 In spi_at91_init.cxx -> remove #ifndef CYGBLD_ATTRIB_C_INIT_PRI /
#endif
#2 In spi_at91.c -> replace

#ifndef CYGBLD_ATTRIB_C_INIT_PRI
# define CYGBLD_ATTRIB_C_INIT_PRI(x)
#endif

void CYGBLD_ATTRIB_C_INIT_PRI(CYG_INIT_BUS_SPI)
cyg_spi_at91_bus_init(void)
{

with:

void
cyg_spi_at91_bus_init(void)
{

Then you should get the SPI bus initialized only once.

Christophe


Hi Christophe
I did what you said and it helped. I do not understand the details and was even surprised, that modifying something in spi_at91_init.cxx has an effect. Previously I had concluded that with my configuration, this file is "if-ed" out.


I think it would make sense to set up an bug report and hope that someone will react on it. I will do that and send the bug report to the url you specified in the mail to Stanislav (http://bugs.ecos.sourceware.org/)
Thanks and best regards Robert


--
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]