[PATCH v3] c-user: CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE

2020-11-24 Thread Sebastian Huber
Document new configuration option
CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE.

Close #4181.
---
 c-user/config/classic-init-task.rst | 67 -
 1 file changed, 66 insertions(+), 1 deletion(-)

diff --git a/c-user/config/classic-init-task.rst 
b/c-user/config/classic-init-task.rst
index 4d3bf81..d848546 100644
--- a/c-user/config/classic-init-task.rst
+++ b/c-user/config/classic-init-task.rst
@@ -79,6 +79,65 @@ DESCRIPTION:
 NOTES:
 None.
 
+.. Generated from spec:/acfg/if/init-task-construct-storage-size
+
+.. index:: CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
+
+.. _CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE:
+
+CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
+--
+
+CONSTANT:
+``CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE``
+
+OPTION TYPE:
+This configuration option is an integer define.
+
+DEFAULT VALUE:
+The default value is 0.
+
+VALUE CONSTRAINTS:
+The value of this configuration option shall satisfy all of the following
+constraints:
+
+* It shall be greater than or equal to 
:ref:`CONFIGURE_MINIMUM_TASK_STACK_SIZE`.
+
+* It shall be defined using
+  :c:func:`RTEMS_TASK_STORAGE_SIZE`.
+
+DESCRIPTION:
+The value of this configuration option defines the task storage size of the
+Classic API initialization task.
+
+NOTES:
+If this configuration option is specified, then
+
+* a task storage area of the specified size is statically allocated by
+   for the Classic API initialization task,
+
+* the Classic API initialization task is constructed by
+  :c:func:`rtems_task_construct` instead of using
+  :c:func:`rtems_task_create`,
+
+* the maximum thread-local storage size defined by
+  :ref:`CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE` is used for the 
Classic API
+  initialization task,
+
+* the Classic API initialization task should be accounted for in
+  :ref:`CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE`, and
+
+* the task storage area used for the Classic API initialization task is not
+  reclaimed by the system, if the task is deleted.
+
+The
+
+* :ref:`CONFIGURE_INIT_TASK_STACK_SIZE` and
+
+* ``CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE``
+
+configuration options are mutually exclusive.
+
 .. Generated from spec:/acfg/if/init-task-entrypoint
 
 .. index:: CONFIGURE_INIT_TASK_ENTRY_POINT
@@ -229,7 +288,13 @@ DESCRIPTION:
 Classic API initialization task.
 
 NOTES:
-None.
+The
+
+* ``CONFIGURE_INIT_TASK_STACK_SIZE`` and
+
+* :ref:`CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE`
+
+configuration options are mutually exclusive.
 
 .. Generated from spec:/acfg/if/rtems-init-tasks-table
 
-- 
2.26.2

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


[PATCH v3 1/5] config: Clarify the use of pragmas

2020-11-24 Thread Sebastian Huber
---
 cpukit/include/rtems/confdefs/wkspace.h | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/cpukit/include/rtems/confdefs/wkspace.h 
b/cpukit/include/rtems/confdefs/wkspace.h
index 803d8bdc10..a08823fa17 100644
--- a/cpukit/include/rtems/confdefs/wkspace.h
+++ b/cpukit/include/rtems/confdefs/wkspace.h
@@ -137,7 +137,15 @@ const uintptr_t _Stack_Space_size = 
_CONFIGURE_STACK_SPACE_SIZE;
 
 #if defined(CONFIGURE_TASK_STACK_ALLOCATOR) \
   && defined(CONFIGURE_TASK_STACK_DEALLOCATOR)
-  /* Ignore potential warnings from the static assertions below */
+  /*
+   * Ignore the following warnings from g++ and clang in the static assertions
+   * below:
+   *
+   * warning: the address of 'f()' will never be NULL [-Waddress]
+   *
+   * warning: comparison of function 'f' not equal to a null pointer is always
+   * true [-Wtautological-pointer-compare]
+   */
   #pragma GCC diagnostic push
   #pragma GCC diagnostic ignored "-Waddress"
   #pragma GCC diagnostic ignored "-Wpragmas"
-- 
2.26.2

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


[PATCH v3 5/5] Use CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE

2020-11-24 Thread Sebastian Huber
Update #4181.
---
 testsuites/validation/ts-default.h | 109 +++--
 1 file changed, 40 insertions(+), 69 deletions(-)

diff --git a/testsuites/validation/ts-default.h 
b/testsuites/validation/ts-default.h
index 0f7db65a8e..0385587beb 100644
--- a/testsuites/validation/ts-default.h
+++ b/testsuites/validation/ts-default.h
@@ -35,12 +35,23 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
 #include 
 
+#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
+
+#define MAX_TASKS 32
+
+#define TASK_ATTRIBUTES RTEMS_FLOATING_POINT
+
+#define TASK_STORAGE_SIZE \
+  RTEMS_TASK_STORAGE_SIZE( \
+MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE, \
+TASK_ATTRIBUTES \
+  )
+
 static char buffer[ 512 ];
 
 static const T_action actions[] = {
@@ -70,12 +81,28 @@ static const T_config test_config = {
   .actions = actions
 };
 
-static void runner_task( rtems_task_argument arg )
+static rtems_chain_control free_task_storage =
+  RTEMS_CHAIN_INITIALIZER_EMPTY( free_task_storage );
+
+static union {
+  RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char
+storage[ TASK_STORAGE_SIZE ];
+  rtems_chain_node node;
+} task_storage[ MAX_TASKS ];
+
+static void Init( rtems_task_argument arg )
 {
   int exit_code;
 
   (void) arg;
 
+  rtems_chain_initialize(
+_task_storage,
+task_storage,
+RTEMS_ARRAY_SIZE( task_storage ),
+sizeof( task_storage[ 0 ] )
+  );
+
   rtems_test_begin( rtems_test_name, TEST_STATE );
   T_register();
   exit_code = T_main( _config );
@@ -87,40 +114,6 @@ static void runner_task( rtems_task_argument arg )
   rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, (uint32_t) exit_code );
 }
 
-#define MAX_TLS_SIZE RTEMS_ALIGN_UP( 64, RTEMS_TASK_STORAGE_ALIGNMENT )
-
-#define ATTRIBUTES RTEMS_FLOATING_POINT
-
-#define TASK_STORAGE_SIZE \
-  RTEMS_TASK_STORAGE_SIZE( \
-MAX_TLS_SIZE + RTEMS_MINIMUM_STACK_SIZE, \
-ATTRIBUTES \
-  )
-
-#define MAX_TASKS 32
-
-RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT )
-static char runner_task_storage[ TASK_STORAGE_SIZE ];
-
-static const rtems_task_config runner_task_config = {
-  .name = rtems_build_name( 'R', 'U', 'N', ' ' ),
-  .initial_priority = 1,
-  .storage_area = runner_task_storage,
-  .storage_size = sizeof( runner_task_storage ),
-  .maximum_thread_local_storage_size = MAX_TLS_SIZE,
-  .initial_modes = RTEMS_DEFAULT_MODES,
-  .attributes = ATTRIBUTES
-};
-
-static rtems_chain_control free_task_storage =
-  RTEMS_CHAIN_INITIALIZER_EMPTY( free_task_storage );
-
-static union {
-  RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char
-storage[ TASK_STORAGE_SIZE ];
-  rtems_chain_node node;
-} task_storage[ MAX_TASKS ];
-
 static void *task_stack_allocate( size_t size )
 {
   if ( size > sizeof( task_storage[ 0 ] ) ) {
@@ -138,35 +131,6 @@ static void task_stack_deallocate( void *stack )
   );
 }
 
