[PATCH 4/4] config: Modify CONFIGURE_INTERRUPT_STACK_SIZE

Sebastian Huber sebastian.huber at embedded-brains.de
Wed Oct 24 06:10:07 UTC 2018


Use CPU_STACK_MINIMUM_SIZE instead of CONFIGURE_MINIMUM_TASK_STACK_SIZE
to set the default value.

Close #3480.
---
 cpukit/include/rtems/confdefs.h      |  2 +-
 testsuites/sptests/spconfig01/init.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 2e183c78d9..8323674f12 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1166,7 +1166,7 @@ extern rtems_initialization_tasks_table Initialization_tasks[];
   #ifdef BSP_INTERRUPT_STACK_SIZE
     #define CONFIGURE_INTERRUPT_STACK_SIZE BSP_INTERRUPT_STACK_SIZE
   #else
-    #define CONFIGURE_INTERRUPT_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
+    #define CONFIGURE_INTERRUPT_STACK_SIZE CPU_STACK_MINIMUM_SIZE
   #endif
 #endif
 
diff --git a/testsuites/sptests/spconfig01/init.c b/testsuites/sptests/spconfig01/init.c
index 6979d2eafd..7b13d69122 100644
--- a/testsuites/sptests/spconfig01/init.c
+++ b/testsuites/sptests/spconfig01/init.c
@@ -12,12 +12,15 @@
  * http://www.rtems.com/license/LICENSE.
  */
 
+#define _GNU_SOURCE
+
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
 #include <sys/stat.h>
 #include <errno.h>
+#include <pthread.h>
 
 #include <bsp.h>
 
@@ -83,13 +86,40 @@ static rtems_status_code app_extra_drivers_init(
   return RTEMS_SUCCESSFUL;
 }
 
+static void test_stack_config(void)
+{
+  pthread_attr_t attr;
+  size_t stack_size;
+  int eno;
+
+  rtems_test_assert(
+    rtems_configuration_get_interrupt_stack_size() == CPU_STACK_MINIMUM_SIZE
+  );
+
+  eno = pthread_getattr_np(pthread_self(), &attr);
+  rtems_test_assert(eno == 0);
+
+  eno = pthread_attr_getstacksize(&attr, &stack_size);
+  rtems_test_assert(eno == 0);
+  rtems_test_assert(stack_size == 2 * CPU_STACK_MINIMUM_SIZE);
+
+  eno = pthread_attr_destroy(&attr);
+  rtems_test_assert(eno == 0);
+}
+
 static void Init(rtems_task_argument arg)
 {
   checkpoint(3);
+  test_stack_config();
   TEST_END();
   rtems_test_exit(0);
 }
 
+#ifdef BSP_INTERRUPT_STACK_SIZE
+#warning "BSP_INTERRUPT_STACK_SIZE will be #undef for this test"
+#undef BSP_INTERRUPT_STACK_SIZE
+#endif
+
 #ifdef CONFIGURE_BSP_PREREQUISITE_DRIVERS
 #warning "CONFIGURE_BSP_PREREQUISITE_DRIVERS will be #undef for this test"
 #undef CONFIGURE_BSP_PREREQUISITE_DRIVERS
@@ -110,6 +140,8 @@ static void Init(rtems_task_argument arg)
 
 #define CONFIGURE_MAXIMUM_TASKS 1
 
+#define CONFIGURE_MINIMUM_TASK_STACK_SIZE (2 * CPU_STACK_MINIMUM_SIZE)
+
 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
 
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
-- 
2.16.4




More information about the devel mailing list