[ECOS] CYGBLD_ATTRIB_C_INIT_PRI

Stanislav Meduna stano@meduna.org
Thu Jul 16 11:01:00 GMT 2009


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



More information about the Ecos-discuss mailing list