-static void init_runner_task( void )
-{
-  rtems_id id;
-  rtems_status_code sc;
-
-  rtems_chain_initialize(
-_task_storage,
-task_storage,
-RTEMS_ARRAY_SIZE( task_storage ),
-sizeof( task_storage[ 0 ] )
-  );
-
-  sc = rtems_task_construct( _task_config,  );
-  if ( sc != RTEMS_SUCCESSFUL ) {
-rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 );
-  }
-
-  sc = rtems_task_start( id, runner_task, 0 );
-  if ( sc != RTEMS_SUCCESSFUL ) {
-rtems_fatal( RTEMS_FATAL_SOURCE_EXIT, 1 );
-  }
-}
-
-RTEMS_SYSINIT_ITEM(
-  init_runner_task,
-  RTEMS_SYSINIT_CLASSIC_USER_TASKS,
-  RTEMS_SYSINIT_ORDER_MIDDLE
-);
-
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 
 #define CONFIGURE_MAXIMUM_PROCESSORS 4
@@ -183,7 +147,8 @@ RTEMS_SYSINIT_ITEM(
 
 #define CONFIGURE_MAXIMUM_TASKS ( 1 + MAX_TASKS )
 
-#define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE 1
+#define CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE \
+  CONFIGURE_MAXIMUM_TASKS
 
 #define CONFIGURE_MAXIMUM_TIMERS 3
 
@@ -197,9 +162,7 @@ RTEMS_SYSINIT_ITEM(
 
 #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM
 
-#define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
-
-#define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
+#define CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE MAX_TLS_SIZE
 
 #define CONFIGURE_TASK_STACK_ALLOCATOR_AVOIDS_WORK_SPACE
 
@@ -207,6 +170,14 @@ RTEMS_SYSINIT_ITEM(
 
 #define CONFIGURE_TASK_STACK_DEALLOCATOR task_stack_deallocate
 
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+
+#define CONFIGURE_INIT_TASK_ATTRIBUTES TASK_ATTRIBUTES
+
+#define CONFIGURE_INIT_TASK_INITIAL_MODES RTEMS_DEFAULT_MODES
+
+#define CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE TASK_STORAGE_SIZE
+
 #if defined(RTEMS_SMP)
 
 #define CONFIGURE_SCHEDULER_EDF_SMP
-- 
2.26.2

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


[PATCH v3 2/5] Avoid INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL

2020-11-24 Thread Sebastian Huber
Replace a runtime check with a compile time assertion.  This makes the
INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL obsolete.

Update #4181.
---
 cpukit/include/rtems/confdefs/inittask.h| 21 
 cpukit/include/rtems/score/interr.h |  2 +-
 cpukit/rtems/src/taskinitusers.c|  8 +-
 spec/build/testsuites/sptests/grp.yml   |  2 --
 spec/build/testsuites/sptests/spfatal02.yml | 19 --
 testsuites/sptests/Makefile.am  |  9 ---
 testsuites/sptests/configure.ac |  1 -
 testsuites/sptests/spfatal02/init.c | 28 -
 testsuites/sptests/spfatal02/spfatal02.doc  | 20 ---
 testsuites/sptests/spfatal02/spfatal02.scn  |  3 ---
 10 files changed, 23 insertions(+), 90 deletions(-)
 delete mode 100644 spec/build/testsuites/sptests/spfatal02.yml
 delete mode 100644 testsuites/sptests/spfatal02/init.c
 delete mode 100644 testsuites/sptests/spfatal02/spfatal02.doc
 delete mode 100644 testsuites/sptests/spfatal02/spfatal02.scn

diff --git a/cpukit/include/rtems/confdefs/inittask.h 
b/cpukit/include/rtems/confdefs/inittask.h
index a91b9a5917..08eddc0334 100644
--- a/cpukit/include/rtems/confdefs/inittask.h
+++ b/cpukit/include/rtems/confdefs/inittask.h
@@ -100,6 +100,27 @@ extern "C" {
   #define CONFIGURE_INIT_TASK_ARGUMENTS 0
 #endif
 
+/*
+ * Ignore the following warnings from g++ and clang in the static assertion
+ * below:
+ *
+ * warning: the address of 'void Init()' will never be NULL [-Waddress]
+ *
+ * warning: comparison of function 'Init' not equal to a null pointer is always
+ * true [-Wtautological-pointer-compare]
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Waddress"
+#pragma GCC diagnostic ignored "-Wpragmas"
+#pragma GCC diagnostic ignored "-Wtautological-pointer-compare"
+
+RTEMS_STATIC_ASSERT(
+  CONFIGURE_INIT_TASK_ENTRY_POINT != NULL,
+  CONFIGURE_INIT_TASK_ENTRY_POINT_MUST_NOT_BE_NULL
+);
+
+#pragma GCC diagnostic pop
+
 const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
   CONFIGURE_INIT_TASK_NAME,
   CONFIGURE_INIT_TASK_STACK_SIZE,
diff --git a/cpukit/include/rtems/score/interr.h 
b/cpukit/include/rtems/score/interr.h
index 4b06199ae9..b1f1061c82 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -189,7 +189,7 @@ typedef enum {
   INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23,
   INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24,
   INTERNAL_ERROR_RESOURCE_IN_USE = 25,
-  INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26,
+  /* INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26, */
   /* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */
   INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28,
   INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29,
diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c
index 0b23d8bc86..f21c061670 100644
--- a/cpukit/rtems/src/taskinitusers.c
+++ b/cpukit/rtems/src/taskinitusers.c
@@ -29,7 +29,6 @@ void _RTEMS_tasks_Initialize_user_task( void )
   rtems_idid;
   rtems_status_code   return_value;
   const rtems_initialization_tasks_table *user_task;
-  rtems_task_entryentry_point;
 
   user_task = &_RTEMS_tasks_User_task_table;
   return_value = rtems_task_create(
@@ -44,14 +43,9 @@ void _RTEMS_tasks_Initialize_user_task( void )
 _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
   }
 
-  entry_point = user_task->entry_point;
-  if ( entry_point == NULL ) {
-_Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
-  }
-
   return_value = rtems_task_start(
 id,
-entry_point,
+user_task->entry_point,
 user_task->argument
   );
   _Assert( rtems_is_status_successful( return_value ) );
diff --git a/spec/build/testsuites/sptests/grp.yml 
b/spec/build/testsuites/sptests/grp.yml
index 1c865777a7..b1bf85942d 100644
--- a/spec/build/testsuites/sptests/grp.yml
+++ b/spec/build/testsuites/sptests/grp.yml
@@ -218,8 +218,6 @@ links:
   uid: spextensions01
 - role: build-dependency
   uid: spfatal01
-- role: build-dependency
-  uid: spfatal02
 - role: build-dependency
   uid: spfatal03
 - role: build-dependency
diff --git a/spec/build/testsuites/sptests/spfatal02.yml 
b/spec/build/testsuites/sptests/spfatal02.yml
deleted file mode 100644
index 19e329a027..00
--- a/spec/build/testsuites/sptests/spfatal02.yml
+++ /dev/null
@@ -1,19 +0,0 @@
-SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
-build-type: test-program
-cflags: []
-copyrights:
-- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
-cppflags: []
-cxxflags: []
-enabled-by: true
-features: c cprogram
-includes: []
-ldflags: []
-links: []
-source:
-- testsuites/sptests/spfatal02/init.c
-stlib: []
-target: testsuites/sptests/spfatal02.exe
-type: build
-use-after: []
-use-before: []
diff --git a/testsuites/sptests/Makefile.am 

[PATCH v3 4/5] config: Check CONFIGURE_INIT_TASK_STACK_SIZE

2020-11-24 Thread Sebastian Huber
---
 cpukit/include/rtems/confdefs/inittask.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/cpukit/include/rtems/confdefs/inittask.h 
b/cpukit/include/rtems/confdefs/inittask.h
index a1bf5d3b54..3f76bee223 100644
--- a/cpukit/include/rtems/confdefs/inittask.h
+++ b/cpukit/include/rtems/confdefs/inittask.h
@@ -152,6 +152,8 @@ RTEMS_SYSINIT_ITEM(
 
 #ifndef CONFIGURE_INIT_TASK_STACK_SIZE
   #define CONFIGURE_INIT_TASK_STACK_SIZE CONFIGURE_MINIMUM_TASK_STACK_SIZE
+#elif CONFIGURE_INIT_TASK_STACK_SIZE < CONFIGURE_MINIMUM_TASK_STACK_SIZE
+  #error "CONFIGURE_INIT_TASK_STACK_SIZE must be greater than or equal to 
CONFIGURE_MINIMUM_TASK_STACK_SIZE"
 #endif
 
 #if CONFIGURE_INIT_TASK_STACK_SIZE > CONFIGURE_MINIMUM_TASK_STACK_SIZE
-- 
2.26.2

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


[PATCH v3 3/5] config: CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE

2020-11-24 Thread Sebastian Huber
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.
---
 cpukit/Makefile.am  |  1 +
 cpukit/doxygen/appl-config.h| 63 
 cpukit/include/rtems/confdefs/inittask.h| 58 +++---
 cpukit/include/rtems/rtems/tasksdata.h  | 45 +-
 cpukit/include/rtems/score/interr.h |  3 +-
 cpukit/rtems/src/taskconstructuser.c| 65 +
 cpukit/sapi/src/interrtext.c|  3 +-
 spec/build/cpukit/librtemscpu.yml   |  1 +
 spec/build/testsuites/sptests/grp.yml   |  2 +
 spec/build/testsuites/sptests/spfatal34.yml | 19 ++
 testsuites/sptests/spfatal34/init.c | 52 +
 testsuites/sptests/spfatal34/spfatal34.doc  | 11 
 testsuites/sptests/spfatal34/spfatal34.scn  |  8 +++
 testsuites/sptests/spinternalerror02/init.c |  2 +-
 14 files changed, 318 insertions(+), 15 deletions(-)
 create mode 100644 cpukit/rtems/src/taskconstructuser.c
 create mode 100644 spec/build/testsuites/sptests/spfatal34.yml
 create mode 100644 testsuites/sptests/spfatal34/init.c
 create mode 100644 testsuites/sptests/spfatal34/spfatal34.doc
 create mode 100644 testsuites/sptests/spfatal34/spfatal34.scn

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 8c7f9c1ed4..b7435d7eb6 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -790,6 +790,7 @@ librtemscpu_a_SOURCES += rtems/src/statustoerrno.c
 librtemscpu_a_SOURCES += rtems/src/systemeventreceive.c
 librtemscpu_a_SOURCES += rtems/src/systemeventsend.c
 librtemscpu_a_SOURCES += rtems/src/taskconstruct.c
+librtemscpu_a_SOURCES += rtems/src/taskconstructuser.c
 librtemscpu_a_SOURCES += rtems/src/taskcreate.c
 librtemscpu_a_SOURCES += rtems/src/taskdelete.c
 librtemscpu_a_SOURCES += rtems/src/taskexit.c
diff --git a/cpukit/doxygen/appl-config.h b/cpukit/doxygen/appl-config.h
index 00230ac2d6..9883971b7a 100644
--- a/cpukit/doxygen/appl-config.h
+++ b/cpukit/doxygen/appl-config.h
@@ -1048,6 +1048,58 @@
  */
 #define CONFIGURE_INIT_TASK_ATTRIBUTES
 
+/* Generated from spec:/acfg/if/init-task-construct-storage-size */
+
+/**
+ * @brief This configuration option is an integer define.
+ *
+ * The value of this configuration option defines the task storage size of the
+ * Classic API initialization task.
+ *
+ * @par Default Value
+ * The default value is 0.
+ *
+ * @par Value Constraints
+ * @parblock
+ * The value of this configuration option shall satisfy all of the following
+ * constraints:
+ *
+ * * It shall be greater than or equal to #CONFIGURE_MINIMUM_TASK_STACK_SIZE.
+ *
+ * * It shall be defined using RTEMS_TASK_STORAGE_SIZE().
+ * @endparblock
+ *
+ * @par Notes
+ * @parblock
+ * If this configuration option is specified, then
+ *
+ * * a task storage area of the specified size is statically allocated by
+ *    for the Classic API initialization task,
+ *
+ * * the Classic API initialization task is constructed by
+ *   rtems_task_construct() instead of using rtems_task_create(),
+ *
+ * * the maximum thread-local storage size defined by
+ *   #CONFIGURE_MAXIMUM_THREAD_LOCAL_STORAGE_SIZE is used for the Classic API
+ *   initialization task,
+ *
+ * * the Classic API initialization task should be accounted for in
+ *   #CONFIGURE_MINIMUM_TASKS_WITH_USER_PROVIDED_STORAGE, and
+ *
+ * * the task storage area used for the Classic API initialization task is not
+ *   reclaimed by the system, if the task is deleted.
+ *
+ * The
+ *
+ * * #CONFIGURE_INIT_TASK_STACK_SIZE and
+ *
+ * * ``CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE``
+ *
+ * configuration options are mutually exclusive.
+ * @endparblock
+ */
+#define CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
+
 /* Generated from spec:/acfg/if/init-task-entrypoint */
 
 /**
@@ -1145,6 +1197,17 @@
  *   out by  does not overflow an integer of type https://en.cppreference.com/w/c/types/integer;>uintptr_t.
  * @endparblock
+ *
+ * @par Notes
+ * @parblock
+ * The
+ *
+ * * ``CONFIGURE_INIT_TASK_STACK_SIZE`` and
+ *
+ * * #CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
+ *
+ * configuration options are mutually exclusive.
+ * @endparblock
  */
 #define CONFIGURE_INIT_TASK_STACK_SIZE
 
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 
+#include 
 #include 
 #include 
 #include 
@@ -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 

[PATCH v3 0/5] Add CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE

2020-11-24 Thread Sebastian Huber
Currently, the Classic API initialization task is created with
rtems_task_create(). In order to better support applications which use
the new rtems_task_construct() directive add the
CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE configuration option which constructs
the Classic API initialization task with rtems_task_construct().

v2:

* Do not mention rtems_task_construct() in the
  CONFIGURE_INIT_TASK_STORAGE_SIZE documentation.

* Ensure that CONFIGURE_INIT_TASK_STACK_SIZE is greater than or equal to
  CONFIGURE_MINIMUM_TASK_STACK_SIZE.

v3:

* Clarify use of pragmas.

* Rename CONFIGURE_INIT_TASK_STORAGE_SIZE in
  CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE.

Sebastian Huber (5):
  config: Clarify the use of pragmas
  Avoid INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL
  config: CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE
  config: Check CONFIGURE_INIT_TASK_STACK_SIZE
  Use CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE

 cpukit/Makefile.am|   1 +
 cpukit/doxygen/appl-config.h  |  63 ++
 cpukit/include/rtems/confdefs/inittask.h  |  81 +++--
 cpukit/include/rtems/confdefs/wkspace.h   |  10 +-
 cpukit/include/rtems/rtems/tasksdata.h|  45 +++-
 cpukit/include/rtems/score/interr.h   |   5 +-
 cpukit/rtems/src/taskconstructuser.c  |  65 +++
 cpukit/rtems/src/taskinitusers.c  |   8 +-
 cpukit/sapi/src/interrtext.c  |   3 +-
 spec/build/cpukit/librtemscpu.yml |   1 +
 spec/build/testsuites/sptests/grp.yml |   4 +-
 .../sptests/{spfatal02.yml => spfatal34.yml}  |   4 +-
 testsuites/sptests/Makefile.am|   9 --
 testsuites/sptests/configure.ac   |   1 -
 testsuites/sptests/spfatal02/init.c   |  28 -
 testsuites/sptests/spfatal02/spfatal02.doc|  20 
 testsuites/sptests/spfatal02/spfatal02.scn|   3 -
 testsuites/sptests/spfatal34/init.c   |  52 +
 testsuites/sptests/spfatal34/spfatal34.doc|  11 ++
 testsuites/sptests/spfatal34/spfatal34.scn|   8 ++
 testsuites/sptests/spinternalerror02/init.c   |   2 +-
 testsuites/validation/ts-default.h| 109 +++---
 22 files changed, 375 insertions(+), 158 deletions(-)
 create mode 100644 cpukit/rtems/src/taskconstructuser.c
 rename spec/build/testsuites/sptests/{spfatal02.yml => spfatal34.yml} (80%)
 delete mode 100644 testsuites/sptests/spfatal02/init.c
 delete mode 100644 testsuites/sptests/spfatal02/spfatal02.doc
 delete mode 100644 testsuites/sptests/spfatal02/spfatal02.scn
 create mode 100644 testsuites/sptests/spfatal34/init.c
 create mode 100644 testsuites/sptests/spfatal34/spfatal34.doc
 create mode 100644 testsuites/sptests/spfatal34/spfatal34.scn

-- 
2.26.2

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


Re: [PATCH 2/3] score: Add CONFIGURE_INIT_TASK_STORAGE_SIZE

2020-11-24 Thread Chris Johns
On 24/11/20 10:45 pm, Sebastian Huber wrote:
> On 24/11/2020 12:40, Chris Johns wrote:
> 
>> On 24/11/20 6:35 pm, Sebastian Huber wrote:
>>> On 23/11/2020 21:23, Chris Johns wrote:
>>>
 On 23/11/20 7:46 pm, Sebastian Huber wrote:
> On 22/11/2020 23:22, Chris Johns wrote:
>> On 20/11/20 7:31 pm, Sebastian Huber wrote:
>>> In order to better support applications which use the new
>>> rtems_task_construct() directive add the
>>> CONFIGURE_INIT_TASK_STORAGE_SIZE configuration option.  If this option
>>> is specified, then the Classic API initialization task is constructed
>>> with rtems_task_construct().
>> The name CONFIGURE_INIT_TASK_STORAGE_SIZE does not reflect the role 
>> described
>> here and is a little ambiguous unless you know the implementation detail.
>>
>> CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE ?
> I am not sure. The storage size is a property of the task. How this
> property is
> achieved is a detail and may change.
 Is it a property of a specific instance (Init) of a specific type
 (construct) of
 task?

 You have stated:

    "If this option is specified, then the Classic API initialization task
     is constructed with rtems_task_construct()."

 This is how I am reading this sentence. Sure in time the task may not be
 constructed and that may change but the effect needs to be a "constructed" 
 task
 or you would need another variables.

 The key issue is the config option triggers a change in the type of Init 
 task
 and we should be as clear about that as we can.
>>> I changed the documentation of CONFIGURE_INIT_TASK_STORAGE_SIZE to not 
>>> mention
>>> rtems_task_construct(). This is just an implementation detail.
>> Does this mean all Init tasks will be statically constructed tasks?
> 
> No, if you specify CONFIGURE_INIT_TASK_STACK_SIZE (this is also the default),
> then rtems_task_create() is used. If you specify
> CONFIGURE_INIT_TASK_STORAGE_SIZE, then rtems_task_construct() is used.

They why not make this explicit and so helpful to users? I see no need for any
abstraction or a need to hide what this does. The name you have selected is
subtle and requires you know the implementation to understand what it means, ie
statically initialised tasks need static storage and so this makes Init static.
If both are defined you get an error and all the documentation says is they are
mutually exclusive. Again no indication the Init stack is now static.

Before this change if I delete `Init` I recovered that memory back to the
workspace. With this change deleting `Init` does _not_ recover the memory. This
is serious and important change that needs to be clearly explained to all users.

> For a user it should be no concern how the system creates the Classic API
> initialization task. What matters is that the task has the configured 
> properties.

I think it is important to users. I would like to know what effect to
initialisation these options have. For someone new to RTEMS starting RTEMS is
one of the first things they experience.

We cannot change the option CONFIGURE_INIT_TASK_STACK_SIZE but we can make the
task storage size more helpful with CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE.

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

Re: [PATCH v2 1/4] Avoid INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL

2020-11-24 Thread Joel Sherrill
On Tue, Nov 24, 2020 at 1:34 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Replace a runtime check with a compile time assertion.  This makes the
> INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL obsolete.
>
> Update #4181.
> ---
>  cpukit/include/rtems/confdefs/inittask.h| 13 ++
>  cpukit/include/rtems/score/interr.h |  2 +-
>  cpukit/rtems/src/taskinitusers.c|  8 +-
>  spec/build/testsuites/sptests/grp.yml   |  2 --
>  spec/build/testsuites/sptests/spfatal02.yml | 19 --
>  testsuites/sptests/Makefile.am  |  9 ---
>  testsuites/sptests/configure.ac |  1 -
>  testsuites/sptests/spfatal02/init.c | 28 -
>  testsuites/sptests/spfatal02/spfatal02.doc  | 20 ---
>  testsuites/sptests/spfatal02/spfatal02.scn  |  3 ---
>  10 files changed, 15 insertions(+), 90 deletions(-)
>  delete mode 100644 spec/build/testsuites/sptests/spfatal02.yml
>  delete mode 100644 testsuites/sptests/spfatal02/init.c
>  delete mode 100644 testsuites/sptests/spfatal02/spfatal02.doc
>  delete mode 100644 testsuites/sptests/spfatal02/spfatal02.scn
>
> diff --git a/cpukit/include/rtems/confdefs/inittask.h
> b/cpukit/include/rtems/confdefs/inittask.h
> index a91b9a5917..25453f031d 100644
> --- a/cpukit/include/rtems/confdefs/inittask.h
> +++ b/cpukit/include/rtems/confdefs/inittask.h
> @@ -100,6 +100,19 @@ extern "C" {
>#define CONFIGURE_INIT_TASK_ARGUMENTS 0
>  #endif
>
> +/* Ignore potential warnings from the static assertion below */
> +#pragma GCC diagnostic push
> +#pragma GCC diagnostic ignored "-Waddress"
> +#pragma GCC diagnostic ignored "-Wpragmas"
> +#pragma GCC diagnostic ignored "-Wtautological-pointer-compare"
>

This comment applies to every place pragmas are used like this.

If they are just potential, the pragmas are not needed. If this is really
disabling
a specific warning, tell the read what the warning is.

Is this correct code and gcc should not be generating a warning? That
should be associated with a gcc ticket for false warnings.

pragmas are to be used lightly and with documented justification.

I am not sure how this would be captured in coding guidelines but this is
an
exceptional thing to use and thus must come with exceptional comments.

+
> +RTEMS_STATIC_ASSERT(
> +  CONFIGURE_INIT_TASK_ENTRY_POINT != NULL,
> +  CONFIGURE_INIT_TASK_ENTRY_POINT_MUST_NOT_BE_NULL
> +);
> +
> +#pragma GCC diagnostic pop
> +
>  const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
>CONFIGURE_INIT_TASK_NAME,
>CONFIGURE_INIT_TASK_STACK_SIZE,
> diff --git a/cpukit/include/rtems/score/interr.h
> b/cpukit/include/rtems/score/interr.h
> index 4b06199ae9..b1f1061c82 100644
> --- a/cpukit/include/rtems/score/interr.h
> +++ b/cpukit/include/rtems/score/interr.h
> @@ -189,7 +189,7 @@ typedef enum {
>INTERNAL_ERROR_NO_MEMORY_FOR_HEAP = 23,
>INTERNAL_ERROR_CPU_ISR_INSTALL_VECTOR = 24,
>INTERNAL_ERROR_RESOURCE_IN_USE = 25,
> -  INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26,
> +  /* INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL = 26, */
>/* INTERNAL_ERROR_POSIX_INIT_THREAD_ENTRY_IS_NULL = 27, */
>INTERNAL_ERROR_THREAD_QUEUE_DEADLOCK = 28,
>INTERNAL_ERROR_THREAD_QUEUE_ENQUEUE_STICKY_FROM_BAD_STATE = 29,
> diff --git a/cpukit/rtems/src/taskinitusers.c
> b/cpukit/rtems/src/taskinitusers.c
> index 0b23d8bc86..f21c061670 100644
> --- a/cpukit/rtems/src/taskinitusers.c
> +++ b/cpukit/rtems/src/taskinitusers.c
> @@ -29,7 +29,6 @@ void _RTEMS_tasks_Initialize_user_task( void )
>rtems_idid;
>rtems_status_code   return_value;
>const rtems_initialization_tasks_table *user_task;
> -  rtems_task_entryentry_point;
>
>user_task = &_RTEMS_tasks_User_task_table;
>return_value = rtems_task_create(
> @@ -44,14 +43,9 @@ void _RTEMS_tasks_Initialize_user_task( void )
>  _Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED );
>}
>
> -  entry_point = user_task->entry_point;
> -  if ( entry_point == NULL ) {
> -_Internal_error( INTERNAL_ERROR_RTEMS_INIT_TASK_ENTRY_IS_NULL );
> -  }
> -
>return_value = rtems_task_start(
>  id,
> -entry_point,
> +user_task->entry_point,
>  user_task->argument
>);
>_Assert( rtems_is_status_successful( return_value ) );
> diff --git a/spec/build/testsuites/sptests/grp.yml
> b/spec/build/testsuites/sptests/grp.yml
> index 1c865777a7..b1bf85942d 100644
> --- a/spec/build/testsuites/sptests/grp.yml
> +++ b/spec/build/testsuites/sptests/grp.yml
> @@ -218,8 +218,6 @@ links:
>uid: spextensions01
>  - role: build-dependency
>uid: spfatal01
> -- role: build-dependency
> -  uid: spfatal02
>  - role: build-dependency
>uid: spfatal03
>  - role: build-dependency
> diff --git a/spec/build/testsuites/sptests/spfatal02.yml
> b/spec/build/testsuites/sptests/spfatal02.yml
> deleted file mode 100644
> index 

Re: [PATCH] spec/a53: Set conditionally failing test state

2020-11-24 Thread Sebastian Huber

On 24/11/2020 14:32, Kinsey Moore wrote:


+# tests that pass nominally, but fail under Qemu when the host is under
+# heavy load
+psx12: indeterminate
+spintrcritical03: indeterminate
+spintrcritical04: indeterminate
+spintrcritical05: indeterminate


The comment is useful, however, comments in a YAML file will get removed 
if someone processes the file and writes them back.


Independent of this, the patch is fine.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hub...@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] spec/a53: Set conditionally failing test state

2020-11-24 Thread Kinsey Moore
The spintrcritical03-05 and psx12 tests are known to fail on Qemu when
the host system is heavily loaded. A single run of Qemu per core
during a testsuite run tends to yield positive results, but any
additional load on a system will result in test failures.

This patch also applies the correct expected test state for intermittent
failures so that those tests will still build.
---
 spec/build/bsps/aarch64/a53/tsta53.yml | 36 --
 1 file changed, 22 insertions(+), 14 deletions(-)

diff --git a/spec/build/bsps/aarch64/a53/tsta53.yml 
b/spec/build/bsps/aarch64/a53/tsta53.yml
index a40cc8671c..9135fac7f4 100644
--- a/spec/build/bsps/aarch64/a53/tsta53.yml
+++ b/spec/build/bsps/aarch64/a53/tsta53.yml
@@ -12,20 +12,28 @@ actions:
 spmisc01: exclude
 
 # tests that are passing intermittently
-spcpucounter01: exclude
-rtmonuse: exclude
-sp37: exclude
-sp68: exclude
-sp04: exclude
-sp20: exclude
-sp69: exclude
-rtmonusxtimes01: exclude
-spedfsched02: exclude
-psxtimes01: exclude
-sprmsched01: exclude
-sptimecounter02: exclude
-sptimecounter04: exclude
-ttest02: exclude
+spcpucounter01: indeterminate
+rtmonuse: indeterminate
+sp37: indeterminate
+sp68: indeterminate
+sp04: indeterminate
+sp20: indeterminate
+sp69: indeterminate
+rtmonusxtimes01: indeterminate
+spedfsched02: indeterminate
+spedfsched04: indeterminate
+psxtimes01: indeterminate
+sprmsched01: indeterminate
+sptimecounter02: indeterminate
+sptimecounter04: indeterminate
+ttest02: indeterminate
+
+# tests that pass nominally, but fail under Qemu when the host is under
+# heavy load
+psx12: indeterminate
+spintrcritical03: indeterminate
+spintrcritical04: indeterminate
+spintrcritical05: indeterminate
 build-type: option
 copyrights:
 - Copyright (C) 2020 On-Line Applications Research (OAR)
-- 
2.20.1

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


[PATCH 4/4] score: Free old name in _Objects_Set_name()

2020-11-24 Thread Sebastian Huber
This is the behaviour document in the RTEMS Classic API Guide.
---
 cpukit/score/src/objectsetname.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c
index 4d85332711..4cb19bd360 100644
--- a/cpukit/score/src/objectsetname.c
+++ b/cpukit/score/src/objectsetname.c
@@ -40,6 +40,7 @@ Status_Control _Objects_Set_name(
   return STATUS_NO_MEMORY;
 }
 
+_Workspace_Free( the_object->name.name_p );
 the_object->name.name_p = dup;
   } else {
 char c[ 4 ];
-- 
2.26.2

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


[PATCH 2/4] score: Return a status in _Objects_Set_name()

2020-11-24 Thread Sebastian Huber
---
 cpukit/include/rtems/score/objectimpl.h | 14 --
 cpukit/score/src/objectsetname.c|  6 +++---
 testsuites/psxtests/psxobj01/init.c |  6 +++---
 3 files changed, 14 insertions(+), 12 deletions(-)

diff --git a/cpukit/include/rtems/score/objectimpl.h 
b/cpukit/include/rtems/score/objectimpl.h
index 32387594f2..a963396d65 100644
--- a/cpukit/include/rtems/score/objectimpl.h
+++ b/cpukit/include/rtems/score/objectimpl.h
@@ -25,6 +25,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -463,14 +464,15 @@ size_t _Objects_Name_to_string(
  * or up to the first four characters of the string based upon
  * whether this object class uses strings for names.
  *
- * @param information points to the object information structure
- * @param[out] the_object is the object to operate upon
- * @param name is a pointer to the name to use
+ * @param information points to the object information.
+ * @param[out] the_object is the object to operate upon.
+ * @param name is a pointer to the name to use.
  *
- * @retval true The operation succeeded.
- * @retval false The operation failed.
+ * @retval STATUS_SUCCESSFUL The operation succeeded.
+ *
+ * @retval STATUS_NO_MEMORY There was no memory available to duplicate the 
name.
  */
-bool _Objects_Set_name(
+Status_Control _Objects_Set_name(
   const Objects_Information *information,
   Objects_Control   *the_object,
   const char*name
diff --git a/cpukit/score/src/objectsetname.c b/cpukit/score/src/objectsetname.c
index 0808ab87af..4d85332711 100644
--- a/cpukit/score/src/objectsetname.c
+++ b/cpukit/score/src/objectsetname.c
@@ -24,7 +24,7 @@
 
 #include 
 
-bool _Objects_Set_name(
+Status_Control _Objects_Set_name(
   const Objects_Information *information,
   Objects_Control   *the_object,
   const char*name
@@ -37,7 +37,7 @@ bool _Objects_Set_name(
 length = strnlen( name, information->name_length );
 dup = _Workspace_String_duplicate( name, length );
 if ( dup == NULL ) {
-  return false;
+  return STATUS_NO_MEMORY;
 }
 
 the_object->name.name_p = dup;
@@ -59,5 +59,5 @@ bool _Objects_Set_name(
   _Objects_Build_name( c[ 0 ], c[ 1 ], c[ 2 ], c[ 3 ] );
   }
 
-  return true;
+  return STATUS_SUCCESSFUL;
 }
diff --git a/testsuites/psxtests/psxobj01/init.c 
b/testsuites/psxtests/psxobj01/init.c
index ba1e327ea5..fef749b3e9 100644
--- a/testsuites/psxtests/psxobj01/init.c
+++ b/testsuites/psxtests/psxobj01/init.c
@@ -37,7 +37,7 @@ static rtems_task Init(
   Objects_Control   *the_object;
   char   name[64];
   size_t name_len;
-  bool   bc;
+  Status_Control status;
 
   TEST_BEGIN();
 
@@ -70,12 +70,12 @@ static rtems_task Init(
   puts( "INIT - _Objects_Set_name fails - out of memory" );
   rtems_workspace_greedy_allocate( NULL, 0 );
 
-  bc = _Objects_Set_name(
+  status = _Objects_Set_name(
 _Information,
 &_Thread_Get_executing()->Object,
 name
   );
-  rtems_test_assert( bc == false );
+  rtems_test_assert( status == STATUS_NO_MEMORY );
 
   TEST_END();
   rtems_test_exit(0);
-- 
2.26.2

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


[PATCH 3/4] rtems: Fix rtems_object_set_name()

2020-11-24 Thread Sebastian Huber
Return RTEMS_NO_MEMORY if there is not memory available to duplicate the
name.
---
 cpukit/rtems/src/rtemsobjectsetname.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cpukit/rtems/src/rtemsobjectsetname.c 
b/cpukit/rtems/src/rtemsobjectsetname.c
index 9e1b3a4039..ca663c67cd 100644
--- a/cpukit/rtems/src/rtemsobjectsetname.c
+++ b/cpukit/rtems/src/rtemsobjectsetname.c
@@ -36,6 +36,7 @@ rtems_status_code rtems_object_set_name(
   Objects_Information *information;
   Objects_Control *the_object;
   Objects_Id   tmpId;
+  Status_Control   status;
 
   if ( !name )
 return RTEMS_INVALID_ADDRESS;
@@ -54,7 +55,7 @@ rtems_status_code rtems_object_set_name(
 return RTEMS_INVALID_ID;
   }
 
-  _Objects_Set_name( information, the_object, name );
+  status = _Objects_Set_name( information, the_object, name );
   _Objects_Allocator_unlock();
-  return RTEMS_SUCCESSFUL;
+  return STATUS_GET_CLASSIC( status );
 }
-- 
2.26.2

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


[PATCH 1/4] rtems: Generate

2020-11-24 Thread Sebastian Huber
Change license to BSD-2-Clause according to file histories and
documentation re-licensing agreement.

Update #3899.
Update #3993.
---
 cpukit/include/rtems/rtems/object.h | 715 +---
 1 file changed, 445 insertions(+), 270 deletions(-)

diff --git a/cpukit/include/rtems/rtems/object.h 
b/cpukit/include/rtems/rtems/object.h
index 8e8bfbf293..5adca09f2b 100644
--- a/cpukit/include/rtems/rtems/object.h
+++ b/cpukit/include/rtems/rtems/object.h
@@ -1,436 +1,611 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
- * @ingroup ClassicClassInfo
- *
- * This include file defines Classic API interfaces to Object Services.
+ * @brief This header file provides the Object Services API.
  */
 
-/* COPYRIGHT (c) 1989-2013.
- * On-Line Applications Research Corporation (OAR).
+/*
+ * Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+ * Copyright (C) 1988, 2009 On-Line Applications Research Corporation (OAR)
+ *
+ * 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.
+ */
+
+/*
+ * This file is part of the RTEMS quality process and was automatically
+ * generated.  If you find something that needs to be fixed or
+ * worded better please post a report or patch to an RTEMS mailing list
+ * or raise a bug report:
+ *
+ * https://docs.rtems.org/branches/master/user/support/bugs.html
  *
- * The license and distribution terms for this file may be
- * found in the file LICENSE in this distribution or at
- * http://www.rtems.org/license/LICENSE.
+ * For information on updating and regenerating please refer to:
+ *
+ * https://docs.rtems.org/branches/master/eng/req/howto.html
  */
 
+/* Generated from spec:/rtems/object/if/header */
+
 #ifndef _RTEMS_RTEMS_OBJECT_H
 #define _RTEMS_RTEMS_OBJECT_H
 
+#include 
+#include 
 #include 
-#include 
 #include 
 #include 
+#include 
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+/* Generated from spec:/rtems/object/if/group */
+
 /**
- *  @defgroup ClassicClassInfo Object Class Information
+ * @defgroup RTEMSAPIClassicObject Object Services
  *
- *  @ingroup RTEMSAPIClassic
+ * @ingroup RTEMSAPIClassic
  *
- *  This encapsulates functionality related to the Classic API Object
- *  Class Services.
+ * @brief RTEMS provides a collection of services to assist in the management
+ *   and usage of the objects created and utilized via other managers.  These
+ *   services assist in the manipulation of RTEMS objects independent of the
+ *   API used to create them.
  */
-/**@{*/
+
+/* Generated from spec:/rtems/object/if/api-class-information */
 
 /**
- *  This structure is used to return information to the application
- *  about the objects configured for a specific API/Class combination.
+ * @ingroup RTEMSAPIClassicObject
+ *
+ * @brief This structure is used to return information to the application about
+ *   the objects configured for a specific API/Class combination.
  */
 typedef struct {
-  /** This field is the minimum valid object Id for this class. */
-  rtems_id  minimum_id;
-  /** This field is the maximum valid object Id for this class. */
-  rtems_id  maximum_id;
-  /** This field is the number of object instances configured for this class. 
*/
-  uint32_t  maximum;
-  /** This field indicates if the class is configured for auto-extend. */
-  bool  auto_extend;
-  /** This field is the number of currently unallocated objects. */
-  uint32_t  unallocated;
+  /**
+   * @brief This member contains the minimum valid object identifier for this
+   *   class.
+   */
+  rtems_id minimum_id;
+
+  /**
+   * @brief This member contains the maximum valid object identifier for this
+   *   class.
+   */
+  rtems_id maximum_id;
+
+  /**
+   * @brief This member contains the maximum 

[PATCH 0/4] Generate

2020-11-24 Thread Sebastian Huber
Fix some issues in rtems_object_set_name().

Sebastian Huber (4):
  rtems: Generate 
  score: Return a status in _Objects_Set_name()
  rtems: Fix rtems_object_set_name()
  score: Free old name in _Objects_Set_name()

 cpukit/include/rtems/rtems/object.h | 715 +++-
 cpukit/include/rtems/score/objectimpl.h |  14 +-
 cpukit/rtems/src/rtemsobjectsetname.c   |   5 +-
 cpukit/score/src/objectsetname.c|   7 +-
 testsuites/psxtests/psxobj01/init.c |   6 +-
 5 files changed, 463 insertions(+), 284 deletions(-)

-- 
2.26.2

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


[PATCH v2] rtems: Delete rtems_object_id_api_maximum_class()

2020-11-24 Thread Sebastian Huber
This directive has no implementation.  It is documented in the RTEMS
Classic API Guide.

It was added by

commit 6c06288f6452da96fa630f1482aeaaba5d217531
Author: Joel Sherrill 
Date:   Tue Jan 29 21:52:21 2008 +

without an implementation.  The later change

commit fdc57ca4b6794dc17c7b7d94ae557da21e314d6a
Author: Joel Sherrill 
Date:   Mon Nov 23 14:53:04 2009 +

renamed the similar rtems_object_id_api_maximum_class() in
rtems_object_api_minimum_class().

The rtems_object_api_maximum_class() is documented and implemented.  It
can be assumed that the rtems_object_id_api_maximum_class() is a
fragement left over from development.
---
 cpukit/include/rtems/rtems/object.h | 17 -
 1 file changed, 17 deletions(-)

diff --git a/cpukit/include/rtems/rtems/object.h 
b/cpukit/include/rtems/rtems/object.h
index 8e8bfbf293..77c13f473f 100644
--- a/cpukit/include/rtems/rtems/object.h
+++ b/cpukit/include/rtems/rtems/object.h
@@ -285,23 +285,6 @@ int rtems_object_api_maximum_class(
   int api
 );
 
-
-/**
- * @brief Get Highest Valid Class Value
- *
- * This method returns the lowest valid value Class for the
- * specified @a api. Each API supports a different number
- * of object classes.
- *
- * @param[in] api is the API to obtain the maximum class of
- *
- * @retval This method returns the least valid value for
- * class number for the specified @a api.
- */
-int rtems_object_id_api_maximum_class(
-  int api
-);
-
 /**
  * @brief Get API Name
  *
-- 
2.26.2

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


[PATCH] c-user: Generate Object Services documentation

2020-11-24 Thread Sebastian Huber
The documentation is a consolidation of the comments in Doxygen markup
and the documentation sources in Sphinx markup.  The documentation was
transfered to interface specification items.  This header file was
generated from the items by a script.

Update #3993.
---
 c-user/object-services/directives.rst   | 978 ++--
 c-user/object-services/introduction.rst |  93 ++-
 2 files changed, 643 insertions(+), 428 deletions(-)

diff --git a/c-user/object-services/directives.rst 
b/c-user/object-services/directives.rst
index 87f0f5a..c760559 100644
--- a/c-user/object-services/directives.rst
+++ b/c-user/object-services/directives.rst
@@ -1,643 +1,805 @@
 .. SPDX-License-Identifier: CC-BY-SA-4.0
 
-.. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR)
+.. Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
+.. Copyright (C) 1988, 2009 On-Line Applications Research Corporation (OAR)
+
+.. This file is part of the RTEMS quality process and was automatically
+.. generated.  If you find something that needs to be fixed or
+.. worded better please post a report or patch to an RTEMS mailing list
+.. or raise a bug report:
+..
+.. https://docs.rtems.org/branches/master/user/support/bugs.html
+..
+.. For information on updating and regenerating please refer to:
+..
+.. https://docs.rtems.org/branches/master/eng/req/howto.html
+
+.. _ObjectServicesDirectives:
 
 Directives
 ==
 
+This section details the directives of the Object Services. A subsection is
+dedicated to each of this manager's directives and lists the calling sequence,
+parameters, description, return values, and notes of the directive.
+
+.. Generated from spec:/rtems/object/if/build-id
+
 .. raw:: latex
 
-   \clearpage
+\clearpage
+
+.. index:: rtems_build_id()
+
+.. _InterfaceRtemsBuildId:
+
+rtems_build_id()
+
+
+Builds the object identifier from the API, class, MPCI node, and index
+components.
+
+.. rubric:: CALLING SEQUENCE:
+
+.. code-block:: c
+
+#define rtems_build_id( _api, _class, _node, _index )
 
-.. index:: build object name
-.. index:: rtems_build_name
+.. rubric:: PARAMETERS:
 
-.. _rtems_build_name:
+``_api``
+This parameter is the API of the object identifier to build.
 
-BUILD_NAME - Build object name from characters
---
+``_class``
+This parameter is the class of the object identifier to build.
 
-CALLING SEQUENCE:
-.. code-block:: c
+``_node``
+This parameter is the MPCI node of the object identifier to build.
 
-rtems_name rtems_build_name(
-uint8_t c1,
-uint8_t c2,
-uint8_t c3,
-uint8_t c4
-);
+``_index``
+This parameter is the index of the object identifier to build.
 
-DIRECTIVE STATUS CODES:
-Returns a name constructed from the four characters.
+.. rubric:: RETURN VALUES:
 
-DESCRIPTION:
-This service takes the four characters provided as arguments and constructs
-a thirty-two bit object name with ``c1`` in the most significant byte and
-``c4`` in the least significant byte.
+Returns the object identifier built from the API, class, MPCI node, and index
+components.
 
-NOTES:
-This directive is strictly local and does not impact task scheduling.
+.. rubric:: NOTES:
+
+This directive is strictly local and does not impact task scheduling.
+
+.. Generated from spec:/rtems/object/if/build-name
 
 .. raw:: latex
 
-   \clearpage
+\clearpage
 
-.. index:: get name from id
-.. index:: obtain name from id
-.. index:: rtems_object_get_classic_name
+.. index:: rtems_build_name()
 
-.. _rtems_object_get_classic_name:
+.. _InterfaceRtemsBuildName:
 
-OBJECT_GET_CLASSIC_NAME - Lookup name from id
--
+rtems_build_name()
+--
 
-CALLING SEQUENCE:
-.. code-block:: c
+Builds the object name composed of the four characters.
 
-rtems_status_code rtems_object_get_classic_name(
-rtems_id  id,
-rtems_name   *name
-);
+.. rubric:: CALLING SEQUENCE:
 
-DIRECTIVE STATUS CODES:
-.. list-table::
- :class: rtems-table
+.. code-block:: c
 
- * - ``RTEMS_SUCCESSFUL``
-   - name looked up successfully
- * - ``RTEMS_INVALID_ADDRESS``
-   - invalid name pointer
- * - ``RTEMS_INVALID_ID``
-   - invalid object id
+#define rtems_build_name( _c1, _c2, _c3, _c4 )
 
-DESCRIPTION:
-This service looks up the name for the object ``id`` specified and, if
-found, places the result in ``*name``.
+.. rubric:: PARAMETERS:
 
-NOTES:
-This directive is strictly local and does not impact task scheduling.
+``_c1``
+This parameter is the first character of the name.
 
-.. raw:: latex
+``_c2``
+This parameter is the second character of the name.
 
-   \clearpage
+``_c3``
+This parameter is the third character of the name.
 
-.. index:: get object name as string
-.. index:: obtain 

Re: [PATCH 2/3] score: Add CONFIGURE_INIT_TASK_STORAGE_SIZE

2020-11-24 Thread Sebastian Huber

On 24/11/2020 12:40, Chris Johns wrote:


On 24/11/20 6:35 pm, Sebastian Huber wrote:

On 23/11/2020 21:23, Chris Johns wrote:


On 23/11/20 7:46 pm, Sebastian Huber wrote:

On 22/11/2020 23:22, Chris Johns wrote:

On 20/11/20 7:31 pm, Sebastian Huber wrote:

In order to better support applications which use the new
rtems_task_construct() directive add the
CONFIGURE_INIT_TASK_STORAGE_SIZE configuration option.  If this option
is specified, then the Classic API initialization task is constructed
with rtems_task_construct().

The name CONFIGURE_INIT_TASK_STORAGE_SIZE does not reflect the role described
here and is a little ambiguous unless you know the implementation detail.

CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE ?

I am not sure. The storage size is a property of the task. How this property is
achieved is a detail and may change.

Is it a property of a specific instance (Init) of a specific type (construct) of
task?

You have stated:

   "If this option is specified, then the Classic API initialization task
    is constructed with rtems_task_construct()."

This is how I am reading this sentence. Sure in time the task may not be
constructed and that may change but the effect needs to be a "constructed" task
or you would need another variables.

The key issue is the config option triggers a change in the type of Init task
and we should be as clear about that as we can.

I changed the documentation of CONFIGURE_INIT_TASK_STORAGE_SIZE to not mention
rtems_task_construct(). This is just an implementation detail.

Does this mean all Init tasks will be statically constructed tasks?


No, if you specify CONFIGURE_INIT_TASK_STACK_SIZE (this is also the 
default), then rtems_task_create() is used. If you specify 
CONFIGURE_INIT_TASK_STORAGE_SIZE, then rtems_task_construct() is used.


For a user it should be no concern how the system creates the Classic 
API initialization task. What matters is that the task has the 
configured properties.


--
embedded brains GmbH
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
PGP: Public key available on request.

embedded brains GmbH
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 v2 0/4] Add CONFIGURE_INIT_TASK_STORAGE_SIZE

2020-11-24 Thread Sebastian Huber

On 24/11/2020 12:35, Chris Johns wrote:


* Ensure that CONFIGURE_INIT_TASK_STACK_SIZE is greater than or equal to
   CONFIGURE_INIT_TASK_STACK_SIZE.

I do not understand this sentence.


Sorry for the typo:

Ensure that CONFIGURE_INIT_TASK_STACK_SIZE is greater than or equal to 
CONFIGURE_MINIMUM_TASK_STACK_SIZE.

--
embedded brains GmbH
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
PGP: Public key available on request.

embedded brains GmbH
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 2/3] score: Add CONFIGURE_INIT_TASK_STORAGE_SIZE

2020-11-24 Thread Chris Johns
On 24/11/20 6:35 pm, Sebastian Huber wrote:
> On 23/11/2020 21:23, Chris Johns wrote:
> 
>> On 23/11/20 7:46 pm, Sebastian Huber wrote:
>>> On 22/11/2020 23:22, Chris Johns wrote:
 On 20/11/20 7:31 pm, Sebastian Huber wrote:
> In order to better support applications which use the new
> rtems_task_construct() directive add the
> CONFIGURE_INIT_TASK_STORAGE_SIZE configuration option.  If this option
> is specified, then the Classic API initialization task is constructed
> with rtems_task_construct().
 The name CONFIGURE_INIT_TASK_STORAGE_SIZE does not reflect the role 
 described
 here and is a little ambiguous unless you know the implementation detail.

 CONFIGURE_INIT_TASK_CONSTRUCT_STORAGE_SIZE ?
>>> I am not sure. The storage size is a property of the task. How this 
>>> property is
>>> achieved is a detail and may change.
>> Is it a property of a specific instance (Init) of a specific type 
>> (construct) of
>> task?
>>
>> You have stated:
>>
>>   "If this option is specified, then the Classic API initialization task
>>    is constructed with rtems_task_construct()."
>>
>> This is how I am reading this sentence. Sure in time the task may not be
>> constructed and that may change but the effect needs to be a "constructed" 
>> task
>> or you would need another variables.
>>
>> The key issue is the config option triggers a change in the type of Init task
>> and we should be as clear about that as we can.
> 
> I changed the documentation of CONFIGURE_INIT_TASK_STORAGE_SIZE to not mention
> rtems_task_construct(). This is just an implementation detail.

Does this mean all Init tasks will be statically constructed tasks?

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

Re: [PATCH v2 0/4] Add CONFIGURE_INIT_TASK_STORAGE_SIZE

2020-11-24 Thread Chris Johns
On 24/11/20 6:33 pm, Sebastian Huber wrote:
> Currently, the Classic API initialization task is created with
> rtems_task_create(). In order to better support applications which use
> the new rtems_task_construct() directive add the
> CONFIGURE_INIT_TASK_STORAGE_SIZE configuration option which constructs
> the Classic API initialization task with rtems_task_construct().
> 
> v2:
> 
> * Do not mention rtems_task_construct() in the
>   CONFIGURE_INIT_TASK_STORAGE_SIZE documentation.

I am not sure this is a solution. What happens is now hidden.

> * Ensure that CONFIGURE_INIT_TASK_STACK_SIZE is greater than or equal to
>   CONFIGURE_INIT_TASK_STACK_SIZE.

I do not understand this sentence.

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


[PATCH v1 1/1] bsps/arm: Fix MMU small pages support

2020-11-24 Thread Jan Sommer
- For small tables only round to the next 4kiB instead of 1MiB
---
 bsps/arm/include/bsp/arm-cp15-start.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/arm/include/bsp/arm-cp15-start.h 
b/bsps/arm/include/bsp/arm-cp15-start.h
index c4686fbbd4..86c4f8afcb 100644
--- a/bsps/arm/include/bsp/arm-cp15-start.h
+++ b/bsps/arm/include/bsp/arm-cp15-start.h
@@ -119,7 +119,7 @@ arm_cp15_start_set_translation_table_entries(
 
 pt = [ARM_MMU_TRANSLATION_TABLE_ENTRY_COUNT];
 i = ARM_MMU_SMALL_PAGE_GET_INDEX(config->begin);
-iend = 
ARM_MMU_SMALL_PAGE_GET_INDEX(ARM_MMU_SECT_MVA_ALIGN_UP(config->end));
+iend = 
ARM_MMU_SMALL_PAGE_GET_INDEX(ARM_MMU_SMALL_PAGE_MVA_ALIGN_UP(config->end));
 index_mask = (1U << (32 - ARM_MMU_SMALL_PAGE_BASE_SHIFT)) - 1U;
 flags = ARM_MMU_SECT_FLAGS_TO_SMALL_PAGE(config->flags);
 
-- 
2.17.1

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


[PATCH v1 0/1] bsps/arm: Fix MMU small pages support

2020-11-24 Thread Jan Sommer
Following the discussion on the mailinglist
(https://lists.rtems.org/pipermail/users/2020-November/067978.html) here
is a patch which rounds the address range of a section only to next
4kiB boundary for the ARM MMU if small pages are enabled.

This should close the following tickets:
- https://devel.rtems.org/ticket/4184
- https://devel.rtems.org/ticket/4185

Best regards,

 Jan

Jan Sommer (1):
  bsps/arm: Fix MMU small pages support

 bsps/arm/include/bsp/arm-cp15-start.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.17.1

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