Skip to content

Instantly share code, notes, and snippets.

@eblot
Created February 19, 2011 00:08
Show Gist options
  • Save eblot/834649 to your computer and use it in GitHub Desktop.
Save eblot/834649 to your computer and use it in GitHub Desktop.
Patch for GCC-newlib 4.6.0 ARM eCos EABI with Objective-C support
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index 49c81f9..e9297f8 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -130,6 +130,11 @@
#define __ATTRIBUTE_IMPURE_PTR__ __attribute__((__section__(".sdata")))
#endif
+#ifdef __ecos__
+#define __DYNAMIC_REENT__ 1
+#define _REENT_SMALL
+#endif // __ecos__
+
#ifdef __xstormy16__
#define __SMALL_BITFIELDS
#undef INT_MAX
diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h
index 2e95121..c78898f 100644
--- a/newlib/libc/include/pthread.h
+++ b/newlib/libc/include/pthread.h
@@ -31,7 +31,7 @@ extern "C" {
#include <sys/types.h>
#include <time.h>
-#include <sys/sched.h>
+#include <sched.h>
/* Register Fork Handlers */
int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void),
diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h
index 9faf2b8..b9ad69a 100644
--- a/newlib/libc/include/sys/features.h
+++ b/newlib/libc/include/sys/features.h
@@ -78,6 +78,17 @@ extern "C" {
#endif
+#ifdef __ecos__
+#define _POSIX_THREAD_PRIO_INHERIT 1
+#define _POSIX_THREAD_PRIO_PROTECT 1
+#define _POSIX_PRIORITY_SCHEDULING 1
+#define _POSIX_THREADS 1
+#define _POSIX_THREAD_PRIORITY_SCHEDULING 1
+#define _POSIX_THREAD_ATTR_STACKADDR 1
+#define _POSIX_THREAD_ATTR_STACKSIZE 1
+#define _UNIX98_THREAD_MUTEX_ATTRIBUTES 1
+#endif // __ecos__
+
/* XMK loosely adheres to POSIX -- 1003.1 */
#ifdef __XMK__
#define _POSIX_THREADS 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment