public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] CYGBLD_ATTRIB_C_INIT_PRI
@ 2009-07-16 11:01 Stanislav Meduna
  0 siblings, 0 replies; only message in thread
From: Stanislav Meduna @ 2009-07-16 11:01 UTC (permalink / raw)
  To: eCos Discussion

Hi,

in cyg_type.h there is a macro CYGBLD_ATTRIB_C_INIT_PRI specifying,
whether the gcc does understand a constructor priority attribute
or not.

In the AT91 SPI code (and possibly other components) there is
the following construct:

spi_at91.c

#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_ertec_bus_init(void)
{
...


spi_at91_init.cxx

#ifndef CYGBLD_ATTRIB_C_INIT_PRI

// -------------------------------------------------------------------------

externC void cyg_spi_at91_bus_init(void);

class cyg_spi_at91_bus_init_class {
public:
    cyg_spi_at91_bus_init_class(void) {
        cyg_spi_at91_bus_init();
    }
};


However, the CYGBLD_ATTRIB_C_INIT_PRI is only defined if
!defined(__cplusplus). As the spi_at91_init.cxx is a C++
file, the init code will be generated twice resulting
in an assert (if enabled) later, as there will be two
ISRs attached.


I think the correct fix is to remove the ! defined(__cplusplus)
from CYGBLD_ATTRIB_C_INIT_PRI definition in cyg_type.h.



Regards
-- 
                                       Stano

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-07-16 11:01 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-16 11:01 [ECOS] CYGBLD_ATTRIB_C_INIT_PRI Stanislav Meduna

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).