Re: libbsd: Conditional compilation of tests

2021-10-05 Thread Chris Johns
On 5/10/21 10:27 am, Kinsey Moore wrote:
> Currently debugger01 is the only user of the test-if-library in libbsd and it
> doesn't seem to work as expected. The configure step that detects libdebugger
> occurs and succeeds as it should for the zynq a9 qemu BSP, but debugger01.exe
> never gets compiled. I found this behavior while working on the implementation
> for libdebugger for AArch64. Is there some configuration that I'm missing to
> actually enable that test? Changing it to an unconditional test yields a
> successfully compiled debugger01.exe.
> 
> Perhaps someone that has more familiarity with the waf configure scripts can
> tell me what I'm missing.

More than likely :)

This is the generator for 'test-if-library' ...

https://git.rtems.org/rtems-libbsd/tree/builder.py?h=6-freebsd-12#n1184

which is ...

https://git.rtems.org/rtems-libbsd/tree/builder.py?h=6-freebsd-12#n658

Now the easy bit of the hard part 

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py?h=6-freebsd-12#n166

which is adding 'True or' which leads to the hard part ... lots of data you need
to look over. Look for the debugger01 test.

The builder comes from ..

https://git.rtems.org/rtems-libbsd/tree/wscript?h=6-freebsd-12#n76

The output adding True creates is the `self.data` as the comment says and that
is the internal view of the libbsd build and sources that is parsed to
constructs the waf build. It is also used to manage the source merge to and from
FreeBSD.

The data is inserted into the build here so track the debugger insert ...

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py?h=6-freebsd-12#n91

Finally the tests are generated here ...

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py?h=6-freebsd-12#n627

Maybe something is wrong in this last part so the bld.program is not happening.

I hope this helps.

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 2/4] sys/tree.h: Simplify chain of conditions

2021-10-05 Thread Sebastian Huber
In RB_GENERATE_REMOVE_COLOR() simplify a chain of conditions of the following
pattern

if (x) {
  ...
} else if (!x) {
  ...
}

to

if (x) {
  ...
} else {
  ...
}
---
 newlib/libc/include/sys/tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 15831c7dd..180809e9b 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -528,7 +528,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
RB_ROTATE_LEFT(head, tmp, oright, field); \
RB_COLOR(oright, field) = RB_BLACK; \
tmp = oright;   \
-   } else if (!RB_ISRED(RB_LEFT(tmp, field), field)) { \
+   } else {\
RB_COLOR(tmp, field) = RB_RED;  \
elm = parent;   \
parent = RB_PARENT(elm, field); \
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 1/4] sys/tree.h: Simplify loop condition

2021-10-05 Thread Sebastian Huber
We have

  #define RB_ISRED(elm, field) \
((elm) != NULL && RB_COLOR(elm, field) == RB_RED)

So, the RB_ISRED() contains an implicit check for NULL.  In
RB_GENERATE_REMOVE_COLOR() the "elm" pointer cannot be NULL in the while
condition.  Use RB_COLOR(elm) == RB_BLACK instead.
---
 newlib/libc/include/sys/tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 2af77a499..15831c7dd 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -540,7 +540,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
elm = RB_ROOT(head);\
break;  \
}   \
-   } while (!RB_ISRED(elm, field) && parent != NULL);  \
+   } while (RB_COLOR(elm, field) == RB_BLACK && parent != NULL);   \
RB_COLOR(elm, field) = RB_BLACK;\
 }
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 4/4] sys/tree.h: Red child with black sibling rotations

2021-10-05 Thread Sebastian Huber
Add specialized rotations RB_RED_ROTATE_LEFT() and RB_RED_ROTATE_RIGHT() which
may be used if we rotate a red child which has a black sibling.  Such a red
node must have at least two child nodes so that the following red-black tree
invariant is fulfilled:

  Every path from a given node to any of its descendant NULL nodes goes through
  the same number of black nodes.

  PARENT
 /  \
  BLACK RED
   /   \
BLACK BLACK
---
 newlib/libc/include/sys/tree.h | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 5fc052817..ae5e620c9 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -405,6 +405,28 @@ struct {   
\
RB_AUGMENT(elm);\
 } while (/*CONSTCOND*/ 0)
 
+#define RB_RED_ROTATE_LEFT(head, elm, tmp, field) do { \
+   (tmp) = RB_RIGHT(elm, field);   \
+   RB_RIGHT(elm, field) = RB_LEFT(tmp, field); \
+   RB_SET_PARENT(RB_RIGHT(elm, field), elm, field);\
+   RB_SET_PARENT(tmp, RB_PARENT(elm, field), field);   \
+   RB_SWAP_CHILD(head, elm, tmp, field);   \
+   RB_LEFT(tmp, field) = (elm);\
+   RB_SET_PARENT(elm, tmp, field); \
+   RB_AUGMENT(elm);\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_RED_ROTATE_RIGHT(head, elm, tmp, field) do {
\
+   (tmp) = RB_LEFT(elm, field);\
+   RB_LEFT(elm, field) = RB_RIGHT(tmp, field); \
+   RB_SET_PARENT(RB_LEFT(elm, field), elm, field); \
+   RB_SET_PARENT(tmp, RB_PARENT(elm, field), field);   \
+   RB_SWAP_CHILD(head, elm, tmp, field);   \
+   RB_RIGHT(tmp, field) = (elm);   \
+   RB_SET_PARENT(elm, tmp, field); \
+   RB_AUGMENT(elm);\
+} while (/*CONSTCOND*/ 0)
+
 /* Generates prototypes and inline functions */
 #defineRB_PROTOTYPE(name, type, field, cmp)
\
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
@@ -519,7 +541,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
tmp = RB_RIGHT(parent, field);  \
if (RB_COLOR(tmp, field) == RB_RED) {   \
RB_SET_BLACKRED(tmp, parent, field);\
-   RB_ROTATE_LEFT(head, parent, tmp, field);\
+   RB_RED_ROTATE_LEFT(head, parent, tmp, field); \
tmp = RB_RIGHT(parent, field);  \
}   \
if (RB_ISRED(RB_RIGHT(tmp, field), field))  \
@@ -545,7 +567,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
tmp = RB_LEFT(parent, field);   \
if (RB_COLOR(tmp, field) == RB_RED) {   \
RB_SET_BLACKRED(tmp, parent, field);\
-   RB_ROTATE_RIGHT(head, parent, tmp, field);\
+   RB_RED_ROTATE_RIGHT(head, parent, tmp, field); \
tmp = RB_LEFT(parent, field);   \
}   \
if (RB_ISRED(RB_LEFT(tmp, field), field))   \
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH 3/4] sys/tree.h: Add parent rotations

2021-10-05 Thread Sebastian Huber
Add specialized rotations RB_PARENT_ROTATE_LEFT() and RB_PARENT_ROTATE_RIGHT()
which may be used if the parent node exists and the direction of the child is
known.  The specialized rotations are derived from RB_ROTATE_LEFT() and
RB_ROTATE_RIGHT() where the RB_SWAP_CHILD() was replaced by a simple
assignment.
---
 newlib/libc/include/sys/tree.h | 36 ++
 1 file changed, 32 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 180809e9b..5fc052817 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -381,6 +381,30 @@ struct {   
\
RB_AUGMENT(elm);\
 } while (/*CONSTCOND*/ 0)
 
