[PATCH] c-user: Link task entry and global construction
--- c-user/glossary.rst | 13 + c-user/initialization/operations.rst | 25 +++-- c-user/rtems_data_types.rst | 2 +- c-user/task/directives.rst | 6 +++--- 4 files changed, 32 insertions(+), 14 deletions(-) diff --git a/c-user/glossary.rst b/c-user/glossary.rst index 0962f44..8d86691 100644 --- a/c-user/glossary.rst +++ b/c-user/glossary.rst @@ -476,6 +476,10 @@ Glossary An object that has been created with the GLOBAL attribute and exported to all nodes in a multiprocessor system. +global construction +In the global construction, the C++ global constructors and constructor +functions are invoked. See :ref:`GlobalConstruction`. + GNAT *GNAT* is the :term:`GNU` compiler for Ada, integrated into the :term:`GCC`. @@ -1379,6 +1383,15 @@ Glossary A data structure associated with each task used by RTEMS to manage that task. +task entry +The task entry is invoked to execute the task's job. Before the task entry +is invoked, the thread begin :term:`user extensions` run in the context of +the task. After the return of the task entry, the thread exitted user +extensions run in the context of the task. The first user initialization +task performs the :term:`global construction` after running the thread begin +extensions and before the task entry is invoked. See also +:ref:`InterfaceRtemsTaskStart`. + task migration Task migration happens in case a task stops execution on one processor and resumes execution on another processor. diff --git a/c-user/initialization/operations.rst b/c-user/initialization/operations.rst index db5c94b..e7d310c 100644 --- a/c-user/initialization/operations.rst +++ b/c-user/initialization/operations.rst @@ -285,19 +285,24 @@ Many of RTEMS actions during initialization are based upon the contents of the Configuration Table. For more information regarding the format and contents of this table, please refer to the chapter :ref:`Configuring a System`. +.. index:: global construction + +.. _GlobalConstruction: + Global Construction --- -The global construction is carried out by the first Classic API initialization -task (first is defined by index zero in the Classic API initialization task -configuration table). If no Classic API initialization task exists, then it is -carried out by the first POSIX API initialization thread. If no initialization -task or thread exists, then no global construction is performed, see for -example :ref:`Specify Idle Task Performs Application Initialization`. The -Classic API task or POSIX API thread which carries out global construction is -called the main thread. - -Global construction runs before the entry function of the main thread. The +The :term:`global construction` is carried out by the Classic API +initialization task. If no Classic API initialization task exists, then it is +carried out by the POSIX API initialization thread. If no initialization task +or thread exists, then no global construction is performed. The Classic API +task or POSIX API thread which carries out global construction is called the +main thread. For configuration options related to initialization tasks, see +:ref:`CONFIGURE_RTEMS_INIT_TASKS_TABLE`, +:ref:`CONFIGURE_POSIX_INIT_THREAD_TABLE`, and +:ref:`CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION`. + +Global construction runs before the :term:`task entry` of the main thread. The configuration of the main thread must take the global construction into account. In particular, the main thread stack size, priority, attributes and initial modes must be set accordingly. Thread-local objects and POSIX key diff --git a/c-user/rtems_data_types.rst b/c-user/rtems_data_types.rst index a311509..8e4274b 100644 --- a/c-user/rtems_data_types.rst +++ b/c-user/rtems_data_types.rst @@ -1523,7 +1523,7 @@ extension set. rtems_task_entry -This type defines the entry point of an RTEMS task. +This type defines the :term:`task entry` point of an RTEMS task. .. Generated from spec:/rtems/userext/if/task-exitted diff --git a/c-user/task/directives.rst b/c-user/task/directives.rst index f4b65f5..d976905 100644 --- a/c-user/task/directives.rst +++ b/c-user/task/directives.rst @@ -624,9 +624,9 @@ Starts the task. .. rubric:: DESCRIPTION: This directive readies the task, specified by ``id``, for execution based on -the priority and execution mode specified when the task was created. The entry -point of the task is given in ``entry_point``. The task's entry point argument -is contained in ``argument``. +the priority and execution mode specified when the task was created. The +:term:`task entry` point of the task is given in ``entry_point``. The task's +entry point argument is contained in ``argument``. .. rubric:: RETURN VALUES: -- 2.35.3 ___
[PATCH] validation: Task entry return for idle threads
Update #3716. --- testsuites/validation/tc-userext.c | 72 +- testsuites/validation/ts-userext.c | 2 + 2 files changed, 73 insertions(+), 1 deletion(-) diff --git a/testsuites/validation/tc-userext.c b/testsuites/validation/tc-userext.c index bb5e064974..192be30669 100644 --- a/testsuites/validation/tc-userext.c +++ b/testsuites/validation/tc-userext.c @@ -159,6 +159,18 @@ * - Check that the thread terminate extension of the extension set deleted * before its turn in the invocation was not invoked. * + * - Create five dynamic extensions. Let an idle thread return from its entry. + * Delete three dynamic extension during the thread exitted invocation. + * Clean up the used resources. + * + * - Check that the thread exitted extensions were invoked in the right + * order. + * + * - Check that the other extensions were not invoked. + * + * - Check that the thread exitted extension of the extension set deleted + * before its turn in the invocation was not invoked. + * * @{ */ @@ -293,7 +305,13 @@ static void Extension( if ( index == 6 && ( kind == THREAD_EXITTED || kind == THREAD_RESTART ) ) { StopTestCase(); -rtems_task_exit(); + +if ( GetExecuting()->is_idle ) { + SetSelfPriority( RTEMS_MAXIMUM_PRIORITY ); + _CPU_Thread_Idle_body( 0 ); +} else { + rtems_task_exit(); +} } if ( index == 0 && kind == THREAD_TERMINATE ) { @@ -516,6 +534,18 @@ static void TerminateWorker( rtems_task_argument arg ) rtems_task_exit(); } +void *IdleBody( uintptr_t arg ) +{ + rtems_event_set events; + + do { +events = PollAnyEvents(); + } while ( events == 0 ); + + (void) StartTestCase( THREAD_EXITTED ); + return (void *) arg; +} + static void RtemsUserextValUserext_Setup( void *ctx ) { SetSelfPriority( PRIO_NORMAL ); @@ -831,6 +861,45 @@ static void RtemsUserextValUserext_Action_6( void ) CheckDeletedNotInvoked( THREAD_TERMINATE ); } +/** + * @brief Create five dynamic extensions. Let an idle thread return from its + * entry. Delete three dynamic extension during the thread exitted + * invocation. Clean up the used resources. + */ +static void RtemsUserextValUserext_Action_7( void ) +{ + rtems_tcb *thread; + rtems_id id; + + /* ID of idle thread of processor 0 */ + id = 0x09010001; + thread = GetThread( id ); + SendEvents( id, RTEMS_EVENT_0 ); + SetPriority( id, PRIO_HIGH ); + + /* + * Check that the thread exitted extensions were invoked in the right order. + */ + CheckForward( THREAD_EXITTED, 1, 1, thread, NULL ); + + /* + * Check that the other extensions were not invoked. + */ + CheckForward( THREAD_BEGIN, 0, 0, NULL, NULL ); + CheckForward( THREAD_CREATE, 0, 0, NULL, NULL ); + CheckReverse( THREAD_DELETE, 0, 0, NULL, NULL ); + CheckForward( THREAD_RESTART, 0, 0, NULL, NULL ); + CheckForward( THREAD_START, 0, 0, NULL, NULL ); + CheckForward( THREAD_SWITCH, 0, 0, NULL, NULL ); + CheckReverse( THREAD_TERMINATE, 0, 0, NULL, NULL ); + + /* + * Check that the thread exitted extension of the extension set deleted + * before its turn in the invocation was not invoked. + */ + CheckDeletedNotInvoked( THREAD_EXITTED ); +} + /** * @fn void T_case_body_RtemsUserextValUserext( void ) */ @@ -843,6 +912,7 @@ T_TEST_CASE_FIXTURE( RtemsUserextValUserext, &RtemsUserextValUserext_Fixture ) RtemsUserextValUserext_Action_4(); RtemsUserextValUserext_Action_5(); RtemsUserextValUserext_Action_6(); + RtemsUserextValUserext_Action_7(); } /** @} */ diff --git a/testsuites/validation/ts-userext.c b/testsuites/validation/ts-userext.c index b4531b579b..461a1ddc0e 100644 --- a/testsuites/validation/ts-userext.c +++ b/testsuites/validation/ts-userext.c @@ -92,6 +92,8 @@ const char rtems_test_name[] = "TestsuitesUserext"; .thread_terminate = ThreadTerminateExtension1 \ } +#define CONFIGURE_IDLE_TASK_BODY IdleBody + #include "ts-default.h" /** @} */ -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] fix type and logic issue when libbsd checking is enforced by the user code
Fixes #4930. --- rtems_bsd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rtems_bsd.py b/rtems_bsd.py index 7fbe66f..8faae10 100644 --- a/rtems_bsd.py +++ b/rtems_bsd.py @@ -71,8 +71,8 @@ def bsp_configure(conf, arch_bsp, mandatory=True): 'configure RTEMS with --disable-networking') rtems_libbsd_path = conf.options.rtems_libbsd if rtems_libbsd_path is None: -if conf.options.rtems is None: -rtems_libbsd_path = conf.options.rtems +if conf.options.rtems_path is not None: +rtems_libbsd_path = conf.options.rtems_path else: rtems_libbsd_path = conf.env.PREFIX -- 2.25.1 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] fix type and logic issue when libbsd checking is enforced by the user code
I'm not that familiar with this logic but your change looks right to me. Please.change the title from type to typo. It looks like a typo in your commitmto fix a typo. Lol I'm ok with you pushing this. --joel On Sat, Jul 22, 2023, 10:04 AM Karel Gardas wrote: > Fixes #4930. > --- > rtems_bsd.py | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/rtems_bsd.py b/rtems_bsd.py > index 7fbe66f..8faae10 100644 > --- a/rtems_bsd.py > +++ b/rtems_bsd.py > @@ -71,8 +71,8 @@ def bsp_configure(conf, arch_bsp, mandatory=True): > 'configure RTEMS with --disable-networking') > rtems_libbsd_path = conf.options.rtems_libbsd > if rtems_libbsd_path is None: > -if conf.options.rtems is None: > -rtems_libbsd_path = conf.options.rtems > +if conf.options.rtems_path is not None: > +rtems_libbsd_path = conf.options.rtems_path > else: > rtems_libbsd_path = conf.env.PREFIX > > -- > 2.25.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
Re: [PATCH] fix type and logic issue when libbsd checking is enforced by the user code
On 7/22/23 17:26, Joel Sherrill wrote: I'm not that familiar with this logic but your change looks right to me. ACK. Please.change the title from type to typo. It looks like a typo in your commitmto fix a typo. Lol No, not at all. As a big fan of statically typed languages I think this is type issue due to not checking option type for presence of a field, e.g. python bites here -- hence type issue. Anyway, I'll change that to typo as you prefer. :-) Karel ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel