summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems
diff options
context:
space:
mode:
authorSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-19 16:07:04 +0100
committerSebastian Huber <sebastian.huber@embedded-brains.de>2020-11-26 11:10:22 +0100
commit657e30c135f22c4448cfd13f8113b23e72776dad (patch)
tree3673a8df391a0fb170d4cbffb8e1d05821771aa2 /cpukit/include/rtems
parentAvoid INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL (diff)
downloadrtems-657e30c135f22c4448cfd13f8113b23e72776dad.tar.bz2
config: CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
In order to better support applications which use the new rtems_task_construct() directive add the CONFIGURE_INIT_TASK_CONSTURCT_STORAGE_SIZE configuration option. If this option is specified, then the Classic API initialization task is constructed with rtems_task_construct(). Update #4181.
Diffstat (limited to 'cpukit/include/rtems')
-rw-r--r--cpukit/include/rtems/confdefs/inittask.h58
-rw-r--r--cpukit/include/rtems/rtems/tasksdata.h45
-rw-r--r--cpukit/include/rtems/score/interr.h3
3 files changed, 93 insertions, 13 deletions
diff --git a/cpukit/include/rtems/confdefs/inittask.h b/cpukit/include/rtems/confdefs/inittask.h
index 08eddc0334..a1bf5d3b54 100644
--- a/cpukit/include/rtems/confdefs/inittask.h
+++ b/cpukit/include/rtems/confdefs/inittask.h
@@ -48,6 +48,7 @@
#ifdef CONFIGURE_RTEMS_INIT_TASKS_TABLE
#include <rtems/confdefs/percpu.h>
+#include <rtems/confdefs/threads.h>
#include <rtems/rtems/object.h>
#include <rtems/rtems/tasksdata.h>
#include <rtems/sysinit.h>
@@ -72,15 +73,6 @@
#define CONFIGURE_INIT_TASK_PRIORITY 1
#endif
-#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
- #define CONFIGURE_INIT_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
-#endif
-
-#if CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE
- #define _CONFIGURE_INIT_TASK_STACK_EXTRA \
- ( CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE )
-#endif
-
#ifdef __cplusplus
extern "C" {
#endif
@@ -121,6 +113,52 @@ RTEMS_STATIC_ASSERT(
#pragma GCC diagnostic pop
+#ifdef CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
+
+#ifdef CONFIGURE_INIT_TASK_STACK_SIZE
+ #error "CONFIGURE_INIT_TASK_STACK_SIZE and CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE are mutually exclusive"
+#endif
+
+RTEMS_STATIC_ASSERT(
+ CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE >= CONFIGURE_MINIMUM_TASK_STACK_SIZE,
+ CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE_IS_TOO_SMALL
+);
+
+RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
+static char _RTEMS_tasks_User_task_storage[ CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE ];
+
+const RTEMS_tasks_User_task_config _RTEMS_tasks_User_task_config = {
+ {
+ CONFIGURE_INIT_TASK_NAME,
+ CONFIGURE_INIT_TASK_PRIORITY,
+ _RTEMS_tasks_User_task_storage,
+ sizeof( _RTEMS_tasks_User_task_storage ),
+ CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE,
+ NULL,
+ CONFIGURE_INIT_TASK_INITIAL_MODES,
+ CONFIGURE_INIT_TASK_ATTRIBUTES,
+ },
+ CONFIGURE_INIT_TASK_ENTRY_POINT,
+ CONFIGURE_INIT_TASK_ARGUMENTS
+};
+
+RTEMS_SYSINIT_ITEM(
+ _RTEMS_tasks_Construct_user_task,
+ RTEMS_SYSINIT_CLASSIC_USER_TASKS,
+ RTEMS_SYSINIT_ORDER_MIDDLE
+);
+
+#else /* CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE */
+
+#ifndef CONFIGURE_INIT_TASK_STACK_SIZE
+ #define CONFIGURE_INIT_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
+#endif
+
+#if CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE
+ #define _CONFIGURE_INIT_TASK_STACK_EXTRA \
+ ( CONFIGURE_INIT_TASK_STACK_SIZE - CONFIGURE_MINIMUM_TASK_STACK_SIZE )
+#endif
+
const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
CONFIGURE_INIT_TASK_NAME,
CONFIGURE_INIT_TASK_STACK_SIZE,
@@ -137,6 +175,8 @@ RTEMS_SYSINIT_ITEM(
RTEMS_SYSINIT_ORDER_MIDDLE
);
+#endif /* CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE */
+
#ifdef __cplusplus
}
#endif
diff --git a/cpukit/include/rtems/rtems/tasksdata.h b/cpukit/include/rtems/rtems/tasksdata.h
index 55090f71b0..4339bfb6e0 100644
--- a/cpukit/include/rtems/rtems/tasksdata.h
+++ b/cpukit/include/rtems/rtems/tasksdata.h
@@ -61,10 +61,49 @@ typedef struct {
extern const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table;
/**
- * @brief System initialization handler to create and start the first user
- * task.
+ * @brief Creates and starts the Classic API initialization task using
+ * rtems_task_create() and the configuration provided by
+ * ::_RTEMS_tasks_User_task_table.
*/
-extern void _RTEMS_tasks_Initialize_user_task( void );
+void _RTEMS_tasks_Initialize_user_task( void );
+
+/**
+ * @brief This structure provides the configuration to construct and start the
+ * Classic API initialization task.
+ */
+typedef struct {
+ /**
+ * @brief This member provides the task configuration for
+ * rtems_task_construct().
+ */
+ rtems_task_config config;
+
+ /**
+ * @brief This member provides the task entry point for rtems_task_start().
+ */
+ rtems_task_entry entry_point;
+
+ /**
+ * @brief This member provides the task argument for rtems_task_start().
+ */
+ rtems_task_argument argument;
+} RTEMS_tasks_User_task_config;
+
+/**
+ * @brief This structure provides the configuration of the Classic API
+ * initialization task.
+ *
+ * It is used by _RTEMS_tasks_Construct_user_task() and initialized via
+ * <rtems/confdefs.h>, see also #CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE.
+ */
+extern const RTEMS_tasks_User_task_config _RTEMS_tasks_User_task_config;
+
+/**
+ * @brief Constructs and starts the Classic API initialization task using
+ * rtems_task_construct() and the configuration provided by
+ * ::_RTEMS_tasks_User_task_config.
+ */
+void _RTEMS_tasks_Construct_user_task( void );
/**
* The following instantiates the information control block used to
diff --git a/cpukit/include/rtems/score/interr.h b/cpukit/include/rtems/score/interr.h
index b1f1061c82..01ece772b8 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -204,7 +204,8 @@ typedef enum {
INTERNAL_ERROR_ILLEGAL_USE_OF_FLOATING_POINT_UNIT = 38,
INTERNAL_ERROR_ARC4RANDOM_GETENTROPY_FAIL = 39,
INTERNAL_ERROR_NO_MEMORY_FOR_PER_CPU_DATA = 40,
- INTERNAL_ERROR_TOO_LARGE_TLS_SIZE = 41
+ INTERNAL_ERROR_TOO_LARGE_TLS_SIZE = 41,
+ INTERNAL_ERROR_RTEMS_INIT_TASK_CONSTRUCT_FAILED = 42,
} Internal_errors_Core_list;
typedef CPU_Uint32ptr Internal_errors_t;