+#define RB_PARENT_ROTATE_LEFT(parent, left, tmp, field) do {   \
+   (tmp) = RB_RIGHT(left, field);  \
+   if ((RB_RIGHT(left, field) = RB_LEFT(tmp, field)) != NULL) {\
+   RB_SET_PARENT(RB_RIGHT(left, field), left, field);  \
+   }   \
+   RB_SET_PARENT(tmp, parent, field);  \
+   RB_LEFT(parent, field) = (tmp); \
+   RB_LEFT(tmp, field) = (left);   \
+   RB_SET_PARENT(left, tmp, field);\
+   RB_AUGMENT(left);   \
+} while (/*CONSTCOND*/ 0)
+
+#define RB_PARENT_ROTATE_RIGHT(parent, elm, tmp, field) do {   \
+   (tmp) = RB_LEFT(elm, field);\
+   if ((RB_LEFT(elm, field) = RB_RIGHT(tmp, field)) != NULL) { \
+   RB_SET_PARENT(RB_LEFT(elm, field), elm, field); \
+   }   \
+   RB_SET_PARENT(tmp, parent, field);  \
+   RB_RIGHT(parent, field) = (tmp);\
+   RB_RIGHT(tmp, field) = (elm);   \
+   RB_SET_PARENT(elm, tmp, field); \
+   RB_AUGMENT(elm);\
+} while (/*CONSTCOND*/ 0)
+
 /* Generates prototypes and inline functions */
 #defineRB_PROTOTYPE(name, type, field, cmp)
\
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
@@ -454,7 +478,8 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) 
\
continue;   \
}   \
if (RB_RIGHT(parent, field) == elm) {   \
-   RB_ROTATE_LEFT(head, parent, tmp, field);\
+   RB_PARENT_ROTATE_LEFT(gparent, parent,  \
+   tmp, field);\
tmp = parent;   \
parent = elm;   \
elm = tmp;  \
@@ -470,7 +495,8 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) 
\
continue;   \
}   \
if (RB_LEFT(parent, field) == elm) {\
-   RB_ROTATE_RIGHT(head, parent, tmp, field);\
+   RB_PARENT_ROTATE_RIGHT(gparent, parent, \
+   tmp, field);\
tmp = parent;   \
parent = elm;   \
elm = tmp;  \
@@ -500,7 +526,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
RB_COLOR(RB_RIGHT(tmp, field), field) = 
RB_BLACK; \
else if (RB_ISRED(RB_LEFT(tmp, field), field)) { \
struct type *oleft; \
-   RB_ROTATE_RIGHT(head, tmp, oleft, field); \
+   RB_PARENT_ROTATE_RIGHT(parent, tmp, \
+   oleft, field);  \
RB_COLOR(oleft, field) = RB_BLACK;  \
tmp = oleft;\
} else {\
@@ -525,7 +552,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
RB_COLOR(RB_LEFT(tmp, field), f

[PATCH 0/4] Optimize red-black tree insert/extract

2021-10-05 Thread Sebastian Huber
Code coverage analysis of the red-black tree insert/extract operations defined
in  showed that the macros contain dead code.  This patch set
simplifies some expressions and add specialized rotations.

Sebastian Huber (4):
  sys/tree.h: Simplify loop condition
  sys/tree.h: Simplify chain of conditions
  sys/tree.h: Add parent rotations
  sys/tree.h: Red child with black sibling rotations

 newlib/libc/include/sys/tree.h | 66 +-
 1 file changed, 58 insertions(+), 8 deletions(-)

-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v1] record-filter-zlib.cc: Ignore value returned from inflateInit().

2021-10-05 Thread Ryan Long
CID 1503013: Unchecked return value from library in ZlibFilter().

Closes #4431
---
 trace/record/record-filter-zlib.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/trace/record/record-filter-zlib.cc 
b/trace/record/record-filter-zlib.cc
index 62f1171..b97335b 100644
--- a/trace/record/record-filter-zlib.cc
+++ b/trace/record/record-filter-zlib.cc
@@ -48,7 +48,7 @@ ZlibFilter::ZlibFilter() : buffer_(65536)
   stream_.data_type = 0;
   stream_.adler = 0;
   stream_.reserved  = 0;
-  inflateInit(&stream_);
+  (void) inflateInit(&stream_);
 }
 
 ZlibFilter::~ZlibFilter()
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 0/4] Optimize red-black tree insert/extract

2021-10-05 Thread Sebastian Huber
Code coverage analysis of the red-black tree insert/extract operations defined
in  showed that the macros contain dead code.  This patch set
simplifies some expressions and add specialized rotations.

v2:

Add comments in patch 3 and 4.

Sebastian Huber (4):
  sys/tree.h: Simplify loop condition
  sys/tree.h: Simplify chain of conditions
  sys/tree.h: Add parent rotations
  sys/tree.h: Red child with black sibling rotations

 newlib/libc/include/sys/tree.h | 90 +++---
 1 file changed, 82 insertions(+), 8 deletions(-)

-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 1/4] sys/tree.h: Simplify loop condition

2021-10-05 Thread Sebastian Huber
We have

  #define RB_ISRED(elm, field) \
((elm) != NULL && RB_COLOR(elm, field) == RB_RED)

So, the RB_ISRED() contains an implicit check for NULL.  In
RB_GENERATE_REMOVE_COLOR() the "elm" pointer cannot be NULL in the while
condition.  Use RB_COLOR(elm) == RB_BLACK instead.
---
 newlib/libc/include/sys/tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 2af77a499..15831c7dd 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -540,7 +540,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
elm = RB_ROOT(head);\
break;  \
}   \
-   } while (!RB_ISRED(elm, field) && parent != NULL);  \
+   } while (RB_COLOR(elm, field) == RB_BLACK && parent != NULL);   \
RB_COLOR(elm, field) = RB_BLACK;\
 }
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 3/4] sys/tree.h: Add parent rotations

2021-10-05 Thread Sebastian Huber
Add specialized rotations RB_PARENT_ROTATE_LEFT() and RB_PARENT_ROTATE_RIGHT()
which may be used if the parent node exists and the direction of the child is
known.  The specialized rotations are derived from RB_ROTATE_LEFT() and
RB_ROTATE_RIGHT() where the RB_SWAP_CHILD() was replaced by a simple
assignment.
---
 newlib/libc/include/sys/tree.h | 43 ++
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 180809e9b..f6190f7f4 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -381,6 +381,37 @@ struct {   
\
RB_AUGMENT(elm);\
 } while (/*CONSTCOND*/ 0)
 
+/*
+ * The RB_PARENT_ROTATE_LEFT() and RB_PARENT_ROTATE_RIGHT() rotations are
+ * specialized versions of RB_ROTATE_LEFT() and RB_ROTATE_RIGHT() which may be
+ * used if the parent node exists and the direction of the child element is
+ * known.
+ */
+
+#define RB_PARENT_ROTATE_LEFT(parent, left, tmp, field) do {   \
+   (tmp) = RB_RIGHT(left, field);  \
+   if ((RB_RIGHT(left, field) = RB_LEFT(tmp, field)) != NULL) {\
+   RB_SET_PARENT(RB_RIGHT(left, field), left, field);  \
+   }   \
+   RB_SET_PARENT(tmp, parent, field);  \
+   RB_LEFT(parent, field) = (tmp); \
+   RB_LEFT(tmp, field) = (left);   \
+   RB_SET_PARENT(left, tmp, field);\
+   RB_AUGMENT(left);   \
+} while (/*CONSTCOND*/ 0)
+
+#define RB_PARENT_ROTATE_RIGHT(parent, right, tmp, field) do { \
+   (tmp) = RB_LEFT(right, field);  \
+   if ((RB_LEFT(right, field) = RB_RIGHT(tmp, field)) != NULL) {   \
+   RB_SET_PARENT(RB_LEFT(right, field), right, field); \
+   }   \
+   RB_SET_PARENT(tmp, parent, field);  \
+   RB_RIGHT(parent, field) = (tmp);\
+   RB_RIGHT(tmp, field) = (right); \
+   RB_SET_PARENT(right, tmp, field);   \
+   RB_AUGMENT(right);  \
+} while (/*CONSTCOND*/ 0)
+
 /* Generates prototypes and inline functions */
 #defineRB_PROTOTYPE(name, type, field, cmp)
