This is the mail archive of the
ecos-discuss@sourceware.org
mailing list for the eCos project.
CYGBLD_ATTRIB_C_INIT_PRI
- From: Stanislav Meduna <stano at meduna dot org>
- To: eCos Discussion <ecos-discuss at ecos dot sourceware dot org>
- Date: Thu, 16 Jul 2009 13:00:44 +0200
- Subject: [ECOS] CYGBLD_ATTRIB_C_INIT_PRI
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