[ECOS] Fix crash in SPI init
Øyvind Harboe
oyvind.harboe@zylin.com
Wed Aug 11 20:12:00 GMT 2010
The attached change fixes a crash in SPI init when using
gcc 4.3 or newer by ditching the use of CYGBLD_ATTRIB_C_INIT_PRI.
--
Øyvind Harboe
US toll free 1-866-980-3434 / International +47 51 63 25 00
http://www.zylin.com/zy1000.html
ARM7 ARM9 ARM11 XScale Cortex
JTAG debugger and flash programmer
-------------- next part --------------
diff -r 0c51e5cb890a packages/devs/spi/arm/at91/current/src/spi_at91_init.cxx
--- a/packages/devs/spi/arm/at91/current/src/spi_at91_init.cxx Fri Jul 16 14:53:40 2010 +0000
+++ b/packages/devs/spi/arm/at91/current/src/spi_at91_init.cxx Wed Aug 11 21:59:27 2010 +0200
@@ -50,7 +50,7 @@
// This file is not needed if we support CYGBLD_ATTRIB_C_INIT_PRI, as the
// init happens directly in spi_at91.c then.
-#ifndef CYGBLD_ATTRIB_C_INIT_PRI
+#if !CYGBLD_HAS_ATTRIB_C_INIT()
// -------------------------------------------------------------------------
diff -r 0c51e5cb890a packages/infra/current/include/cyg_type.h
--- a/packages/infra/current/include/cyg_type.h Fri Jul 16 14:53:40 2010 +0000
+++ b/packages/infra/current/include/cyg_type.h Wed Aug 11 21:59:27 2010 +0200
@@ -287,7 +287,11 @@
#define CYGBLD_ATTRIB_INIT_BEFORE( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_-100)
#define CYGBLD_ATTRIB_INIT_AFTER( _pri_ ) CYGBLD_ATTRIB_INIT_PRI(_pri_+100)
-#if defined(__GNUC__) && !defined(__cplusplus) && (__GNUC_VERSION__ >= 40300)
+// From C++ we need to be able to tell if we have the init capability available
+// from C
+#define CYGBLD_HAS_ATTRIB_C_INIT() (defined(__GNUC__) && (__GNUC_VERSION__ >= 40300))
+
+#if CYGBLD_HAS_ATTRIB_C_INIT() && !defined(__cplusplus)
// 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)))
-------------- next part --------------
--
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