\
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
@@ -454,7 +485,8 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) 
\
continue;   \
}   \
if (RB_RIGHT(parent, field) == elm) {   \
-   RB_ROTATE_LEFT(head, parent, tmp, field);\
+   RB_PARENT_ROTATE_LEFT(gparent, parent,  \
+   tmp, field);\
tmp = parent;   \
parent = elm;   \
elm = tmp;  \
@@ -470,7 +502,8 @@ name##_RB_INSERT_COLOR(struct name *head, struct type *elm) 
\
continue;   \
}   \
if (RB_LEFT(parent, field) == elm) {\
-   RB_ROTATE_RIGHT(head, parent, tmp, field);\
+   RB_PARENT_ROTATE_RIGHT(gparent, parent, \
+   tmp, field);\
tmp = parent;   \
parent = elm;   \
elm = tmp;  \
@@ -500,7 +533,8 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
RB_COLOR(RB_RIGHT(tmp, field), field) = 
RB_BLACK; \
else if (RB_ISRED(RB_LEFT(tmp, field), field)) { \
struct type *oleft; \
-   RB_ROTATE_RIGHT(head, tmp, oleft, field); \
+   RB_PARENT_ROTATE_RIGHT(parent, tmp, \
+   oleft, field);  \
RB_COLOR(oleft, field) = RB_BLACK;  \
tmp = oleft;

[PATCH v2 2/4] sys/tree.h: Simplify chain of conditions

2021-10-05 Thread Sebastian Huber
In RB_GENERATE_REMOVE_COLOR() simplify a chain of conditions of the following
pattern

if (x) {
  ...
} else if (!x) {
  ...
}

to

if (x) {
  ...
} else {
  ...
}
---
 newlib/libc/include/sys/tree.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index 15831c7dd..180809e9b 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -528,7 +528,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
RB_ROTATE_LEFT(head, tmp, oright, field); \
RB_COLOR(oright, field) = RB_BLACK; \
tmp = oright;   \
-   } else if (!RB_ISRED(RB_LEFT(tmp, field), field)) { \
+   } else {\
RB_COLOR(tmp, field) = RB_RED;  \
elm = parent;   \
parent = RB_PARENT(elm, field); \
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2] Align *utime*() with POSIX/glibc

2021-10-05 Thread Sebastian Huber
Change the prototypes to be in line with POSIX/glibc.  This may fix
issues with new warnings produced by GCC 11.

Signed-off-by: Sebastian Huber 
---
 newlib/libc/include/sys/_default_fcntl.h | 2 +-
 newlib/libc/include/sys/stat.h   | 4 ++--
 newlib/libc/include/sys/time.h   | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/newlib/libc/include/sys/_default_fcntl.h 
b/newlib/libc/include/sys/_default_fcntl.h
index b3177dd69..50a0de44b 100644
--- a/newlib/libc/include/sys/_default_fcntl.h
+++ b/newlib/libc/include/sys/_default_fcntl.h
@@ -221,7 +221,7 @@ extern int flock (int, int);
 #endif
 #if __GNU_VISIBLE
 #include 
-extern int futimesat (int, const char *, const struct timeval *);
+extern int futimesat (int, const char *, const struct timeval [2]);
 #endif
 
 /* Provide _ prototypes for functions provided by some versions
diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h
index 8769112b0..722ed0eff 100644
--- a/newlib/libc/include/sys/stat.h
+++ b/newlib/libc/include/sys/stat.h
@@ -153,10 +153,10 @@ int   fstatat (int, const char *__restrict , struct 
stat *__restrict, int);
 intmkdirat (int, const char *, mode_t);
 intmkfifoat (int, const char *, mode_t);
 intmknodat (int, const char *, mode_t, dev_t);
-intutimensat (int, const char *, const struct timespec *, int);
+intutimensat (int, const char *, const struct timespec [2], int);
 #endif
 #if __POSIX_VISIBLE >= 200809 && !defined(__INSIDE_CYGWIN__)
-intfutimens (int, const struct timespec *);
+intfutimens (int, const struct timespec [2]);
 #endif
 
 /* Provide prototypes for most of the _ names that are
diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h
index 84a429bf2..3be6c1e41 100644
--- a/newlib/libc/include/sys/time.h
+++ b/newlib/libc/include/sys/time.h
@@ -414,12 +414,12 @@ struct itimerval {
 #include 
 
 __BEGIN_DECLS
-int utimes (const char *__path, const struct timeval *__tvp);
+int utimes (const char *, const struct timeval [2]);
 
 #if __BSD_VISIBLE
 int adjtime (const struct timeval *, struct timeval *);
-int futimes (int, const struct timeval *);
-int lutimes (const char *, const struct timeval *);
+int futimes (int, const struct timeval [2]);
+int lutimes (const char *, const struct timeval [2]);
 int settimeofday (const struct timeval *, const struct timezone *);
 #endif
 
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v2 4/4] sys/tree.h: Red child with black sibling rotations

2021-10-05 Thread Sebastian Huber
Add specialized rotations RB_RED_ROTATE_LEFT() and RB_RED_ROTATE_RIGHT() which
may be used if we rotate a red child which has a black sibling.  Such a red
node must have at least two child nodes so that the following red-black tree
invariant is fulfilled:

  Every path from a given node to any of its descendant NULL nodes goes through
  the same number of black nodes.

  PARENT
 /  \
  BLACK RED
   /   \
BLACK BLACK
---
 newlib/libc/include/sys/tree.h | 43 --
 1 file changed, 41 insertions(+), 2 deletions(-)

diff --git a/newlib/libc/include/sys/tree.h b/newlib/libc/include/sys/tree.h
index f6190f7f4..7a3b55bdf 100644
--- a/newlib/libc/include/sys/tree.h
+++ b/newlib/libc/include/sys/tree.h
@@ -412,6 +412,45 @@ struct {   
\
RB_AUGMENT(right);  \
 } while (/*CONSTCOND*/ 0)
 
+/*
+ * The RB_RED_ROTATE_LEFT() and RB_RED_ROTATE_RIGHT() rotations are specialized
+ * versions of RB_ROTATE_LEFT() and RB_ROTATE_RIGHT() which may be used if we
+ * rotate a red child element which has a black sibling.  Such a red node must
+ * have at least two child nodes so that the following red-black tree invariant
+ * is fulfilled:
+ *
+ *  Every path from a given node to any of its descendant NULL nodes goes
+ *  through the same number of black nodes.
+ *
+ * parent
+ */  \
+ * BLACK   RED (elm)
+ *  /   \
+ *   BLACK  BLACK
+ */
+
+#define RB_RED_ROTATE_LEFT(head, elm, tmp, field) do { \
+   (tmp) = RB_RIGHT(elm, field);   \
+   RB_RIGHT(elm, field) = RB_LEFT(tmp, field); \
+   RB_SET_PARENT(RB_RIGHT(elm, field), elm, field);\
+   RB_SET_PARENT(tmp, RB_PARENT(elm, field), field);   \
+   RB_SWAP_CHILD(head, elm, tmp, field);   \
+   RB_LEFT(tmp, field) = (elm);\
+   RB_SET_PARENT(elm, tmp, field); \
+   RB_AUGMENT(elm);\
+} while (/*CONSTCOND*/ 0)
+
+#define RB_RED_ROTATE_RIGHT(head, elm, tmp, field) do {
\
+   (tmp) = RB_LEFT(elm, field);\
+   RB_LEFT(elm, field) = RB_RIGHT(tmp, field); \
+   RB_SET_PARENT(RB_LEFT(elm, field), elm, field); \
+   RB_SET_PARENT(tmp, RB_PARENT(elm, field), field);   \
+   RB_SWAP_CHILD(head, elm, tmp, field);   \
+   RB_RIGHT(tmp, field) = (elm);   \
+   RB_SET_PARENT(elm, tmp, field); \
+   RB_AUGMENT(elm);\
+} while (/*CONSTCOND*/ 0)
+
 /* Generates prototypes and inline functions */
 #defineRB_PROTOTYPE(name, type, field, cmp)
\
RB_PROTOTYPE_INTERNAL(name, type, field, cmp,)
@@ -526,7 +565,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
tmp = RB_RIGHT(parent, field);  \
if (RB_COLOR(tmp, field) == RB_RED) {   \
RB_SET_BLACKRED(tmp, parent, field);\
-   RB_ROTATE_LEFT(head, parent, tmp, field);\
+   RB_RED_ROTATE_LEFT(head, parent, tmp, field); \
tmp = RB_RIGHT(parent, field);  \
}   \
if (RB_ISRED(RB_RIGHT(tmp, field), field))  \
@@ -552,7 +591,7 @@ name##_RB_REMOVE_COLOR(struct name *head, struct type 
*parent)  \
tmp = RB_LEFT(parent, field);   \
if (RB_COLOR(tmp, field) == RB_RED) {   \
RB_SET_BLACKRED(tmp, parent, field);\
-   RB_ROTATE_RIGHT(head, parent, tmp, field);\
+   RB_RED_ROTATE_RIGHT(head, parent, tmp, field); \
tmp = RB_LEFT(parent, field);   \
}   \
if (RB_ISRED(RB_LEFT(tmp, field), field))   \
-- 
2.26.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] score: Optimize EDF SMP scheduler ops

2021-10-05 Thread Sebastian Huber
The schedule operation is only called by rtems_task_mode().  It is
called if preempt mode of the executing thread changes from disabled to
enabled.  Since the EDF SMP scheduler does not support the disabled
preemption mode, the schedule operation is never called.
---
 cpukit/include/rtems/score/scheduleredfsmp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/include/rtems/score/scheduleredfsmp.h 
b/cpukit/include/rtems/score/scheduleredfsmp.h
index 6fef6fb86a..1841aa4a7b 100644
--- a/cpukit/include/rtems/score/scheduleredfsmp.h
+++ b/cpukit/include/rtems/score/scheduleredfsmp.h
@@ -110,7 +110,7 @@ typedef struct {
 #define SCHEDULER_EDF_SMP_ENTRY_POINTS \
   { \
 _Scheduler_EDF_SMP_Initialize, \
-_Scheduler_default_Schedule, \
+NULL, \
 _Scheduler_EDF_SMP_Yield, \
 _Scheduler_EDF_SMP_Block, \
 _Scheduler_EDF_SMP_Unblock, \
-- 
2.31.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH] score: Optimize EDF SMP scheduler ops

2021-10-05 Thread Joel Sherrill
On Tue, Oct 5, 2021 at 1:26 PM Sebastian Huber
 wrote:
>
> The schedule operation is only called by rtems_task_mode().  It is
> called if preempt mode of the executing thread changes from disabled to
> enabled.  Since the EDF SMP scheduler does not support the disabled
> preemption mode, the schedule operation is never called.

Pulling this logic thread further, since disable preemption is not available in
SMP configurations, why even have this callout at all in SMP mode?

That should ripple up to rtems_task_mode() and eliminate some code also.

> ---
>  cpukit/include/rtems/score/scheduleredfsmp.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/cpukit/include/rtems/score/scheduleredfsmp.h 
> b/cpukit/include/rtems/score/scheduleredfsmp.h
> index 6fef6fb86a..1841aa4a7b 100644
> --- a/cpukit/include/rtems/score/scheduleredfsmp.h
> +++ b/cpukit/include/rtems/score/scheduleredfsmp.h
> @@ -110,7 +110,7 @@ typedef struct {
>  #define SCHEDULER_EDF_SMP_ENTRY_POINTS \
>{ \
>  _Scheduler_EDF_SMP_Initialize, \
> -_Scheduler_default_Schedule, \
> +NULL, \
>  _Scheduler_EDF_SMP_Yield, \
>  _Scheduler_EDF_SMP_Block, \
>  _Scheduler_EDF_SMP_Unblock, \
> --
> 2.31.1
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[RTEMS 5 v2] Add support for IDLE Thread stack allocator

2021-10-05 Thread Joel Sherrill
Add a stack allocator hook specifically for allocation of IDLE thread stacks.
This allows the user to decide if IDLE thread stacks are statically allocated
or handled by the same custom allocator mechanism as other thread stacks.

Closes #4520.
---
 cpukit/Makefile.am|   1 +
 cpukit/include/rtems/confdefs/percpu.h|  18 ++-
 cpukit/include/rtems/confdefs/wkspace.h   |  22 
 cpukit/include/rtems/config.h |   3 +
 cpukit/include/rtems/score/stack.h|  42 +++
 cpukit/score/src/stackallocatorforidle.c  |  36 ++
 cpukit/score/src/threadcreateidle.c   |  24 +++-
 testsuites/sptests/Makefile.am|   9 ++
 testsuites/sptests/configure.ac   |   1 +
 testsuites/sptests/spstkalloc03/init.c| 103 ++
 .../sptests/spstkalloc03/spstkalloc03.doc |  19 
 .../sptests/spstkalloc03/spstkalloc03.scn |   2 +
 12 files changed, 272 insertions(+), 8 deletions(-)
 create mode 100644 cpukit/score/src/stackallocatorforidle.c
 create mode 100644 testsuites/sptests/spstkalloc03/init.c
 create mode 100644 testsuites/sptests/spstkalloc03/spstkalloc03.doc
 create mode 100644 testsuites/sptests/spstkalloc03/spstkalloc03.scn

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 18eda95543..202cf3c346 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -930,6 +930,7 @@ librtemscpu_a_SOURCES += 
score/src/schedulercbssetparameters.c
 librtemscpu_a_SOURCES += score/src/schedulercbsreleasejob.c
 librtemscpu_a_SOURCES += score/src/schedulercbsunblock.c
 librtemscpu_a_SOURCES += score/src/stackallocator.c
+librtemscpu_a_SOURCES += score/src/stackallocatorforidle.c
 librtemscpu_a_SOURCES += score/src/pheapallocate.c
 librtemscpu_a_SOURCES += score/src/pheapextend.c
 librtemscpu_a_SOURCES += score/src/pheapfree.c
diff --git a/cpukit/include/rtems/confdefs/percpu.h 
b/cpukit/include/rtems/confdefs/percpu.h
index f3a9a4f3e7..b7baebea05 100644
--- a/cpukit/include/rtems/confdefs/percpu.h
+++ b/cpukit/include/rtems/confdefs/percpu.h
@@ -133,11 +133,19 @@ RTEMS_DEFINE_GLOBAL_SYMBOL(
 
 const size_t _Thread_Idle_stack_size = CONFIGURE_IDLE_TASK_STACK_SIZE;
 
-char _Thread_Idle_stacks[
-  _CONFIGURE_MAXIMUM_PROCESSORS
-* ( CONFIGURE_IDLE_TASK_STACK_SIZE + CPU_IDLE_TASK_IS_FP * CONTEXT_FP_SIZE 
)
-] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
-RTEMS_SECTION( ".rtemsstack.idle" );
+/*
+ * If the user provides a custom idle stack allocator, then we do not need
+ * memory reserved for the stacks but the symbol is still referenced in
+ * threadcreateidle.c. The code path just never uses it. Make it minimal
+ * size to proceed.
+ */
+#ifndef CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE
+  char _Thread_Idle_stacks[
+_CONFIGURE_MAXIMUM_PROCESSORS
+  * ( CONFIGURE_IDLE_TASK_STACK_SIZE + CPU_IDLE_TASK_IS_FP * 
CONTEXT_FP_SIZE )
+  ] RTEMS_ALIGNED( CPU_INTERRUPT_STACK_ALIGNMENT )
+  RTEMS_SECTION( ".rtemsstack.idle" );
+#endif
 
 #if defined(CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION) && \
   !defined(CONFIGURE_IDLE_TASK_BODY)
diff --git a/cpukit/include/rtems/confdefs/wkspace.h 
b/cpukit/include/rtems/confdefs/wkspace.h
index 484dde20ea..22a4c4c063 100644
--- a/cpukit/include/rtems/confdefs/wkspace.h
+++ b/cpukit/include/rtems/confdefs/wkspace.h
@@ -132,12 +132,14 @@ const uintptr_t _Stack_Space_size = 
_CONFIGURE_STACK_SPACE_SIZE;
 
 #if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
   && defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
+  /* Custom allocator may or may not use the work space. */
   #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
 const bool _Stack_Allocator_avoids_workspace = true;
   #else
 const bool _Stack_Allocator_avoids_workspace = false;
   #endif
 
+  /* Custom allocator may or may not need initialization. */
   #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_INIT
 const Stack_Allocator_initialize _Stack_Allocator_initialize =
   CONFIGURE_TASK_STACK_ALLOCATOR_INIT;
@@ -145,14 +147,34 @@ const uintptr_t _Stack_Space_size = 
_CONFIGURE_STACK_SPACE_SIZE;
 const Stack_Allocator_initialize _Stack_Allocator_initialize = NULL;
   #endif
 
+  /* Custom allocator must include allocate and free */
   const Stack_Allocator_allocate _Stack_Allocator_allocate =
 CONFIGURE_TASK_STACK_ALLOCATOR;
 
   const Stack_Allocator_free _Stack_Allocator_free =
 CONFIGURE_TASK_STACK_DEALLOCATOR;
+
+  /* custom IDLE thread stacks allocator */
+  #ifdef CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE
+const Stack_Allocator_allocate_for_idle _Stack_Allocator_allocate_for_idle 
=
+  CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE;
+  #endif
+
+/*
+ * Must provide both a custom stack allocator and deallocator
+ */
 #elif defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
   || defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
   #error "CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR 
must be both defined or both undefined"
+
+/*
+ * If the application wants to provide an IDLE threads

Re: [PATCH] score: Optimize EDF SMP scheduler ops

2021-10-05 Thread Sebastian Huber

On 05/10/2021 20:34, Joel Sherrill wrote:

On Tue, Oct 5, 2021 at 1:26 PM Sebastian Huber
  wrote:

The schedule operation is only called by rtems_task_mode().  It is
called if preempt mode of the executing thread changes from disabled to
enabled.  Since the EDF SMP scheduler does not support the disabled
preemption mode, the schedule operation is never called.

Pulling this logic thread further, since disable preemption is not available in
SMP configurations, why even have this callout at all in SMP mode?

That should ripple up to rtems_task_mode() and eliminate some code also.


If you have only one processor configured and you use a non-SMP 
scheduler, then the disabled preemption mode is also supported in SMP 
configurations.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] score: Optimize EDF SMP scheduler ops

2021-10-05 Thread Joel Sherrill
On Tue, Oct 5, 2021, 1:49 PM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 05/10/2021 20:34, Joel Sherrill wrote:
> > On Tue, Oct 5, 2021 at 1:26 PM Sebastian Huber
> >   wrote:
> >> The schedule operation is only called by rtems_task_mode().  It is
> >> called if preempt mode of the executing thread changes from disabled to
> >> enabled.  Since the EDF SMP scheduler does not support the disabled
> >> preemption mode, the schedule operation is never called.
> > Pulling this logic thread further, since disable preemption is not
> available in
> > SMP configurations, why even have this callout at all in SMP mode?
> >
> > That should ripple up to rtems_task_mode() and eliminate some code also.
>
> If you have only one processor configured and you use a non-SMP
> scheduler, then the disabled preemption mode is also supported in SMP
> configurations.
>

Yeah. Makes sense. Does make you wonder if this is an edge case that
shouldn't work

>
> --
> embedded brains GmbH
> Herr Sebastian HUBER
> Dornierstr. 4
> 82178 Puchheim
> Germany
> email: sebastian.hu...@embedded-brains.de
> phone: +49-89-18 94 741 - 16
> fax:   +49-89-18 94 741 - 08
>
> Registergericht: Amtsgericht München
> Registernummer: HRB 157899
> Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
> Unsere Datenschutzerklärung finden Sie hier:
> https://embedded-brains.de/datenschutzerklaerung/
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH v2 1/3] score: Add MicroBlaze port

2021-10-05 Thread Alex White
From: Joel Sherrill 

---
 .../gdbmbsim/startup/_hw_exception_handler.S  |   38 +
 cpukit/score/cpu/microblaze/cpu.c |  168 +++
 cpukit/score/cpu/microblaze/rtems/asm.h   |  125 ++
 cpukit/score/cpu/microblaze/rtems/score/cpu.h | 1263 +
 .../cpu/microblaze/rtems/score/microblaze.h   |   70 +
 5 files changed, 1664 insertions(+)
 create mode 100644 
c/src/lib/libbsp/microblaze/gdbmbsim/startup/_hw_exception_handler.S
 create mode 100644 cpukit/score/cpu/microblaze/cpu.c
 create mode 100644 cpukit/score/cpu/microblaze/rtems/asm.h
 create mode 100644 cpukit/score/cpu/microblaze/rtems/score/cpu.h
 create mode 100644 cpukit/score/cpu/microblaze/rtems/score/microblaze.h

diff --git 
a/c/src/lib/libbsp/microblaze/gdbmbsim/startup/_hw_exception_handler.S 
b/c/src/lib/libbsp/microblaze/gdbmbsim/startup/_hw_exception_handler.S
new file mode 100644
index 00..bb729ca33b
--- /dev/null
+++ b/c/src/lib/libbsp/microblaze/gdbmbsim/startup/_hw_exception_handler.S
@@ -0,0 +1,38 @@
+/* Copyright (c) 2001, 2009 Xilinx, Inc.  All rights reserved. 
+   
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions are
+   met:
+   
+   1.  Redistributions source code must retain the above copyright notice,
+   this list of conditions and the following disclaimer. 
+   
+   2.  Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution. 
+   
+   3.  Neither the name of Xilinx nor the names of its contributors may be
+   used to endorse or promote products derived from this software without
+   specific prior written permission. 
+   
+   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
+   IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+   TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+   PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+   HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+   TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  
+*/
+
+   .text
+   .globl _hw_exception_handler# HW Exception Handler Label 
+   .align 2
+   
+   _hw_exception_handler:
+   rtedr17, 0
+   nop
diff --git a/cpukit/score/cpu/microblaze/cpu.c 
b/cpukit/score/cpu/microblaze/cpu.c
new file mode 100644
index 00..27dd69b9fb
--- /dev/null
+++ b/cpukit/score/cpu/microblaze/cpu.c
@@ -0,0 +1,168 @@
+/*
+ *  MicroBlaze CPU Dependent Source
+ *
+ *  COPYRIGHT (c) 1989-2011.
+ *  On-Line Applications Research Corporation (OAR).
+ *
+ *  The license and distribution terms for this file may be
+ *  found in the file LICENSE in this distribution or at
+ *  http://www.rtems.com/license/LICENSE.
+ *
+ *  $Id: cpu.c,v 1.24 2010/03/27 15:02:26 joel Exp $
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include 
+#include 
+#include 
+
+/*  _CPU_Initialize
+ *
+ *  This routine performs processor dependent initialization.
+ *
+ *  INPUT PARAMETERS: NONE
+ *
+ *  NO_CPU Specific Information:
+ *
+ *  XXX document implementation including references if appropriate
+ */
+
+void _CPU_Initialize(void)
+{
+  /*
+   *  If there is not an easy way to initialize the FP context
+   *  during Context_Initialize, then it is usually easier to
+   *  save an "uninitialized" FP context here and copy it to
+   *  the task's during Context_Initialize.
+   */
+
+  /* FP context initialization support goes here */
+}
+
+/*PAGE
+ *
+ *  _CPU_ISR_Get_level
+ *
+ *  NO_CPU Specific Information:
+ *
+ *  XXX document implementation including references if appropriate
+ */
+
+uint32_t   _CPU_ISR_Get_level( void )
+{
+  /*
+   *  This routine returns the current interrupt level.
+   */
+
+  return 0;
+}
+
+/*PAGE
+ *
+ *  _CPU_ISR_install_raw_handler
+ *
+ *  NO_CPU Specific Information:
+ *
+ *  XXX document implementation including references if appropriate
+ */
+
+void _CPU_ISR_install_raw_handler(
+  uint32_tvector,
+  proc_ptrnew_handler,
+  proc_ptr   *old_handler
+)
+{
+  /*
+   *  This is where we install the interrupt handler into the "raw" interrupt
+   *  table used by the CPU to dispatch interrupt handlers.
+   */
+}
+
+/*PAGE
+ *
+ *  _CPU_ISR_install_vector
+ *
+ *  This kernel routine installs the RTEMS handler for the
+ *  specified vector.
+ *
+ *  Input parameters:
+ *vector  - interrupt vector number
+ *old_handler - former ISR for this vector 

[PATCH v2 2/3] bsps: Add MicroBlaze FPGA BSP

2021-10-05 Thread Alex White
From: Hesham ALMatary 

---
 .../microblaze_fpga/console/console-io.c  |  74 +
 .../microblaze/microblaze_fpga/include/bsp.h  |  48 ++
 .../microblaze/microblaze_fpga/include/tm27.h |  48 ++
 .../microblaze/microblaze_fpga/start/start.S  | 109 +
 .../startup/_exception_handler.S  |  38 +
 .../startup/_interrupt_handler.S  |  38 +
 .../microblaze_fpga/startup/sim-crtinit.S |  86 +++
 .../shared/include/linker-symbols.h   | 104 +
 cpukit/score/cpu/microblaze/cpu.c |  47 +-
 .../microblaze/microblaze-context-switch.S|  89 +++
 cpukit/score/cpu/microblaze/rtems/asm.h   |   2 +-
 cpukit/score/cpu/microblaze/rtems/score/cpu.h | 145 ++
 .../cpu/microblaze/rtems/score/microblaze.h   |  35 -
 13 files changed, 784 insertions(+), 79 deletions(-)
 create mode 100644 
c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c
 create mode 100644 c/src/lib/libbsp/microblaze/microblaze_fpga/include/bsp.h
 create mode 100644 c/src/lib/libbsp/microblaze/microblaze_fpga/include/tm27.h
 create mode 100644 c/src/lib/libbsp/microblaze/microblaze_fpga/start/start.S
 create mode 100644 
c/src/lib/libbsp/microblaze/microblaze_fpga/startup/_exception_handler.S
 create mode 100644 
c/src/lib/libbsp/microblaze/microblaze_fpga/startup/_interrupt_handler.S
 create mode 100644 
c/src/lib/libbsp/microblaze/microblaze_fpga/startup/sim-crtinit.S
 create mode 100644 c/src/lib/libbsp/microblaze/shared/include/linker-symbols.h
 create mode 100644 cpukit/score/cpu/microblaze/microblaze-context-switch.S

diff --git a/c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c 
b/c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c
new file mode 100644
index 00..47592967ac
--- /dev/null
+++ b/c/src/lib/libbsp/microblaze/microblaze_fpga/console/console-io.c
@@ -0,0 +1,74 @@
+/**
+ * @file
+ *
+ * @ingroup microblaze_uart
+ *
+ * @brief Console Configuration.
+ */
+
+/*
+ *  Copyright (C) 2015 Hesham Almatary
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *   notice, this list of conditions and the following disclaimer in the
+ *   documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+
+#include 
+
+#include 
+#include 
+
+console_tbl Console_Configuration_Ports [] = {
+{
+  .sDeviceName = "/dev/ttyS0",
+  .deviceType = SERIAL_CUSTOM,
+  .pDeviceFns = µblaze_uart_fns,
+  .deviceProbe = NULL,
+  .pDeviceFlow = NULL,
+  .ulCtrlPort1 = UART_BASEADDRESS,
+  .ulCtrlPort2 = 0,
+  .ulClock = 9600,
+  .ulIntVector = 0
+}
+};
+
+#define PORT_COUNT \
+  (sizeof(Console_Configuration_Ports) \
+/ sizeof(Console_Configuration_Ports [0]))
+
+unsigned long Console_Configuration_Count = PORT_COUNT;
+
+static void output_char(char c)
+{
+  const console_fns *con =
+Console_Configuration_Ports [Console_Port_Minor].pDeviceFns;
+
+  if (c == '\n') {
+con->deviceWritePolled((int) Console_Port_Minor, '\r');
+  }
+  con->deviceWritePolled((int) Console_Port_Minor, c);
+}
+
+BSP_output_char_function_type BSP_output_char = output_char;
+
+BSP_polling_getchar_function_type BSP_poll_char = NULL;
diff --git a/c/src/lib/libbsp/microblaze/microblaze_fpga/include/bsp.h 
b/c/src/lib/libbsp/microblaze/microblaze_fpga/include/bsp.h
new file mode 100644
index 00..cb72835571
--- /dev/null
+++ b/c/src/lib/libbsp/microblaze/microblaze_fpga/include/bsp.h
@@ -0,0 +1,48 @@
+/*
+ *  Copyright (C) 2015 Hesham Almatary
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer

[PATCH v2 0/3] Add MicroBlaze port and BSP

2021-10-05 Thread Alex White
v2:
  - Move files from bsps/microblaze/microblaze_fpga/startup to
bsps/microblaze/microblaze_fpga/start
  - Use crtinit.S from libgloss rather than sim-crtinit.S

Hi,

This patch set adds support for the MicroBlaze architecture along with
a basic BSP based on Xilinx's KCU105 PetaLinux BSP configuration.

The initial architecture port was started 6 or 7 years ago, I believe.
To make authorship clear and preserve file history, the work is broken
up into three patches. I made an effort to prune the first two patches
of any files related to the old build system.

Thanks,

Alex White

Alex White (1):
  microblaze: Rework for RTEMS 6

Hesham ALMatary (1):
  bsps: Add MicroBlaze FPGA BSP

Joel Sherrill (1):
  score: Add MicroBlaze port

 bsps/include/bsp/fatal.h  |   3 +
 bsps/microblaze/include/bsp/linker-symbols.h  | 106 ++
 bsps/microblaze/include/common/xil_types.h| 197 +++
 bsps/microblaze/include/dev/serial/uartlite.h |  62 
 .../include/dev/serial/uartlite_l.h   | 323 ++
 bsps/microblaze/microblaze_fpga/clock/clock.c | 145 
 .../microblaze_fpga/console/console-io.c  |  57 
 .../microblaze_fpga/console/debug-io.c|  66 
 bsps/microblaze/microblaze_fpga/include/bsp.h |  53 +++
 .../microblaze_fpga/include/bsp/intc.h|  74 
 .../microblaze_fpga/include/bsp/irq.h |  49 +++
 .../microblaze_fpga/include/bsp/timer.h   |  69 
 .../microblaze/microblaze_fpga/include/tm27.h |  58 
 bsps/microblaze/microblaze_fpga/irq/irq.c | 168 +
 .../start/_exception_handler.S|  52 +++
 .../start/_hw_exception_handler.S |  52 +++
 .../start/_interrupt_handler.S|  53 +++
 .../microblaze_fpga/start/bspreset.c  |  44 +++
 .../microblaze_fpga/start/bspstart.c  |  43 +++
 .../microblaze_fpga/start/crtinit.S   | 104 ++
 bsps/microblaze/shared/cache/cache.c  |  36 ++
 bsps/microblaze/shared/dev/serial/uartlite.c  | 145 
 .../microblaze/shared/dev/serial/uartlite_l.c |  99 ++
 bsps/microblaze/shared/start/start.S  | 114 +++
 cpukit/score/cpu/microblaze/__tls_get_addr.c  |  54 +++
 cpukit/score/cpu/microblaze/cpu.c | 121 +++
 cpukit/score/cpu/microblaze/cpu_asm.S | 194 +++
 .../score/cpu/microblaze/include/rtems/asm.h  | 138 
 .../cpu/microblaze/include/rtems/score/cpu.h  | 305 +
 .../include/rtems/score/cpuatomic.h   |  41 +++
 .../microblaze/include/rtems/score/cpuimpl.h  |  96 ++
 .../include/rtems/score/microblaze.h  |  57 
 .../microblaze/microblaze-context-switch.S| 107 ++
 .../microblaze/microblaze-context-validate.S  | 117 +++
 .../microblaze-context-volatile-clobber.S |  28 ++
 spec/build/bsps/microblaze/grp.yml|  15 +
 .../bsps/microblaze/microblaze_fpga/abi.yml   |  20 ++
 .../microblaze/microblaze_fpga/bspkcu105.yml  |  24 ++
 .../microblaze_fpga/bspkcu105_qemu.yml|  24 ++
 .../bsps/microblaze/microblaze_fpga/grp.yml   |  36 ++
 .../microblaze/microblaze_fpga/linkcmds.yml   | 242 +
 .../bsps/microblaze/microblaze_fpga/obj.yml   |  51 +++
 .../microblaze_fpga/optconsoleinterrupts.yml  |  15 +
 .../microblaze_fpga/optintcbaseaddress.yml|  18 +
 .../microblaze_fpga/opttimerbaseaddress.yml   |  18 +
 .../microblaze_fpga/opttimerfrequency.yml |  17 +
 .../optuartlitebaseaddress.yml|  18 +
 .../bsps/microblaze/microblaze_fpga/start.yml |  14 +
 .../microblaze_fpga/tstkcu105_qemu.yml|  14 +
 spec/build/cpukit/cpumicroblaze.yml   |  29 ++
 spec/build/cpukit/librtemscpu.yml |   2 +
 51 files changed, 3987 insertions(+)
 create mode 100644 bsps/microblaze/include/bsp/linker-symbols.h
 create mode 100644 bsps/microblaze/include/common/xil_types.h
 create mode 100644 bsps/microblaze/include/dev/serial/uartlite.h
 create mode 100644 bsps/microblaze/include/dev/serial/uartlite_l.h
 create mode 100644 bsps/microblaze/microblaze_fpga/clock/clock.c
 create mode 100644 bsps/microblaze/microblaze_fpga/console/console-io.c
 create mode 100644 bsps/microblaze/microblaze_fpga/console/debug-io.c
 create mode 100644 bsps/microblaze/microblaze_fpga/include/bsp.h
 create mode 100644 bsps/microblaze/microblaze_fpga/include/bsp/intc.h
 create mode 100644 bsps/microblaze/microblaze_fpga/include/bsp/irq.h
 create mode 100644 bsps/microblaze/microblaze_fpga/include/bsp/timer.h
 create mode 100644 bsps/microblaze/microblaze_fpga/include/tm27.h
 create mode 100644 bsps/microblaze/microblaze_fpga/irq/irq.c
 create mode 100644 bsps/microblaze/microblaze_fpga/start/_exception_handler.S
 create mode 100644 
bsps/microblaze/microblaze_fpga/start/_hw_exception_handler.S
 create mode 100644 bsps/microblaze/microblaze_fpga/start/_interrupt_handler.S
 create mode 100644 bsps/microblaze/microblaze_fpga/start/bspreset.c
 create mode 100644 bsps/microblaze/

[RTEMS DOCS 5] task-stack-alloc.rst: Add CONFIGURE_TASK_STACK_FROM_ALLOCATOR

2021-10-05 Thread Joel Sherrill
Updates #4520.
---
 c-user/config/task-stack-alloc.rst | 39 +-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/c-user/config/task-stack-alloc.rst 
b/c-user/config/task-stack-alloc.rst
index 297c624..054f301 100644
--- a/c-user/config/task-stack-alloc.rst
+++ b/c-user/config/task-stack-alloc.rst
@@ -1,7 +1,7 @@
 .. SPDX-License-Identifier: CC-BY-SA-4.0
 
 .. Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
-.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
+.. Copyright (C) 1988, 2008, 2021 On-Line Applications Research Corporation 
(OAR)
 
 Task Stack Allocator Configuration
 ==
@@ -115,6 +115,43 @@ NOTES:
 
 * `CONFIGURE_TASK_STACK_DEALLOCATOR`
 
+.. index:: _CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE
+.. index:: IDLE task stack allocator
+
+.. _CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE:
+
+CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE
+---
+
+CONSTANT:
+``CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE``
+
+OPTION TYPE:
+This configuration option is an initializer define.
+
+DEFAULT VALUE:
+The default value is ``_Stack_Allocator_allocate_for_idle``, which
+indicates that IDLE task stacks will be allocated from an area statically
+reserved by ```.
+
+VALUE CONSTRAINTS:
+The value of this configuration option shall be defined to a valid function
+pointer of the type ``void *( *allocate )( Per_CPU_Control *, size_t )``.
+
+DESCRIPTION:
+The value of this configuration option initializes the IDLE stack allocator
+allocate handler.
+
+NOTES:
+A correctly configured system shall only specify this configuration option
+if the task stack allocators are configured and the following are 
consistent:
+
+* :ref:`CONFIGURE_TASK_STACK_ALLOCATOR_INIT`
+
+* :ref:`CONFIGURE_TASK_STACK_ALLOCATOR`
+
+* :ref:`CONFIGURE_TASK_STACK_DEALLOCATOR`
+
 .. index:: CONFIGURE_TASK_STACK_FROM_ALLOCATOR
 .. index:: task stack allocator
 
-- 
1.8.3.1

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems-libbsd] waf_libbsd: Account for library check results

2021-10-05 Thread Kinsey Moore
Conditionally compiled tests (consisting only of debugger01) were not
compiling as expected when libdebugger was present. This appears to have
occurred during the transition from header detection or due to an
intervening change in the waf internal libraries. The result of
check_cc() is the only location this information is reported, so library
checks now set HAVE_ as appropriate when the library is found
so existing code for header configuration correctly recognize that a
library is present.
---
 waf_libbsd.py | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/waf_libbsd.py b/waf_libbsd.py
index 97e6d6ee..613797aa 100644
--- a/waf_libbsd.py
+++ b/waf_libbsd.py
@@ -180,10 +180,11 @@ class Builder(builder.ModuleManager):
mandatory=False)
 elif configTest == 'library':
 for l in self.data['configure'][configTest][cfg]:
-conf.check_cc(lib=l,
-  fragment=rtems.test_application(),
-  execute=False,
-  mandatory=False)
+if conf.check_cc(lib=l,
+ fragment=rtems.test_application(),
+ execute=False,
+ mandatory=False)
+conf.env['HAVE_%s' % l.upper()] = True
 else:
 bld.fatal('invalid config test: %s' % (configTest))
 section_flags = ["-fdata-sections", "-ffunction-sections"]
-- 
2.30.2

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: libbsd: Conditional compilation of tests

2021-10-05 Thread Kinsey Moore



On 10/5/2021 02:48, Chris Johns wrote:

On 5/10/21 10:27 am, Kinsey Moore wrote:

Currently debugger01 is the only user of the test-if-library in libbsd and it
doesn't seem to work as expected. The configure step that detects libdebugger
occurs and succeeds as it should for the zynq a9 qemu BSP, but debugger01.exe
never gets compiled. I found this behavior while working on the implementation
for libdebugger for AArch64. Is there some configuration that I'm missing to
actually enable that test? Changing it to an unconditional test yields a
successfully compiled debugger01.exe.

Perhaps someone that has more familiarity with the waf configure scripts can
tell me what I'm missing.

More than likely :)

This is the generator for 'test-if-library' ...

https://git.rtems.org/rtems-libbsd/tree/builder.py?h=6-freebsd-12#n1184

which is ...

https://git.rtems.org/rtems-libbsd/tree/builder.py?h=6-freebsd-12#n658

Now the easy bit of the hard part 

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py?h=6-freebsd-12#n166

which is adding 'True or' which leads to the hard part ... lots of data you need
to look over. Look for the debugger01 test.

The builder comes from ..

https://git.rtems.org/rtems-libbsd/tree/wscript?h=6-freebsd-12#n76

The output adding True creates is the `self.data` as the comment says and that
is the internal view of the libbsd build and sources that is parsed to
constructs the waf build. It is also used to manage the source merge to and from
FreeBSD.

The data is inserted into the build here so track the debugger insert ...

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py?h=6-freebsd-12#n91

Finally the tests are generated here ...

https://git.rtems.org/rtems-libbsd/tree/waf_libbsd.py?h=6-freebsd-12#n627

Maybe something is wrong in this last part so the bld.program is not happening.

I hope this helps.


Thanks, I think it got me to the root of the problem. When the libbsd 
waf build for the debugger01 test was moved from a header check to the 
more appropriate library check, it was still checking for HAVE_DEBUGGER 
which gets defined for header checks but not for library checks 
(alternatively, the waf library may have changed in the intervening 
period). I've sent a preliminary patch to the list that resolves the 
problem, but it may not be exactly the right patch for the job.



Kinsey

___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [PATCH rtems-libbsd] waf_libbsd: Account for library check results

2021-10-05 Thread Chris Johns
hi Kinsey,

This change looks OK to me. Nice work.

Thanks
Chris

On 6/10/21 7:55 am, Kinsey Moore wrote:
> Conditionally compiled tests (consisting only of debugger01) were not
> compiling as expected when libdebugger was present. This appears to have
> occurred during the transition from header detection or due to an
> intervening change in the waf internal libraries. The result of
> check_cc() is the only location this information is reported, so library
> checks now set HAVE_ as appropriate when the library is found
> so existing code for header configuration correctly recognize that a
> library is present.
> ---
>  waf_libbsd.py | 9 +
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/waf_libbsd.py b/waf_libbsd.py
> index 97e6d6ee..613797aa 100644
> --- a/waf_libbsd.py
> +++ b/waf_libbsd.py
> @@ -180,10 +180,11 @@ class Builder(builder.ModuleManager):
> mandatory=False)
>  elif configTest == 'library':
>  for l in self.data['configure'][configTest][cfg]:
> -conf.check_cc(lib=l,
> -  fragment=rtems.test_application(),
> -  execute=False,
> -  mandatory=False)
> +if conf.check_cc(lib=l,
> + 
> fragment=rtems.test_application(),
> + execute=False,
> + mandatory=False)
> +conf.env['HAVE_%s' % l.upper()] = True
>  else:
>  bld.fatal('invalid config test: %s' % (configTest))
>  section_flags = ["-fdata-sections", "-ffunction-sections"]
> 
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Ticket 4429

2021-10-05 Thread zack leung
For relative times, the clock identifier is not used to select the clock
and instead always the CLOCK_MONOTONIC is used. A side-effect is that
sleep() and nanosleep() use the wrong clock (CLOCK_MONOTONIC instead of
CLOCK_REALTIME).

I don't understand how the monotonic clock is not being used. I know that
if it's not a realtime clock then
Thread_queue_Context_set_enqueue_timeout_monotonic_timespec is called and i
believe that all the appropriate branches are there to make the monotonic
clock work.

Zack
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: [RTEMS 5 v2] Add support for IDLE Thread stack allocator

2021-10-05 Thread Sebastian Huber

[..]

+
+/*
+ * If the application wants to provide an IDLE threads stack allocator, it
+ * must also provide a custom allocator/deallocator for user thread stacks.
+ */
+#elif (!defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
+  && !defined(CONFIGURE_TASK_STACK_DEALLOCATOR)) \
+  && defined(CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE)
+  #error "CONFIGURE_TASK_STACK_ALLOCATOR_FOR_IDLE can only be provided if both 
CONFIGURE_TASK_STACK_ALLOCATOR and CONFIGURE_TASK_STACK_DEALLOCATOR are provided"
  #endif


Is this really a hard error? The allocators are independent.

  
  #ifdef CONFIGURE_DIRTY_MEMORY

diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index e82c7abf11..a826581658 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -129,6 +129,9 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
  #define rtems_configuration_get_stack_free_hook() \
(_Stack_Allocator_free)
  
+#define rtems_configuration_get_stack_allocate_for_idle_hook() \

+  (_Stack_Allocator_allocate_for_idle)
+
   /**
* This macro assists in accessing the field which indicates whether
* RTEMS is responsible for zeroing the Executive Workspace.
diff --git a/cpukit/include/rtems/score/stack.h 
b/cpukit/include/rtems/score/stack.h
index df1df74867..6b20d4b977 100644
--- a/cpukit/include/rtems/score/stack.h
+++ b/cpukit/include/rtems/score/stack.h
@@ -23,6 +23,7 @@
  #define _RTEMS_SCORE_STACK_H
  
  #include 

+#include 


Please do not include this header in an header visible to the API.

  
  #ifdef __cplusplus

  extern "C" {
@@ -81,6 +82,23 @@ typedef void *( *Stack_Allocator_allocate )( size_t 
stack_size );
   */
  typedef void ( *Stack_Allocator_free )( void *addr );
  
+/**

+ * @brief Stack allocator allocate for idle handler.
+ *
+ * The allocate for idle handler is optional even when the user thread stack
+ * allocator and deallocator are configured.
+ *
+ * @param cpu Information for the CPU for the IDLE thread using this stack
+ * @param stack_size The size of the stack area to allocate in bytes.
+ *
+ * @retval NULL Not enough memory.
+ * @retval other Pointer to begin of stack area.
+ */
+typedef void *( *Stack_Allocator_allocate_for_idle )(
+  Per_CPU_Control *cpu,


Please use

uint32_t cpu_index

instead.


+  size_t   stack_size
+);
+
  /**
   * @brief The minimum stack size.
   *
@@ -124,6 +142,30 @@ extern const Stack_Allocator_allocate 
_Stack_Allocator_allocate;
  extern const Stack_Allocator_free _Stack_Allocator_free;
  
  /** @} */

+/**
+ * @brief The stack allocator allocate stack for idle thread handler.
+ *
+ * Application provided via .
+ */
+extern const Stack_Allocator_allocate_for_idle
+  _Stack_Allocator_allocate_for_idle;
+
+/**
+ * @brief Default stack allocator allocate for idle handler.
+ *
+ * The allocate for idle handler is optional even when the user thread stack
+ * allocator and deallocator are configured.
+ *
+ * @param cpu Information for the CPU for the IDLE thread using this stack
+ * @param stack_size The size of the stack area to allocate in bytes.
+ *
+ * @retval NULL Not enough memory.
+ * @retval other Pointer to begin of stack area.
+ */
+void *_Stack_Allocator_allocate_for_idle_default(
+  Per_CPU_Control *cpu,
+  size_t   stack_size
+);
  
  #ifdef __cplusplus

  }
diff --git a/cpukit/score/src/stackallocatorforidle.c 
b/cpukit/score/src/stackallocatorforidle.c
new file mode 100644
index 00..d33cd4dbf5
--- /dev/null
+++ b/cpukit/score/src/stackallocatorforidle.c
@@ -0,0 +1,36 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2021 OAR Corporation
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFI