Re: [PATCH] 6: Enable some libstdc++ features
Hello Chris, On 08.08.22 13:46, Sebastian Huber wrote: Enable TLS support for all RTEMS targets except bfin, lm32, m68k, mips, moxie, or1k, and v850. For all RTEMS targets, define HAVE_ALIGNED_ALLOC, HAVE_AT_QUICK_EXIT, HAVE_LINK, HAVE_QUICK_EXIT, HAVE_READLINK, HAVE_SETENV, HAVE_SLEEP, HAVE_STRERROR_L, HAVE_SYMLINK, HAVE_TRUNCATE, and HAVE_USLEEP. Update #4668. did you already have time to test the TLS support for libstdc++? -- 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: Binary CPU / Thread information.
Hello Sam, On 10.08.22 17:03, Sam Price wrote: I saw that there was a console command to see cpu usage information. https://docs.rtems.org/branches/master/c-user/cpu_usage_statistics.html <https://docs.rtems.org/branches/master/c-user/cpu_usage_statistics.html> Is there a binary api to get this, and stack usage? I want to get this info out and send it in binary packets. Is this something that I need to just copy whats going on in this file? cpukit/libmisc/cpuuse/cpuusagereport.c https://github.com/RTEMS/rtems/blob/fab1a86221e057a93bb9c1423dac81ed2b29ecde/cpukit/libmisc/cpuuse/cpuusagereport.c#L60 <https://github.com/RTEMS/rtems/blob/fab1a86221e057a93bb9c1423dac81ed2b29ecde/cpukit/libmisc/cpuuse/cpuusagereport.c#L60> or is there a c api out there that i am missing that fills usage information into c structs? there is currently no API to get the CPU usage information in a structure. You can add one if you like. -- 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: rtems-central: spec2module fails with no changes to repos
On 10.08.22 23:11, Joel Sherrill wrote: It looks like the rtems-central repo fails when spec2modules is run on it currently with no local changes. Sorry, I forgot to update the Git submodules. It should work now. -- 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
[docs] c-user: Clarify BSP related configuration settings
--- c-user/config/device-driver.rst | 7 ++-- c-user/config/general.rst | 60 ++--- c-user/config/idle-task.rst | 18 -- 3 files changed, 76 insertions(+), 9 deletions(-) diff --git a/c-user/config/device-driver.rst b/c-user/config/device-driver.rst index d84da0a..87ed27a 100644 --- a/c-user/config/device-driver.rst +++ b/c-user/config/device-driver.rst @@ -709,7 +709,7 @@ Driver Table. .. rubric:: NOTES: The value of this configuration option is placed after the entries defined by -:ref:`CONFIGURE_BSP_PREREQUISITE_DRIVERS` and before all other device driver +:c:macro:`CONFIGURE_BSP_PREREQUISITE_DRIVERS` and before all other device driver configuration options. See :ref:`CONFIGURE_APPLICATION_EXTRA_DRIVERS` for an alternative placement @@ -858,7 +858,10 @@ options: * :ref:`CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS` -* :ref:`CONFIGURE_BSP_PREREQUISITE_DRIVERS` +If the :ref:`CONFIGURE_DISABLE_BSP_SETTINGS` configuration option is not defined and +the :term:`BSP` provides +:c:macro:`CONFIGURE_BSP_PREREQUISITE_DRIVERS`, then the BSP-provided +prerequisite device drivers are also taken into account. .. rubric:: DESCRIPTION: diff --git a/c-user/config/general.rst b/c-user/config/general.rst index fa43686..c80d162 100644 --- a/c-user/config/general.rst +++ b/c-user/config/general.rst @@ -67,6 +67,55 @@ memory is first dirtied and then zeroed. See also :ref:`CONFIGURE_MALLOC_DIRTY`. +.. Generated from spec:/acfg/if/disable-bsp-settings + +.. raw:: latex + +\clearpage + +.. index:: CONFIGURE_DISABLE_BSP_SETTINGS + +.. _CONFIGURE_DISABLE_BSP_SETTINGS: + +CONFIGURE_DISABLE_BSP_SETTINGS +-- + +.. rubric:: CONSTANT: + +``CONFIGURE_DISABLE_BSP_SETTINGS`` + +.. rubric:: OPTION TYPE: + +This configuration option is a boolean feature define. + +.. rubric:: DEFAULT CONFIGURATION: + +If this configuration option is undefined, then the described feature is not +enabled. + +.. rubric:: DESCRIPTION: + +In case this configuration option is defined, then the optional BSP provided +settings listed below are disabled. + +The optional BSP provided default values for the following application +configuration options are disabled: + +* :ref:`CONFIGURE_IDLE_TASK_BODY` + +* :ref:`CONFIGURE_IDLE_TASK_STACK_SIZE` + +* :ref:`CONFIGURE_INTERRUPT_STACK_SIZE` + +The optional BSP provided initial extension set is disabled (see +:term:`initial extension sets`). The optional BSP provided +prerequisite IO device drivers are disabled (see +Device Driver Configuration). The optional BSP provided support for +:c:func:`sbrk` is disabled. + +This configuration option provides an all or nothing choice with respect to +the optional BSP provided settings. + .. Generated from spec:/acfg/if/disable-newlib-reentrancy .. raw:: latex @@ -237,8 +286,8 @@ initial user extensions. .. rubric:: NOTES: The value of this configuration option is placed before the entries of -:ref:`BSP_INITIAL_EXTENSION` and after the entries of all other initial -user extensions. +:c:macro:`BSP_INITIAL_EXTENSION` and after the entries of all other +initial user extensions. .. rubric:: CONSTRAINTS: @@ -269,8 +318,11 @@ This configuration option is an integer define. .. rubric:: DEFAULT VALUE: -The default value is :ref:`BSP_INTERRUPT_STACK_SIZE` in case it is defined, -otherwise the default value is :c:macro:`CPU_STACK_MINIMUM_SIZE`. +If the :ref:`CONFIGURE_DISABLE_BSP_SETTINGS` configuration option is not defined and +:c:macro:`BSP_INTERRUPT_STACK_SIZE` is provided by the +:term:`BSP`, then the default value is defined by +:c:macro:`BSP_INTERRUPT_STACK_SIZE`, otherwise the default value is +:c:macro:`CPU_STACK_MINIMUM_SIZE`. .. rubric:: DESCRIPTION: diff --git a/c-user/config/idle-task.rst b/c-user/config/idle-task.rst index 5cf8364..359f862 100644 --- a/c-user/config/idle-task.rst +++ b/c-user/config/idle-task.rst @@ -48,8 +48,11 @@ This configuration option is an initializer define. .. rubric:: DEFAULT VALUE: -If :ref:`BSP_IDLE_TASK_BODY` is defined, then this will be the default value, -otherwise the default value is ``_CPU_Thread_Idle_body``. +If the :ref:`CONFIGURE_DISABLE_BSP_SETTINGS` configuration option is not defined and +:c:macro:`BSP_IDLE_TASK_BODY` is provided by the +:term:`BSP`, then the default value is defined by +:c:macro:`BSP_IDLE_TASK_BODY`, otherwise the default value is +``_CPU_Thread_Idle_body``. .. rubric:: DESCRIPTION: @@ -64,6 +67,11 @@ exists. IDLE threads can be used to initialize the application, see configuration option :ref:`CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION`. +The BSP may have knowledge of the specific CPU model, system controller +logic, and peripheral buses, so a BSP-specific IDLE task may be capable of +turning components off to save power during extended periods of no task +activity. + .. rubric:: CONSTRAINTS: The value of the configuration option shall be defined to a valid function @@
[PATCH] rtems/malloc.h: Add API level Doxygen group
The interfaces in the MallocSupport group belong to the implementation. They are used by confdefs.h for example. --- cpukit/include/rtems/malloc.h | 60 --- 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/cpukit/include/rtems/malloc.h b/cpukit/include/rtems/malloc.h index 7d7f8fa677..c26b262881 100644 --- a/cpukit/include/rtems/malloc.h +++ b/cpukit/include/rtems/malloc.h @@ -3,7 +3,12 @@ /** * @file * - * This file defines the interface to RTEMS extensions to the Malloc Family. + * @ingroup MallocSupport + * + * @ingroup RTEMSAPIMalloc + * + * @brief This header file defines interfaces to support and use dynamic memory + * allocation. */ /* @@ -46,11 +51,13 @@ extern "C" { #endif /** - * @defgroup MallocSupport Malloc Support + * @defgroup MallocSupport Malloc Support + * + * @ingroup libcsupport * - * @ingroup libcsupport + * @brief This group contains interfaces to support dynamic memory allocation. * - * @brief RTEMS extensions to the Malloc Family + * @{ */ /** @@ -63,8 +70,6 @@ extern Heap_Control *RTEMS_Malloc_Heap; void _Malloc_Initialize( void ); -void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount ); - typedef void *(*rtems_heap_extend_handler)( Heap_Control *heap, size_t alloc_size @@ -78,19 +83,6 @@ void *rtems_heap_extend_via_sbrk( size_t alloc_size ); -/** - * @brief Greedy allocate that empties the sbrk memory - * - * Afterwards all the sbrk avialable memory will have been allocated - * to the provided heap. - * - * @see rtems_heap_extend_via_sbrk(). - */ -void rtems_heap_sbrk_greedy_allocate( - Heap_Control *heap, - size_t alloc_size -); - void *rtems_heap_null_extend( Heap_Control *heap, size_t alloc_size @@ -104,6 +96,34 @@ extern const rtems_heap_extend_handler rtems_malloc_extend_handler; typedef void (*rtems_malloc_dirtier_t)(void *, size_t); extern rtems_malloc_dirtier_t rtems_malloc_dirty_helper; +/** @} */ + +/** + * @defgroup RTEMSAPIMalloc Dynamic Memory Allocation + * + * @ingroup RTEMSAPI + * + * @brief This group contains non-standard interfaces to use dynamic memory + * allocation. + * + * @{ + */ + +void rtems_heap_set_sbrk_amount( ptrdiff_t sbrk_amount ); + +/** + * @brief Greedy allocate that empties the sbrk memory + * + * Afterwards all the sbrk avialable memory will have been allocated + * to the provided heap. + * + * @see rtems_heap_extend_via_sbrk(). + */ +void rtems_heap_sbrk_greedy_allocate( + Heap_Control *heap, + size_t alloc_size +); + /** * @brief Dirty Memory Function * @@ -251,6 +271,8 @@ void *rtems_heap_greedy_allocate_all_except_largest( */ void rtems_heap_greedy_free( void *opaque ); +/** @} */ + #ifdef __cplusplus } #endif -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH rtems v2 1/3] Add support for CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
On 09/08/2022 00:22, Joel Sherrill wrote: This adds the configure option CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR which allows the application to choose whether to have the POSIX timer_create() function follow the behavior defined by POSIX or the FACE Technical Standard. Thanks, looks good. -- 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] 6: Enable some libstdc++ features
Enable TLS support for all RTEMS targets except bfin, lm32, m68k, mips, moxie, or1k, and v850. For all RTEMS targets, define HAVE_ALIGNED_ALLOC, HAVE_AT_QUICK_EXIT, HAVE_LINK, HAVE_QUICK_EXIT, HAVE_READLINK, HAVE_SETENV, HAVE_SLEEP, HAVE_STRERROR_L, HAVE_SYMLINK, HAVE_TRUNCATE, and HAVE_USLEEP. Update #4668. --- rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg | 3 +++ rtems/config/tools/rtems-gcc-12-newlib-head.cfg | 4 2 files changed, 7 insertions(+) diff --git a/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg b/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg index 947caca..bc73345 100644 --- a/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg +++ b/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg @@ -11,6 +11,9 @@ %patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4560/gcc-10-RTEMS-Use-local-exec-TLS-model-by-default.patch %hash sha512 gcc-10-RTEMS-Use-local-exec-TLS-model-by-default.patch 6f74431d0862de65d93c01a09db05593b9f45607ffaa5bca2477a4d538cdde25de72875821db89001612e8b68c65af32ea6c6f6feb77658b98d311f3383c39a1 +%patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4668/gcc-10-RTEMS-Enable-some-features-in-libstdc.patch +%hash sha512 gcc-10-RTEMS-Enable-some-features-in-libstdc.patch a8186e3a0eb2b850b048242a6990db35feb4549dac089ebf90b06aef9f72839da74b97b41f4aefb2a76e9ca0c3c2baeb22b89ada0b6600f00162b31e50ccad57 + %patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4215/0001-nios2-Remove-custom-instruction-warnings.patch %hash sha512 0001-nios2-Remove-custom-instruction-warnings.patch afd8a5e6bdcc5b75d5fbbf558bdf56ccac400521a6eec9d88cc95f6be67c481f2dbf8faa0f6ddc1e4ac7c56a84938714d80e46e9cf80ec4b8fcd739986449881 diff --git a/rtems/config/tools/rtems-gcc-12-newlib-head.cfg b/rtems/config/tools/rtems-gcc-12-newlib-head.cfg index 9555a89..7f4b432 100644 --- a/rtems/config/tools/rtems-gcc-12-newlib-head.cfg +++ b/rtems/config/tools/rtems-gcc-12-newlib-head.cfg @@ -21,6 +21,10 @@ %hash sha512 gcc-12-RTEMS-Use-local-exec-TLS-model-by-default.patch \ u6rhKhbCXwpX2Dib/YYMRRwYqRc+9Mf3MFUBAgwYQ6AFy/4VbVFpTLyzReMIkEC1Dumq66qABQPalh9YHTDwxA== +%patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4668/gcc-12-RTEMS-Enable-some-features-in-libstdc.patch +%hash sha512 gcc-12-RTEMS-Enable-some-features-in-libstdc.patch \ + dZehMV4QtmSlXope4a4w6wivL39Y2NYFZz8qdJwHHZFkp5c7yUcxzQ+BLIKRmae0fRjMQB/bj7oVPVvZU2qYgA== + %patch add newlib -p1 https://devel.rtems.org/raw-attachment/ticket/4510/0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch %hash sha512 0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch \ fKI36r/Vs4JxMYbh/CkN/JmaNTMVeV7LjdDSL80at/W/MfQymVStq5GtBMEA3KwOhtQG/bzo+Cz53COELIjK9g== -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[tools] tester: Sort test reports for JSON/YAML
This makes the reports more git friendly. Update 4671. --- tester/rt/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tester/rt/test.py b/tester/rt/test.py index 9549765..2b5ad85 100644 --- a/tester/rt/test.py +++ b/tester/rt/test.py @@ -248,7 +248,7 @@ def results_to_data(args, reports, start_time, end_time): run_data['arch'] = run['bsp_arch'] reports_data.append(run_data) -data['reports'] = reports_data +data['reports'] = sorted(reports_data, key=lambda x: x["executable"]) return data -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH rtems 1/2] Add support for CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
On 05/08/2022 16:14, Joel Sherrill wrote: On Fri, Aug 5, 2022 at 5:45 AM Sebastian Huber <mailto:sebastian.hu...@embedded-brains.de>> wrote: On 05/08/2022 00:08, Joel Sherrill wrote: > This adds the configure option CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR > which allows the application to choose whether to have the POSIX > timer_create() function follow the behavior defined by POSIX or > the FACE Technical Standard. > > Updates #4691. It would be nice if you could add items for the new option to rtems-central so that we can use it for the Doxygen documentation and the manual. I'll give it a try. Is there a readme or really good example? There is this: https://docs.rtems.org/branches/master/eng/req/howto.html# > --- > cpukit/include/rtems/confdefs.h | 1 + > cpukit/include/rtems/confdefs/face.h | 71 + > cpukit/include/rtems/posix/timerimpl.h | 11 +++ > cpukit/posix/src/psxtimercreate.c | 19 - > spec/build/testsuites/psxtests/grp.yml | 2 + > spec/build/testsuites/psxtests/psxtimer_face01.yml | 20 + > testsuites/psxtests/psxtimer_face01/psxtimer.c | 89 ++ > .../psxtests/psxtimer_face01/psxtimer_face01.doc | 39 ++ > .../psxtests/psxtimer_face01/psxtimer_face01.scn | 4 + > 9 files changed, 255 insertions(+), 1 deletion(-) > create mode 100644 cpukit/include/rtems/confdefs/face.h > create mode 100644 spec/build/testsuites/psxtests/psxtimer_face01.yml > create mode 100644 testsuites/psxtests/psxtimer_face01/psxtimer.c > create mode 100644 testsuites/psxtests/psxtimer_face01/psxtimer_face01.doc > create mode 100644 testsuites/psxtests/psxtimer_face01/psxtimer_face01.scn > > diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h > index e6dd3d7..3927d26 100644 > --- a/cpukit/include/rtems/confdefs.h > +++ b/cpukit/include/rtems/confdefs.h > @@ -64,6 +64,7 @@ > #include > #include > #include > +#include > #include > #include > #include > diff --git a/cpukit/include/rtems/confdefs/face.h b/cpukit/include/rtems/confdefs/face.h > new file mode 100644 > index 000..07ab62e > --- /dev/null > +++ b/cpukit/include/rtems/confdefs/face.h > @@ -0,0 +1,71 @@ > +/* SPDX-License-Identifier: BSD-2-Clause */ > + > +/** > + * @file > + * > + * @ingroup RTEMSImplApplConfig > + * > + * @brief This header file evaluates configuration options related to > + * the FACE Technical Standard. > + * > + * The FACE Technical Standard (https://opengroup.org/face <https://opengroup.org/face>) is an > + * open standard designed for safety critical embedded systems. It > + * includes POSIX profiles and requirements that promote safety > + * and portability. As a general rules, the profiles place a minimum > + * on the services which an operating system must provide. Those > + * same profile definitions represent the maximum services which > + * an application may use. > + */ > + > +/* > + * Copyright (C) 2022 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 CAU
Re: [PATCH rtems 1/2] Add support for CONFIGURE_POSIX_TIMERS_FACE_BEHAVIOR
cpukit/include/rtems/posix/timerimpl.h @@ -139,6 +139,17 @@ RTEMS_INLINE_ROUTINE void _POSIX_Timer_Release( _ISR_lock_ISR_enable( lock_context ); } +/** + * @brief Follow POSIX or FACE Technical Standard on timer_create + * + * POSIX allows for the creation of timers based on CLOCK_REALTIME. + * This is viewed as a safety issue by the FACE Technical Standard + * and required to return an error. These are conflicting behaviors. + * This method is instanced by configuration when FACE conformant + * behavior is desired by the application. + */ +RTEMS_WEAK bool _POSIX_Timer_Is_allowed_on_CLOCK_REALTIME( void ); No RTEMS_WEAK in the header file. -- 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] testsuite/psxclock: Check setting realtime clock
Hello Chris, On 02/08/2022 02:42, chr...@rtems.org wrote: This patch adds a test to make sure threads sleeping on a clock_nanosleep(CLOCK_REALTIME) call are not effected by a change in the realtime clock via the clock_settime(CLOCK_REALTIME). The tests checks the sleeping thread's period using clock ticks. I have checked the test and Sebastian's patch on: arm/xilinx_zynq_a9_qemu sparc/erc32 aarch64/xilinx_zynqmp_lp64_zu3eg I checked in the fix for relative CLOCK_REALTIME sleeps. -- 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] posix: Fix relative CLOCK_REALTIME sleep
On 01/08/2022 10:48, Chris Johns wrote: On 1/8/2022 6:20 pm, Sebastian Huber wrote: On 01/08/2022 10:16, Chris Johns wrote: On 1/8/2022 5:22 pm, Sebastian Huber wrote: A relative CLOCK_REALTIME time out shall not be affected by CLOCK_REALTIME changes through clock_settime(). Since our CLOCK_REALTIME is basically just CLOCK_MONOTONIC plus an offset, we can simply use the CLOCK_MONOTONIC watchdog for relative CLOCK_REALTIME time outs. Thank for this. I can confirm it works with the modified test code I attached to the ticket. I am ts-validation-no-clock-0.exe now failing on xilinx_zynq_a9_qemu but I am not sure? I have to adjust the ts-validation-no-clock-0.exe if we want to fix the issue like this. There is one issue my test changes have exposed and that is the ticks a thread sleeps for is 1 more than the requested number. I think this is the expected behaviour. You should sleep at least the requested amount of time. I am using 500msec so I would expect the result to be exact? If it was 501msec then I would agree. What do you mean with exact? If you want to wait for 500ms, then you will wake up in 500ms plus one clock tick interval (unless you measure the start time exactly at the clock tick event which is very unlikely). -- 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] posix: Fix relative CLOCK_REALTIME sleep
On 01/08/2022 10:16, Chris Johns wrote: On 1/8/2022 5:22 pm, Sebastian Huber wrote: A relative CLOCK_REALTIME time out shall not be affected by CLOCK_REALTIME changes through clock_settime(). Since our CLOCK_REALTIME is basically just CLOCK_MONOTONIC plus an offset, we can simply use the CLOCK_MONOTONIC watchdog for relative CLOCK_REALTIME time outs. Thank for this. I can confirm it works with the modified test code I attached to the ticket. I am ts-validation-no-clock-0.exe now failing on xilinx_zynq_a9_qemu but I am not sure? I have to adjust the ts-validation-no-clock-0.exe if we want to fix the issue like this. There is one issue my test changes have exposed and that is the ticks a thread sleeps for is 1 more than the requested number. I think this is the expected behaviour. You should sleep at least the requested amount of time. -- 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] posix: Fix relative CLOCK_REALTIME sleep
A relative CLOCK_REALTIME time out shall not be affected by CLOCK_REALTIME changes through clock_settime(). Since our CLOCK_REALTIME is basically just CLOCK_MONOTONIC plus an offset, we can simply use the CLOCK_MONOTONIC watchdog for relative CLOCK_REALTIME time outs. Update #4690. --- cpukit/posix/src/clocknanosleep.c | 9 + 1 file changed, 9 insertions(+) diff --git a/cpukit/posix/src/clocknanosleep.c b/cpukit/posix/src/clocknanosleep.c index 3fa890fecd..bfa8ef7975 100644 --- a/cpukit/posix/src/clocknanosleep.c +++ b/cpukit/posix/src/clocknanosleep.c @@ -82,6 +82,15 @@ int clock_nanosleep( rmtp = NULL; } else { absolute = false; + +/* + * A relative CLOCK_REALTIME time out shall not be affected by + * CLOCK_REALTIME changes through clock_settime(). Since our + * CLOCK_REALTIME is basically just CLOCK_MONOTONIC plus an offset, we can + * simply use the CLOCK_MONOTONIC watchdog for relative CLOCK_REALTIME time + * outs. + */ +clock_id = CLOCK_MONOTONIC; } if ( clock_id == CLOCK_REALTIME ) { -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v3] aarch64/versal: Support DDRMC0 region 0 and 1
Hello, I get now linker errors: /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.rodata.bsp_r1_region+0x0): undefined reference to `bsp_r1_ram_base' /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.rodata.bsp_r1_region+0x4): undefined reference to `bsp_r1_ram_end' /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.bsp_start_data+0x140): undefined reference to `bsp_r1_ram_base' /opt/rtems/6/lib/gcc/aarch64-rtems6/12.1.1/../../../../aarch64-rtems6/bin/ld: ./librtemsbsp.a(bspstartmmu.c.7.o):(.bsp_start_data+0x144): undefined reference to `bsp_r1_ram_end' collect2: error: ld returned 1 exit status Waf: Leaving directory `/tmp/sh/b-rtems/aarch64/xilinx_versal_ilp32_qemu' -- 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 v2 1/2] c-user: Document task life states
On 28/07/2022 02:06, Chris Johns wrote: Nice and OK to push. A minor point below... Thanks for the review. I checked it in. -- 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 2/2] sptests/spstdc17: New test
Hello, On 25/07/2022 10:02, Sebastian Huber wrote: +cflags: +- -std=c17 +- -pedantic +- -Wextra this test case causes build issue on several BSPs, because the is not C17 compatible. Example error: bsps/arm/beagle/include/bsp.h:298:5: error: 'asm' undeclared (first use in this function) 298 | asm volatile("mcr p15, 0, %[zero], c8, c7, 0 @ TLBIALL\n\t" | ^~~ -- 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] c-user: Document new rtems_task_delete() behaviour
On 27/07/2022 05:37, Chris Johns wrote: What about SMP? If the calling task is deleting a task running on another core? The language is hard here. I am not sure what works. It doesn't matter on which processor the deleted task runs. The termination and restart requests are processed as signal handlers. -- 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 2/2] c-user: Document new rtems_task_delete() behaviour
Update #4679. --- c-user/task/directives.rst | 25 - 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/c-user/task/directives.rst b/c-user/task/directives.rst index 64b591d..b78aaa9 100644 --- a/c-user/task/directives.rst +++ b/c-user/task/directives.rst @@ -805,14 +805,26 @@ specified by ``id``. :c:macro:`RTEMS_CALLED_FROM_ISR` The directive was called from within interrupt context. +:c:macro:`RTEMS_INCORRECT_STATE` +The task termination procedure was started, however, waiting for the +terminating task would have resulted in a deadlock. + :c:macro:`RTEMS_ILLEGAL_ON_REMOTE_OBJECT` The task resided on a remote node. .. rubric:: NOTES: -RTEMS stops the execution of the task and reclaims the stack memory, any -allocated delay or timeout timers, the TCB, and, if the task is -:c:macro:`RTEMS_FLOATING_POINT`, its floating point context area. RTEMS +The task deletion is done in several steps. Firstly, the task is marked as +terminating. While the task life of the terminating task is protected, it +executes normally until it disables the task life protection or it deletes +itself. A terminating task will eventually stop its normal execution and start +its termination procedure. The procedure executes in the context of the +terminating task. The task termination procedure involves the destruction of +POSIX key values and running the task termination user extensions. Once +complete the execution of the task is stopped and task-specific resources are +reclaimed by the system, such as the stack memory, any allocated delay or +timeout timers, the :term:`TCB`, and, if the task is +:c:macro:`RTEMS_FLOATING_POINT`, its floating point context area. RTEMS explicitly does not reclaim the following resources: region segments, partition buffers, semaphores, timers, or rate monotonic periods. @@ -824,10 +836,13 @@ resources before deletion. A task can be directed to release its resources and delete itself by restarting it with a special argument or by sending it a message, an event, or a signal. -Deletion of the current task (:c:macro:`RTEMS_SELF`) will force RTEMS to select +Deletion of the calling task (:c:macro:`RTEMS_SELF`) will force RTEMS to select another task to execute. -The :term:`TCB` for the deleted task is reclaimed by RTEMS. +When a task deletes another task, the calling task waits until the task +termination procedure of the task being deleted has completed. The terminating +task inherits the :term:`eligible priorities ` of the +calling task. When a global task is deleted, the task identifier must be transmitted to every node in the system for deletion from the local copy of the global object table. -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v2 1/2] c-user: Document task life states
Update #4679. --- c-user/task/background.rst | 53 +- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/c-user/task/background.rst b/c-user/task/background.rst index da6cabf..df38356 100644 --- a/c-user/task/background.rst +++ b/c-user/task/background.rst @@ -1,6 +1,6 @@ .. SPDX-License-Identifier: CC-BY-SA-4.0 -.. Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +.. Copyright (C) 2020, 2022 embedded brains GmbH (http://www.embedded-brains.de) .. Copyright (C) 1988, 2008 On-Line Applications Research Corporation (OAR) Background @@ -233,6 +233,57 @@ the task will execute at interrupt level n. The set of default modes may be selected by specifying the ``RTEMS_DEFAULT_MODES`` constant. +.. index:: task life states + +Task Life States + + +Independent of the task state with respect to the scheduler, the task life is +determined by several orthogonal states: + +* *protected* or *unprotected* + +* *deferred life changes* or *no deferred life changes* + +* *restarting* or *not restarting* + +* *terminating* or *not terminating* + +* *detached* or *not detached* + +While the task life is *protected*, asynchronous task restart and termination +requests are blocked. A task may still restart or terminate itself. All tasks +are created with an unprotected task life. The task life protection is used by +the system to prevent that system resources are affected by asynchronous task +restart and termination requests. The task life protection can be enabled +(``PTHREAD_CANCEL_DISABLE``) or disabled (``PTHREAD_CANCEL_ENABLE``) for the +calling task through the ``pthread_setcancelstate()`` directive. + +While *deferred life changes* are enabled, asynchronous task restart and +termination requests are delayed until the task performs a life change itself +or calls ``pthread_testcancel()``. Cancellation points are not implemented in +RTEMS. Deferred task life changes can be enabled (``PTHREAD_CANCEL_DEFERRED``) +or disabled (``PTHREAD_CANCEL_ASYNCHRONOUS``) for the calling task through the +``pthread_setcanceltype()`` directive. Classic API tasks are created with +deferred life changes disabled. POSIX threads are created with deferred life +changes enabled. + +A task is made *restarting* by issuing a task restart request through the +:ref:`InterfaceRtemsTaskRestart` directive. + +A task is made *terminating* by issuing a task termination request through the +:ref:`InterfaceRtemsTaskExit`, :ref:`InterfaceRtemsTaskDelete`, +``pthread_exit()``, and ``pthread_cancel()`` directives. + +When a *detached* task terminates, the termination procedure completes without +the need for another task to join with the terminated task. Classic API tasks +are created as not detached. The detached state of created POSIX threads is +determined by the thread attributes. They are created as not detached by +default. The calling task is made detached through the ``pthread_detach()`` +directive. The :ref:`InterfaceRtemsTaskExit` directive and self deletion +though :ref:`InterfaceRtemsTaskDelete` directive make the calling task +detached. + .. index:: task arguments .. index:: task prototype -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [tools] tester: Normalize JSON and YAML reports
Hello, I sent a v2 of the patch: https://lists.rtems.org/pipermail/devel/2022-July/072679.html On 01/07/2022 01:12, Chris Johns wrote: From my point of view the JSON/YAML reports should not satisfy every possible consumer directly. How do you determine the list you are satisfying? I can see this argument working in two directions. The report is satisfactory when it includes all information available to the tester and not more. A machine readable report should be without redundancy. If there a technical issue with providing this data? For this grouping we have to assume a certain layout of the test executables. From my point of view the tester should be generalized to support running all sorts of tests and not just tests of the RTEMS testsuites. Does the output provide format metadata to determine the version of the output? I added a 'report-version' attribute in v2. -- 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
[tools v2] tester: Normalize JSON and YAML reports
Report the same data in JSON and YAML reports. Do not report redundant information. Update 4671. --- v2: * Add 'report-version' attribute with a value of 1. * Add 'tester-version' attribute. * Use a list for both 'command-line' attributes. tester/rt/test.py | 193 ++ 1 file changed, 42 insertions(+), 151 deletions(-) diff --git a/tester/rt/test.py b/tester/rt/test.py index 113936c..a13b40a 100644 --- a/tester/rt/test.py +++ b/tester/rt/test.py @@ -218,76 +218,48 @@ def killall(tests): test.kill() +def results_to_data(args, reports, start_time, end_time): +data = {} +data['report-version'] = 1 +data['tester-version'] = version.string() +data['command-line'] = args +data['host'] = host.label(mode='all') +data['python'] = sys.version.replace('\n', '') +data['start-time'] = start_time.isoformat() +data['end-time'] = start_time.isoformat() +reports_data = [] + +for name, run in reports.results.items(): +run_data = {} +result = run['result'] +run_data['result'] = result +output = [] +for line in run['output']: +if line.startswith('] '): +output.append(line[2:]) +elif line.startswith('=> exe:'): +run_data['command-line'] = line[9:].split() +run_data['output'] = output +run_data['executable'] = name +run_data['executable-sha512'] = get_hash512(name) +run_data['start-time'] = run['start'].isoformat() +run_data['end-time'] = run['end'].isoformat() +run_data['bsp'] = run['bsp'] +run_data['arch'] = run['bsp_arch'] +reports_data.append(run_data) + +data['reports'] = reports_data +return data + + def generate_json_report(args, reports, start_time, end_time, - total, json_file): + _total, json_file): import json -import sys -json_log = {} -json_log['Command Line'] = " ".join(args) -json_log['Python'] = sys.version.replace('\n', '') -json_log['test_groups'] = [] -json_log['Host'] = host.label(mode='all') -json_log['summary'] = {} -json_log['summary']['passed_count'] = reports.passed -json_log['summary']['failed_count'] = reports.failed -json_log['summary']['user-input_count'] = reports.user_input -json_log['summary']['expected-fail_count'] = reports.expected_fail -json_log['summary']['indeterminate_count'] = reports.indeterminate -json_log['summary']['benchmark_count'] = reports.benchmark -json_log['summary']['timeout_count'] = reports.timeouts -json_log['summary']['test-too-long_count'] = reports.test_too_long -json_log['summary']['invalid_count'] = reports.invalids -json_log['summary']['wrong-version_count'] = reports.wrong_version -json_log['summary']['wrong-build_count'] = reports.wrong_build -json_log['summary']['wrong-tools_count'] = reports.wrong_tools -json_log['summary']['invalid-header_count'] = reports.wrong_header -json_log['summary']['total_count'] = reports.total -time_delta = end_time - start_time -json_log['summary']['average_test_time'] = str(time_delta / total) -json_log['summary']['testing_time'] = str(time_delta) - -result_types = [ -'failed', 'user-input', 'expected-fail', 'indeterminate', -'benchmark', 'timeout', 'test-too-long', 'invalid', 'wrong-version', -'wrong-build', 'wrong-tools', 'wrong-header' -] -json_results = {} -for result_type in result_types: -json_log['summary'][result_type] = [] - -# collate results for JSON log -for name in reports.results: -result_type = reports.results[name]['result'] -# map fatal-error on to failed since the report adds both to the failed count -if result_type == "fatal-error": -result_type = "failed" -test_parts = name.split("/") -test_category = test_parts[-2] -test_name = test_parts[-1] -if result_type != 'passed': -json_log['summary'][result_type].append(test_name) -if test_category not in json_results: -json_results[test_category] = [] -json_result = {} -# remove the file extension -json_result["name"] = test_name.split('.')[0] -json_result["result"] = result_type -if result_type == "failed" or result_type == "timeout": -json_result["output"] = reports.results[name]["output"] -json_results[test_category].append(json_result) - -# convert results to a better format for report generation -sorted_keys = sorted(json_results.keys()) -for i in range(len(sorted_keys)): -results_log = {} -results_log["index"] = i + 1 -results_log["name"] = sorted_keys[i] -results_log["results"] = json_results[sorted_keys[i]] -json_log["test_groups"].append(results_log) - -# write out
Re: [PATCH v3 2/2] bsp/riscv: Add NOEL-V BSP
On 15/07/2022 14:54, Sebastian Huber wrote: diff --git a/spec/build/bsps/riscv/noel/optextirqmax.yml b/spec/build/bsps/riscv/noel/optextirqmax.yml new file mode 100644 index 00..ffa84748b6 --- /dev/null +++ b/spec/build/bsps/riscv/noel/optextirqmax.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- define: null +build-type: option +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +default: 64 +default-by-variant: [] +description: | + maximum number of external interrupts supported by the BSP (default 64) +enabled-by: true +format: '{}' +links: [] +name: RISCV_MAXIMUM_EXTERNAL_INTERRUPTS +type: build Please move this one level up and reuse it in the other riscv BSPs. I moved the option to spec/build/bsps/riscv/optextirqmax.yml. Please just use it through a link to ../optextirqmax. -- 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] c-user: Document new rtems_task_delete() behaviour
Update #4679. --- c-user/task/directives.rst | 29 +++-- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/c-user/task/directives.rst b/c-user/task/directives.rst index 64b591d..9f9ea45 100644 --- a/c-user/task/directives.rst +++ b/c-user/task/directives.rst @@ -805,16 +805,28 @@ specified by ``id``. :c:macro:`RTEMS_CALLED_FROM_ISR` The directive was called from within interrupt context. +:c:macro:`RTEMS_INCORRECT_STATE` +The task termination procedure was started, however, waiting for the +terminating task would have resulted in a deadlock. + :c:macro:`RTEMS_ILLEGAL_ON_REMOTE_OBJECT` The task resided on a remote node. .. rubric:: NOTES: -RTEMS stops the execution of the task and reclaims the stack memory, any -allocated delay or timeout timers, the TCB, and, if the task is -:c:macro:`RTEMS_FLOATING_POINT`, its floating point context area. RTEMS -explicitly does not reclaim the following resources: region segments, partition -buffers, semaphores, timers, or rate monotonic periods. +The task deletion is done in several steps. Firstly, the task is marked as +terminating. While the task life of the terminating task is protected, it +executes normally until it disables the task life protection or it deletes +itself. A terminating task will eventually stop its normal execution and start +its termination procedure. The procedure executes in the context of the +terminating task. It involves the destruction of POSIX key values and running +the task termination user extensions. Once the task termination procedure is +done, the execution of the task is stopped and task-specific resources are +reclaimed by the system, such as the stack memory, any allocated delay or +timeout timers, the TCB, and, if the task is :c:macro:`RTEMS_FLOATING_POINT`, +its floating point context area. RTEMS explicitly does not reclaim the +following resources: region segments, partition buffers, semaphores, timers, or +rate monotonic periods. A task is responsible for releasing its resources back to RTEMS before deletion. To insure proper deallocation of resources, a task should not be @@ -824,11 +836,16 @@ resources before deletion. A task can be directed to release its resources and delete itself by restarting it with a special argument or by sending it a message, an event, or a signal. -Deletion of the current task (:c:macro:`RTEMS_SELF`) will force RTEMS to select +Deletion of the calling task (:c:macro:`RTEMS_SELF`) will force RTEMS to select another task to execute. The :term:`TCB` for the deleted task is reclaimed by RTEMS. +When a task other than the calling task is deleted, the calling task waits +until the task termination procedure of the other task is done. The +terminating task inherits the :term:`eligible priorities ` +of the calling task. + When a global task is deleted, the task identifier must be transmitted to every node in the system for deletion from the local copy of the global object table. -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] score: Remove PRIORITY_PSEUDO_ISR thread priority
On 22/07/2022 14:35, Sebastian Huber wrote: On 21.07.22 16:20, Joel Sherrill wrote: On Thu, Jul 21, 2022 at 12:53 AM Sebastian Huber <mailto:sebastian.hu...@embedded-brains.de>> wrote: Hello Gedare and Joel, On 15.07.22 10:43, Sebastian Huber wrote: > The uniprocessor schedulers had some special case logic for the > PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR > were allowed to preempt a not preemptible task. If other higher priority task > are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible > task, then the other tasks run before the not preemptible task. This made the > RTEMS_NO_PREEMPT mode ineffective. > > Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the > uniprocessor schedulers. Move the uniprocessor-specific scheduler support to > the new header file . > > Close #2365. I'm guessing that PRIORITY_PSEUDO_ISR wasn't used outside RTEMS itself and likely only historically for the Timer Server Thread. The protection for that thread was reworked as part of the SMP efforts. If it is used outside RTEMS, that would be a user facing breakage and should be documented. If you think all the use cases of PRIORITY_PSEUDO_ISR are accounted for, I'm ok with removing it. The pseudo-interrupt priority is mentioned in a glossary entry: priority boosting A simple approach to extend the priority inheritance protocol for clustered scheduling is priority boosting. In case a mutex is owned by a task of another cluster, then the priority of the owner task is raised to an artificially high priority, the pseudo-interrupt priority. This entry was added for the clustered scheduling documentation and needs to be changed. I found no reference to the no-preempt break of the pseudo-interrupt priority in the documentation. I doubt that there is an application which relies on this extraordinary feature. I updated the documentation and committed the patch. -- 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: AW: [PATCH] sppps01: Add test case for early returns of pps_event()
Hello Gabriel, On 26/07/2022 10:03, gabriel.moy...@dlr.de wrote: The patch added a new test case (PPSEventEarlyReturns) for increasing the test coverage. The test case checks whether the function pps_event() (in file kern_tc.c) returns early. According to the result you shared, the test is failing in lines 115 and 119, which means that there is no early return of the function pps_event() due to saving the timecounter in the pps_state object (line 2225 of kern_tc.c). My guess is that saving the timecounter is happening in the previous call of pps_event() (in line 109 of the test case). Unfortunately I cannot understand why this is failing in intermittently manner (apparently just in QEMU). the issue should be already fixed. It was an SMP-specific problem since here we have two timehands. -- 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 2/2] sptests/spstdc17: New test
On 25/07/2022 16:00, Joel Sherrill wrote: This is OK but from what I see in applications, C99 is the version actually in use. C17 is the default version of GCC 10 and 12. Threads are undefined in C99. Why would someone use such an old standard with RTEMS? Anyway, if you think it is important to support, you can add a spstdc99 test program. We have a couple of warnings with -pedantic because we use a GCC extension for flexible array members. -- 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 1/2] imfs: Add
--- cpukit/include/rtems/imfs.h | 38 +--- cpukit/include/rtems/imfsimpl.h | 92 +++ cpukit/libfs/src/imfs/imfs_add_node.c | 2 +- cpukit/libfs/src/imfs/imfs_chown.c| 2 +- cpukit/libfs/src/imfs/imfs_fchmod.c | 2 +- cpukit/libfs/src/imfs/imfs_fifo.c | 2 +- cpukit/libfs/src/imfs/imfs_linfile.c | 2 +- cpukit/libfs/src/imfs/imfs_link.c | 2 +- .../libfs/src/imfs/imfs_make_generic_node.c | 2 +- cpukit/libfs/src/imfs/imfs_memfile.c | 2 +- cpukit/libfs/src/imfs/imfs_mknod.c| 2 +- cpukit/libfs/src/imfs/imfs_node.c | 2 +- cpukit/libfs/src/imfs/imfs_rename.c | 2 +- spec/build/cpukit/librtemscpu.yml | 1 + 14 files changed, 105 insertions(+), 48 deletions(-) create mode 100644 cpukit/include/rtems/imfsimpl.h diff --git a/cpukit/include/rtems/imfs.h b/cpukit/include/rtems/imfs.h index 57c498cfe8..7db9b4e462 100644 --- a/cpukit/include/rtems/imfs.h +++ b/cpukit/include/rtems/imfs.h @@ -3,7 +3,7 @@ /** * @file * - * @brief Header File for the In-Memory File System + * @brief This header file defines the API of the In-Memory File System. */ /* @@ -39,7 +39,6 @@ #include #include -#include /** * @brief In-Memory File System Support. @@ -372,41 +371,6 @@ static inline IMFS_memfile_t *IMFS_iop_to_memfile( const rtems_libio_t *iop ) return (IMFS_memfile_t *) iop->pathinfo.node_access; } -static inline time_t _IMFS_get_time( void ) -{ - struct bintime now; - - /* Use most efficient way to get the time in seconds (CLOCK_REALTIME) */ - _Timecounter_Getbintime( ); - - return now.sec; -} - -static inline void IMFS_update_atime( IMFS_jnode_t *jnode ) -{ - jnode->stat_atime = _IMFS_get_time(); -} - -static inline void IMFS_update_mtime( IMFS_jnode_t *jnode ) -{ - jnode->stat_mtime = _IMFS_get_time(); -} - -static inline void IMFS_update_ctime( IMFS_jnode_t *jnode ) -{ - jnode->stat_ctime = _IMFS_get_time(); -} - -static inline void IMFS_mtime_ctime_update( IMFS_jnode_t *jnode ) -{ - time_t now; - - now = _IMFS_get_time(); - - jnode->stat_mtime = now; - jnode->stat_ctime = now; -} - typedef struct { const IMFS_mknod_control *directory; const IMFS_mknod_control *device; diff --git a/cpukit/include/rtems/imfsimpl.h b/cpukit/include/rtems/imfsimpl.h new file mode 100644 index 00..db1ae32af7 --- /dev/null +++ b/cpukit/include/rtems/imfsimpl.h @@ -0,0 +1,92 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/** + * @file + * + * @brief This header file contains interfaces used by the implementation of + * the In-Memory File System. + */ + +/* + * Copyright (C) 2013, 2018 embedded brains GmbH + * + * 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. + */ + +#ifndef _RTEMS_IMFSIMPL_H +#define _RTEMS_IMFSIMPL_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @addtogroup IMFS + * + * @{ + */ + +static inline time_t _IMFS_get_time( void ) +{ + struct bintime now; + + /* Use most efficient way to get the time in seconds (CLOCK_REALTIME) */ + _Timecounter_Getbintime( ); + + return now.sec; +} + +static inline void IMFS_update_atime( IMFS_jnode_t *jnode ) +{ + jnode->stat_atime = _IMFS_get_time(); +} + +static inline void IMFS_update_mtime( IMFS_jnode_t *jnode ) +{ + jnode->stat_mtime = _IMFS_get_time(); +} + +static inline void IMFS_update_ctime( IMFS_jnode_t *jnode ) +{ + jnode->stat_ctime = _IMFS_get_time(); +} + +static inline void IMFS_mtime_ctime_update( IMFS_jnode_t *jnode ) +{ + time_t now; + + now = _IMFS_get_time(); + + jnode->stat_mtime = now; + jnode->stat_ctime = now; +} + +/** @} */ + +#ifdef
[PATCH 2/2] sptests/spstdc17: New test
--- spec/build/testsuites/sptests/grp.yml | 2 + spec/build/testsuites/sptests/spstdc17.yml | 22 + testsuites/sptests/spstdc17/init.c | 57 ++ testsuites/sptests/spstdc17/spstdc17.doc | 12 + 4 files changed, 93 insertions(+) create mode 100644 spec/build/testsuites/sptests/spstdc17.yml create mode 100644 testsuites/sptests/spstdc17/init.c create mode 100644 testsuites/sptests/spstdc17/spstdc17.doc diff --git a/spec/build/testsuites/sptests/grp.yml b/spec/build/testsuites/sptests/grp.yml index 891a78eb86..c8f70ed13b 100644 --- a/spec/build/testsuites/sptests/grp.yml +++ b/spec/build/testsuites/sptests/grp.yml @@ -394,6 +394,8 @@ links: uid: spsimplesched03 - role: build-dependency uid: spsize +- role: build-dependency + uid: spstdc17 - role: build-dependency uid: spstdthreads01 - role: build-dependency diff --git a/spec/build/testsuites/sptests/spstdc17.yml b/spec/build/testsuites/sptests/spstdc17.yml new file mode 100644 index 00..8c60b0a7fb --- /dev/null +++ b/spec/build/testsuites/sptests/spstdc17.yml @@ -0,0 +1,22 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: +- -std=c17 +- -pedantic +- -Wextra +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: [] +links: [] +source: +- testsuites/sptests/spstdc17/init.c +stlib: [] +target: testsuites/sptests/spstdc17.exe +type: build +use-after: [] +use-before: [] diff --git a/testsuites/sptests/spstdc17/init.c b/testsuites/sptests/spstdc17/init.c new file mode 100644 index 00..0a1a5571ac --- /dev/null +++ b/testsuites/sptests/spstdc17/init.c @@ -0,0 +1,57 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2022 + * + * 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_CONFIG_H +#include "config.h" +#endif + +#include + +#include + +const char rtems_test_name[] = "SPSTDC17"; + +static rtems_task Init( rtems_task_argument arg ) +{ + (void) arg; + + TEST_BEGIN(); + TEST_END(); +} + +#define CONFIGURE_APPLICATION_NEEDS_SIMPLE_CONSOLE_DRIVER +#define CONFIGURE_APPLICATION_DOES_NOT_NEED_CLOCK_DRIVER + +#define CONFIGURE_MAXIMUM_TASKS 1 + +#define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION + +#define CONFIGURE_RTEMS_INIT_TASKS_TABLE + +#define CONFIGURE_INIT + +#include diff --git a/testsuites/sptests/spstdc17/spstdc17.doc b/testsuites/sptests/spstdc17/spstdc17.doc new file mode 100644 index 00..7f83fd9ad3 --- /dev/null +++ b/testsuites/sptests/spstdc17/spstdc17.doc @@ -0,0 +1,12 @@ +This file describes the directives and concepts tested by this test set. + +test set name: spstdc17 + +directives: + + - Header file + - Header file + +concepts: + + - Ensure that the API header files are compatible with the C17 standard. -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: confdefs.h bintime undefined compile error
On 25/07/2022 01:04, Joel Sherrill wrote:> On Sun, Jul 24, 2022 at 11:20 AM Joel Sherrill <mailto:j...@rtems.org>> wrote: Hi Attached is a pretty simple RTEMS application that does not compile when -std=c99 is included on the compile line. arm-rtems6-gcc -B /home/joel/rtems-work/tools/6/bsp-install/arm-rtems6/xilinx_zynq_a9_qemu/lib/ -qrtems -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 -O0 -g -ffunction-sections -fdata-sections -g -Wall -std=c99 -pthread -Wno-nonnull-compare -c /tmp/rtems_config.c -o /tmp/rtems_config.o In file included from /home/joel/rtems-work/tools/6/bsp-install/arm-rtems6/xilinx_zynq_a9_qemu/lib/include/rtems/confdefs/libio.h:135, from /home/joel/rtems-work/tools/6/bsp-install/arm-rtems6/xilinx_zynq_a9_qemu/lib/include/rtems/confdefs.h:70, from /tmp/rtems_config.c:21: /home/joel/rtems-work/tools/6/bsp-install/arm-rtems6/xilinx_zynq_a9_qemu/lib/include/rtems/imfs.h: In function '_IMFS_get_time': /home/joel/rtems-work/tools/6/bsp-install/arm-rtems6/xilinx_zynq_a9_qemu/lib/include/rtems/imfs.h:377:18: error: storage size of 'now' isn't known 377 | struct bintime now; Dropping -std=c99 resolves this. I'm guessing turning on some BSD visibility flag would do the same but it shouldn't be needed. Any ideas for a real fix? Do we have any test cases which ensure the headers compile as C99? All published POSIX versions assume C99. It isn't just c99. C11 and C17 also cause this. It is turning on the "standard" which turns off many extensions. Internally, this header needs to enable BSD extensions. The use of this structure is in _IMFS_get_time() which is an internal IMFS function. I think we need an imfsimpl.h header file for the IMFS implementation. There are too many details exposed to the application configuration. -- 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: [libbsd 00/22] Remove FreeBSD file descriptors and avoid VFS
On 11/07/2022 15:04, Sebastian Huber wrote: On 24/06/2022 08:33, Sebastian Huber wrote: This patch set removes the FreeBSD file descriptors. The VFS is no longer used if only the USB, SD/MMC, network, PCI, and NVMe support is used by the application. This change significantly reduce the memory usage of LibBSD for these applications. Using the media01 test case for the arm/lpc32xx BSP as a benchmark, the heap usage dropped from 14.3MiB to 10.2MiB. The "_BSD bufdaemon", "_BSD vnlru", "_BSD syncer", and "_BSD bufspacedaemon-" tasks are no longer present in media01. The code size is reduced by about 8KiB. The data size is reduced by about 30KiB. The throughput with a simple FTP test increased by about 1%. The "Remove FreeBSD file descriptors" change removes more lines than there are added. This change makes it easier to port the NFS support to the master branch since now the changes are more localized. I have a target with only 8MiB of RAM (for code and data). So, this patch set is not just a micro optimization. This pending patch set is currently a blocker for me. I would like to work on the NTP daemon integration and an update of the libbsd master branch to a more recent FreeBSD version. This patch set just restores what worked well for several years. -- 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: libbsd tests not linking
On 24/07/2022 00:31, Joel Sherrill wrote: Binary file build/arm-rtems6-xilinx_zynq_a9_qemu-default/freebsd/lib/libc/stdio/fgetln.c.12.o matches Binary file build/arm-rtems6-xilinx_zynq_a9_qemu-default/libbsd.a matches b.log:/home/joel/rtems-work/rtems-libbsd/build/arm-rtems6-xilinx_zynq_a9_qemu-default/../../freebsd/lib/libc/stdio/fgetln.c:150: undefined reference to `__getreent' Looks like it is coming from here. freebsd/lib/libc/stdio/local.h:#define __srefill(_x) __srefill_r(__getreent(), _x) Sorry, I forgot to push the fix. It should work now. -- 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: Remove PRIORITY_PSEUDO_ISR thread priority
On 21.07.22 16:20, Joel Sherrill wrote: On Thu, Jul 21, 2022 at 12:53 AM Sebastian Huber <mailto:sebastian.hu...@embedded-brains.de>> wrote: Hello Gedare and Joel, On 15.07.22 10:43, Sebastian Huber wrote: > The uniprocessor schedulers had some special case logic for the > PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR > were allowed to preempt a not preemptible task. If other higher priority task > are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible > task, then the other tasks run before the not preemptible task. This made the > RTEMS_NO_PREEMPT mode ineffective. > > Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the > uniprocessor schedulers. Move the uniprocessor-specific scheduler support to > the new header file . > > Close #2365. I'm guessing that PRIORITY_PSEUDO_ISR wasn't used outside RTEMS itself and likely only historically for the Timer Server Thread. The protection for that thread was reworked as part of the SMP efforts. If it is used outside RTEMS, that would be a user facing breakage and should be documented. If you think all the use cases of PRIORITY_PSEUDO_ISR are accounted for, I'm ok with removing it. The pseudo-interrupt priority is mentioned in a glossary entry: priority boosting A simple approach to extend the priority inheritance protocol for clustered scheduling is priority boosting. In case a mutex is owned by a task of another cluster, then the priority of the owner task is raised to an artificially high priority, the pseudo-interrupt priority. This entry was added for the clustered scheduling documentation and needs to be changed. I found no reference to the no-preempt break of the pseudo-interrupt priority in the documentation. I doubt that there is an application which relies on this extraordinary feature. -- 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
[rtems-docs] user/rsb: Mention --with/without-newlib-tls
Update #4560. --- user/rsb/project-sets.rst | 9 + 1 file changed, 9 insertions(+) diff --git a/user/rsb/project-sets.rst b/user/rsb/project-sets.rst index 54a3f8e..ce839c5 100644 --- a/user/rsb/project-sets.rst +++ b/user/rsb/project-sets.rst @@ -116,6 +116,15 @@ build sets: ``--with-objc`` Attempt to build a C++ compiler. +``--with-newlib-tls`` or ``--without-newlib-tls`` + Enable or disable the ``--enable-newlib-reent-thread-local`` Newlib + configuration option. This option is enabled by default on the aarch64, arm, + nios2, powerpc, riscv, and sparc targets. If this option is enabled, then + each member of the Newlib struct _reent is replaced by a dedicated + thread-local object. The thread-local objects are defined in translation + units which use the corresponding object so that only objects used by the + application are linked in. + The RSB provides build sets for some BSPs. These build sets will build: - Compiler, linker, debugger and RTEMS Tools. -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v2 0/3] Support --enable-newlib-reent-thread-local Newlib configuration option
On 21.07.22 10:36, Chris Johns wrote: On 21/7/2022 6:30 pm, Sebastian Huber wrote: On 21.07.22 10:27, Chris Johns wrote: On 21/7/2022 6:21 pm, Sebastian Huber wrote: On 21.07.22 10:16, Chris Johns wrote: On 21/7/2022 6:11 pm, Sebastian Huber wrote: On 21.07.22 10:03, Chris Johns wrote: As an aside, does gdb know about TLS variables and so will `errno` be visible? Good question, there seems to be some support missing. For example for arm/xilinx_zynq_a9_qemu: Breakpoint 7, Init (ignored=2118804) at /home/EB/sebastian_h/src/rtems/testsuites/samples/fileio/init.c:1169 1169 TEST_BEGIN(); (gdb) watch _tls_errno Cannot find thread-local variables on this target (gdb) p _tls_errno Cannot find thread-local variables on this target I wonder if we need to configure gdb so it understands how we handle TLS variables? It could be a Qemu issue. In GDB there is a /* Check for the TLS register feature. */ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.tls"); However, this is not provided by Qemu. Is this something in the remote protocol? I would have thought the ABI would define the register? Yes, I guess this is a part of the machine description provided by the server (Qemu). This stuff seems to be quite new (from 2022) added by John Baldwin for FreeBSD. That would only apply if qemu was providing the XML description and it is not normally something I have seen. Most of time the built in XML is used. The only packet I could see in a quick look at the protocol is offsets for TLS variables for dynamically loaded object files. This is needed because the link editor allocates the variables when relocating. Maybe this feature is not included in GDB 12 and earlier? -- 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 v2 0/3] Support --enable-newlib-reent-thread-local Newlib configuration option
On 21.07.22 10:27, Chris Johns wrote: On 21/7/2022 6:21 pm, Sebastian Huber wrote: On 21.07.22 10:16, Chris Johns wrote: On 21/7/2022 6:11 pm, Sebastian Huber wrote: On 21.07.22 10:03, Chris Johns wrote: As an aside, does gdb know about TLS variables and so will `errno` be visible? Good question, there seems to be some support missing. For example for arm/xilinx_zynq_a9_qemu: Breakpoint 7, Init (ignored=2118804) at /home/EB/sebastian_h/src/rtems/testsuites/samples/fileio/init.c:1169 1169 TEST_BEGIN(); (gdb) watch _tls_errno Cannot find thread-local variables on this target (gdb) p _tls_errno Cannot find thread-local variables on this target I wonder if we need to configure gdb so it understands how we handle TLS variables? It could be a Qemu issue. In GDB there is a /* Check for the TLS register feature. */ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.tls"); However, this is not provided by Qemu. Is this something in the remote protocol? I would have thought the ABI would define the register? Yes, I guess this is a part of the machine description provided by the server (Qemu). This stuff seems to be quite new (from 2022) added by John Baldwin for FreeBSD. -- 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 v2 0/3] Support --enable-newlib-reent-thread-local Newlib configuration option
On 21.07.22 10:16, Chris Johns wrote: On 21/7/2022 6:11 pm, Sebastian Huber wrote: On 21.07.22 10:03, Chris Johns wrote: As an aside, does gdb know about TLS variables and so will `errno` be visible? Good question, there seems to be some support missing. For example for arm/xilinx_zynq_a9_qemu: Breakpoint 7, Init (ignored=2118804) at /home/EB/sebastian_h/src/rtems/testsuites/samples/fileio/init.c:1169 1169 TEST_BEGIN(); (gdb) watch _tls_errno Cannot find thread-local variables on this target (gdb) p _tls_errno Cannot find thread-local variables on this target I wonder if we need to configure gdb so it understands how we handle TLS variables? It could be a Qemu issue. In GDB there is a /* Check for the TLS register feature. */ feature = tdesc_find_feature (tdesc, "org.gnu.gdb.arm.tls"); However, this is not provided by Qemu. -- 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 v2 0/3] Support --enable-newlib-reent-thread-local Newlib configuration option
On 21.07.22 10:03, Chris Johns wrote: As an aside, does gdb know about TLS variables and so will `errno` be visible? Good question, there seems to be some support missing. For example for arm/xilinx_zynq_a9_qemu: Breakpoint 7, Init (ignored=2118804) at /home/EB/sebastian_h/src/rtems/testsuites/samples/fileio/init.c:1169 1169 TEST_BEGIN(); (gdb) watch _tls_errno Cannot find thread-local variables on this target (gdb) p _tls_errno Cannot find thread-local variables on this target -- 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] 6/7: Update Newlib
This makes the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option available. Update #4560. --- .../config/tools/rtems-gcc-10-newlib-head.cfg | 4 +-- .../tools/rtems-gcc-10.4-newlib-head.cfg | 27 +++ .../config/tools/rtems-gcc-12-newlib-head.cfg | 5 ++-- .../tools/rtems-gcc-head-newlib-head.cfg | 4 +-- 4 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg diff --git a/rtems/config/tools/rtems-gcc-10-newlib-head.cfg b/rtems/config/tools/rtems-gcc-10-newlib-head.cfg index 1d08b61..07f92d1 100644 --- a/rtems/config/tools/rtems-gcc-10-newlib-head.cfg +++ b/rtems/config/tools/rtems-gcc-10-newlib-head.cfg @@ -16,11 +16,11 @@ %patch add newlib -p1 https://devel.rtems.org/raw-attachment/ticket/4510/0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch %hash sha512 0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch 7ca237eabfd5b382713186e1fc290dfc999a353315795ecb8dd0d22fcd1ab7f5bf31f4329954adab91ad04c100dcac0e86d406fdbce8f82cf9dc23842c88caf6 -%define newlib_version 27fd806 +%define newlib_version ea99f21 %define newlib_external 1 %define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version} %source set newlib --rsb-file=newlib-%{newlib_version}.tar.gz https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/%{newlib_version} -%hash sha512 newlib-%{newlib_version}.tar.gz 02fc2a0ffc8bf581f3f98deab582469130cfd6e10983b2be69f9971a326bbc9abedd1e828f990ae69ea984fd5dcad0889345ccab37d83c2f025437f65c53dab6 +%hash sha512 newlib-%{newlib_version}.tar.gz a4216024740c7d5ae6d21a6ab731dcf0bd7a4d70710bc1e79683e7d819812829216df08cd54d0ce7d61c2a959924419ea89367e4c6fb442e59839cacd85d2c52 %define with_threads 1 %define with_plugin 0 diff --git a/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg b/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg new file mode 100644 index 000..270b5ad --- /dev/null +++ b/rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg @@ -0,0 +1,27 @@ +%include %{_configdir}/checks.cfg +%include %{_configdir}/base.cfg + +%define gcc_version 10.4.0 +%source set gcc https://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.xz +%hash sha512 gcc-%{gcc_version}.tar.xz 440c08ca746da450d9a1b35e8fd2305cb27e7e6987cd9d0f7d375f3b1fc9e4b0bd7acb3cd7bf795e72fcbead59cdef5b6c152862f5d35cd9fbfe6902101ce648 + +%patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4196/0001-Back-port-v8-of-gcov-improvements-to-GCC-10.patch +%hash sha512 0001-Back-port-v8-of-gcov-improvements-to-GCC-10.patch c2d1faed68aa0f60bef917365545cc4cc899df428a5d08f178417c06def4fd3cd3a749c1871c8a22552022c29dfae4a3d21161e2b01291e458ea8d670f01887e + +%patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4215/0001-nios2-Remove-custom-instruction-warnings.patch +%hash sha512 0001-nios2-Remove-custom-instruction-warnings.patch afd8a5e6bdcc5b75d5fbbf558bdf56ccac400521a6eec9d88cc95f6be67c481f2dbf8faa0f6ddc1e4ac7c56a84938714d80e46e9cf80ec4b8fcd739986449881 + +%patch add newlib -p1 https://devel.rtems.org/raw-attachment/ticket/4510/0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch +%hash sha512 0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch 7ca237eabfd5b382713186e1fc290dfc999a353315795ecb8dd0d22fcd1ab7f5bf31f4329954adab91ad04c100dcac0e86d406fdbce8f82cf9dc23842c88caf6 + +%define newlib_version ea99f21 +%define newlib_external 1 +%define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version} +%source set newlib --rsb-file=newlib-%{newlib_version}.tar.gz https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/%{newlib_version} +%hash sha512 newlib-%{newlib_version}.tar.gz a4216024740c7d5ae6d21a6ab731dcf0bd7a4d70710bc1e79683e7d819812829216df08cd54d0ce7d61c2a959924419ea89367e4c6fb442e59839cacd85d2c52 + +%define with_threads 1 +%define with_plugin 0 +%define with_iconv 1 + +%include %{_configdir}/gcc-10.cfg diff --git a/rtems/config/tools/rtems-gcc-12-newlib-head.cfg b/rtems/config/tools/rtems-gcc-12-newlib-head.cfg index 167b553..086e93b 100644 --- a/rtems/config/tools/rtems-gcc-12-newlib-head.cfg +++ b/rtems/config/tools/rtems-gcc-12-newlib-head.cfg @@ -38,13 +38,12 @@ KEmxHjYOqY4LTXCMZ3I60tbHusbR5GlnP0CLARHPAnhCnovDj9K3U43C1bsMxDDGRqD6fwtrEFoEgqVFX63IuQ== # Comment above related to #4657 and patches ends here -%define newlib_version 27fd806 +%define newlib_version ea99f21 %define newlib_external 1 %define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version} %source set newlib --rsb-file=newlib-%{newlib_version}.tar.gz \ https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/%{newlib_version} -%hash sha512 newlib-%{newlib_version}.tar.gz \ - AvwqD/yL9YHz+Y3qtYJGkTDP1uEJg7K+afmXGjJrvJq+3R6Cj5kK5p6phP1dytCIk0XMqzfYPC8CVDf2XFPatg== +%hash sha512 newlib-%{newlib_version}.tar.gz
[PATCH v2 3/3] 6/7: Use TLS in Newlib for some targets by default
Use the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option on the aarch64, arm, nios2, powerpc, riscv, and sparc targets by default. Update #4560. --- rtems/config/6/rtems-aarch64.bset | 1 + rtems/config/6/rtems-arm.bset | 1 + rtems/config/6/rtems-nios2.bset | 1 + rtems/config/6/rtems-powerpc.bset | 1 + rtems/config/6/rtems-riscv.bset | 1 + rtems/config/6/rtems-sparc.bset | 1 + rtems/config/7/rtems-aarch64.bset | 1 + rtems/config/7/rtems-arm.bset | 1 + rtems/config/7/rtems-nios2.bset | 1 + rtems/config/7/rtems-powerpc.bset | 1 + rtems/config/7/rtems-riscv.bset | 1 + rtems/config/7/rtems-sparc.bset | 1 + 12 files changed, 12 insertions(+) diff --git a/rtems/config/6/rtems-aarch64.bset b/rtems/config/6/rtems-aarch64.bset index e3c91af..99051eb 100644 --- a/rtems/config/6/rtems-aarch64.bset +++ b/rtems/config/6/rtems-aarch64.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch aarch64 %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-arm.bset b/rtems/config/6/rtems-arm.bset index 425d66b..c4e6613 100644 --- a/rtems/config/6/rtems-arm.bset +++ b/rtems/config/6/rtems-arm.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch arm %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-nios2.bset b/rtems/config/6/rtems-nios2.bset index 522eff5..d45024d 100644 --- a/rtems/config/6/rtems-nios2.bset +++ b/rtems/config/6/rtems-nios2.bset @@ -1,3 +1,4 @@ %define release 1 %define rtems_arch nios2 +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-powerpc.bset b/rtems/config/6/rtems-powerpc.bset index c19327a..3309057 100644 --- a/rtems/config/6/rtems-powerpc.bset +++ b/rtems/config/6/rtems-powerpc.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch powerpc %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-riscv.bset b/rtems/config/6/rtems-riscv.bset index ad7cb5b..ec1ab3a 100644 --- a/rtems/config/6/rtems-riscv.bset +++ b/rtems/config/6/rtems-riscv.bset @@ -1,5 +1,6 @@ %define release 1 %define rtems_arch riscv %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset devel/sis-2-1 diff --git a/rtems/config/6/rtems-sparc.bset b/rtems/config/6/rtems-sparc.bset index 48d152d..809d47e 100644 --- a/rtems/config/6/rtems-sparc.bset +++ b/rtems/config/6/rtems-sparc.bset @@ -1,6 +1,7 @@ %define release 1 %define rtems_arch sparc %define with_libgomp +%define with_newlib_tls %define gdb-disable-sim 1 %include 6/rtems-default.bset devel/sis-2-1 diff --git a/rtems/config/7/rtems-aarch64.bset b/rtems/config/7/rtems-aarch64.bset index fc794aa..d899dc7 100644 --- a/rtems/config/7/rtems-aarch64.bset +++ b/rtems/config/7/rtems-aarch64.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch aarch64 %define with_libgomp +%define with_newlib_tls %include 7/rtems-default.bset diff --git a/rtems/config/7/rtems-arm.bset b/rtems/config/7/rtems-arm.bset index 7518812..a9bd612 100644 --- a/rtems/config/7/rtems-arm.bset +++ b/rtems/config/7/rtems-arm.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch arm %define with_libgomp +%define with_newlib_tls %include 7/rtems-default.bset diff --git a/rtems/config/7/rtems-nios2.bset b/rtems/config/7/rtems-nios2.bset index 735497f..a56aaeb 100644 --- a/rtems/config/7/rtems-nios2.bset +++ b/rtems/config/7/rtems-nios2.bset @@ -1,3 +1,4 @@ %define release 1 %define rtems_arch nios2 +%define with_newlib_tls %include 7/rtems-default.bset diff --git a/rtems/config/7/rtems-powerpc.bset b/rtems/config/7/rtems-powerpc.bset index 3da8841..4438550 100644 --- a/rtems/config/7/rtems-powerpc.bset +++ b/rtems/config/7/rtems-powerpc.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch powerpc %define with_libgomp +%define with_newlib_tls %include 7/rtems-default.bset diff --git a/rtems/config/7/rtems-riscv.bset b/rtems/config/7/rtems-riscv.bset index 441203e..3f81152 100644 --- a/rtems/config/7/rtems-riscv.bset +++ b/rtems/config/7/rtems-riscv.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch riscv %define with_libgomp +%define with_newlib_tls %include 7/rtems-default.bset diff --git a/rtems/config/7/rtems-sparc.bset b/rtems/config/7/rtems-sparc.bset index a147b8f..3c0d8f0 100644 --- a/rtems/config/7/rtems-sparc.bset +++ b/rtems/config/7/rtems-sparc.bset @@ -1,6 +1,7 @@ %define release 1 %define rtems_arch sparc %define with_libgomp +%define with_newlib_tls %define gdb-disable-sim 1 %include 7/rtems-default.bset devel/sis-2-1 -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v2 0/3] Support --enable-newlib-reent-thread-local Newlib configuration option
This patch set adds support for the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option. By default, Newlib uses a huge object of type struct _reent to store thread-specific data. This object is returned by __getreent() if the __DYNAMIC_REENT__ Newlib configuration option is defined. The reentrancy structure contains for example errno and the standard input, output, and error file streams. This means that if an application only uses errno it has a dependency on the file stream support even if it does not use it. This is an issue for lower end targets and applications which need to qualify the software according to safety standards (for example ECSS-E-ST-40C, ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333). If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct _reent is replaced by dedicated thread-local objects for each struct _reent member. The thread-local objects are defined in translation units which use the corresponding object. v2: * Remove i386, microblaze, and m68k from default enabled list. * Support --with-newlib-tls and --without-newlib-tls. Sebastian Huber (3): 6/7: Update Newlib newlib: Support --with/without-newlib-tls 6/7: Use TLS in Newlib for some targets by default rtems/config/6/rtems-aarch64.bset | 1 + rtems/config/6/rtems-arm.bset | 1 + rtems/config/6/rtems-nios2.bset | 1 + rtems/config/6/rtems-powerpc.bset | 1 + rtems/config/6/rtems-riscv.bset | 1 + rtems/config/6/rtems-sparc.bset | 1 + rtems/config/7/rtems-aarch64.bset | 1 + rtems/config/7/rtems-arm.bset | 1 + rtems/config/7/rtems-nios2.bset | 1 + rtems/config/7/rtems-powerpc.bset | 1 + rtems/config/7/rtems-riscv.bset | 1 + rtems/config/7/rtems-sparc.bset | 1 + .../config/tools/rtems-gcc-10-newlib-head.cfg | 4 +-- .../tools/rtems-gcc-10.4-newlib-head.cfg | 27 +++ .../config/tools/rtems-gcc-12-newlib-head.cfg | 5 ++-- .../tools/rtems-gcc-head-newlib-head.cfg | 4 +-- source-builder/config/checks.cfg | 9 +++ source-builder/config/gcc-common-1.cfg| 1 + 18 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 rtems/config/tools/rtems-gcc-10.4-newlib-head.cfg -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v2 2/3] newlib: Support --with/without-newlib-tls
This RSB option defines if the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option is used or not. Update #4560. --- source-builder/config/checks.cfg | 9 + source-builder/config/gcc-common-1.cfg | 1 + 2 files changed, 10 insertions(+) diff --git a/source-builder/config/checks.cfg b/source-builder/config/checks.cfg index 93d4c97..da1c1da 100644 --- a/source-builder/config/checks.cfg +++ b/source-builder/config/checks.cfg @@ -23,6 +23,8 @@ %{?without_java:%define enable_java 0} %{?with_objc:%define enable_objc 1} %{?without_objc:%define enable_objc 0} +%{?with_newlib_tls:%define enable_newlib_tls 1} +%{?without_newlib_tls:%define enable_newlib_tls 0} # # Default to C++ on. @@ -72,3 +74,10 @@ %ifn %{defined enable_obsolete} %define enable_obsolete 0 %endif + +# +# Default to Newlib thread-local storage instead of struct _reent off. +# +%ifn %{defined enable_newlib_tls} + %define enable_newlib_tls 0 +%endif diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg index 694a1f3..0eb032b 100644 --- a/source-builder/config/gcc-common-1.cfg +++ b/source-builder/config/gcc-common-1.cfg @@ -192,6 +192,7 @@ URL: http://gcc.gnu.org/ --enable-version-specific-runtime-libs \ --enable-newlib-io-c99-formats \ %{?disable_MAKEINFO:MAKEINFO=missing} \ +%{?enable_newlib_tls:--enable-newlib-reent-thread-local} \ %{?with_iconv:--enable-newlib-iconv} \ %{?with_iconv:--enable-newlib-iconv-encodings=%{_newlib_iconv_encodings}} \ %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \ -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] score: Remove PRIORITY_PSEUDO_ISR thread priority
Hello Gedare and Joel, On 15.07.22 10:43, Sebastian Huber wrote: The uniprocessor schedulers had some special case logic for the PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR were allowed to preempt a not preemptible task. If other higher priority task are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible task, then the other tasks run before the not preemptible task. This made the RTEMS_NO_PREEMPT mode ineffective. Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the uniprocessor schedulers. Move the uniprocessor-specific scheduler support to the new header file . Close #2365. what is your opinion with respect to this change? It is the second last item on my score TODO list. The last item is: https://lists.rtems.org/pipermail/devel/2022-July/072534.html -- 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] build: Add TLS_MODEL_FLAGS
Update #4560. --- v2: * Do not use -ftls-model=local-exec for targets without TLS support. spec/build/bsps/bspopts.yml | 2 ++ spec/build/bsps/opttlsmodelflags.yml | 28 2 files changed, 30 insertions(+) create mode 100644 spec/build/bsps/opttlsmodelflags.yml diff --git a/spec/build/bsps/bspopts.yml b/spec/build/bsps/bspopts.yml index 4a4c06d321..330be27a83 100644 --- a/spec/build/bsps/bspopts.yml +++ b/spec/build/bsps/bspopts.yml @@ -13,6 +13,8 @@ links: uid: optcpukitoptflags - role: build-dependency uid: opttestoptflags +- role: build-dependency + uid: opttlsmodelflags - role: build-dependency uid: optabi - role: build-dependency diff --git a/spec/build/bsps/opttlsmodelflags.yml b/spec/build/bsps/opttlsmodelflags.yml new file mode 100644 index 00..7d910276b1 --- /dev/null +++ b/spec/build/bsps/opttlsmodelflags.yml @@ -0,0 +1,28 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-append: ABI_FLAGS +build-type: option +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +default: +- -ftls-model=local-exec +default-by-variant: +- value: null + variants: + - bfin/.* + - lm32/.* + - mips/.* + - moxie/.* + - or1k/.* + - sh/.* + - sparc64/.* + - v850/.* +description: | + Defines the compiler flags setting the thread-local storage (TLS) model. The + flags are added to the ABI_FLAGS. +enabled-by: true +links: [] +name: TLS_MODEL_FLAGS +type: build -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] build: Add TLS_MODEL_FLAGS
Update #4560. --- spec/build/bsps/bspopts.yml | 2 ++ spec/build/bsps/opttlsmodelflags.yml | 17 + 2 files changed, 19 insertions(+) create mode 100644 spec/build/bsps/opttlsmodelflags.yml diff --git a/spec/build/bsps/bspopts.yml b/spec/build/bsps/bspopts.yml index 4a4c06d321..330be27a83 100644 --- a/spec/build/bsps/bspopts.yml +++ b/spec/build/bsps/bspopts.yml @@ -13,6 +13,8 @@ links: uid: optcpukitoptflags - role: build-dependency uid: opttestoptflags +- role: build-dependency + uid: opttlsmodelflags - role: build-dependency uid: optabi - role: build-dependency diff --git a/spec/build/bsps/opttlsmodelflags.yml b/spec/build/bsps/opttlsmodelflags.yml new file mode 100644 index 00..d61afaa1f2 --- /dev/null +++ b/spec/build/bsps/opttlsmodelflags.yml @@ -0,0 +1,17 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-string: null +- split: null +- env-append: ABI_FLAGS +build-type: option +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +default: +- -ftls-model=local-exec +default-by-variant: [] +description: | + Defines the compiler flags setting the thread-local storage (TLS) model. +enabled-by: true +links: [] +name: TLS_MODEL_FLAGS +type: build -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [RSB 1/3] 6/7: Update Newlib
On 20.07.22 22:52, Chris Johns wrote: On 20/7/2022 6:20 pm, Sebastian Huber wrote: On 20/07/2022 10:11, Chris Johns wrote: Are these TLS allocations in newlib based on a single use of a newlib call that brings in the reent stuff? How does that work? No, each TLS object is defined in the translation unit which uses the object. The goal is to get only those objects linked in which are needed. Currently, the Newlib thread delete hook pulls in some objects, however, this dependency will go away once the TLS destructors are implemented. If I have task A and it opens a file and writes something to a file system will it pull in the TLS support for files? Yes. Given the TLS support is static does this mean all threads in the A app allocate the newlib file TLS variables even if they never use newlib? Yes. My understanding of the existing reent support is tasks that do not use newlib it never allocate a reent struct? No, the struct _reent is allocated for all tasks if you don't use CONFIGURE_DISABLE_NEWLIB_REENTRANCY (which is not recommended). How would you know if a task doesn't use Newlib? I thought the get would do a check and then allocate on first use. It has been many years since I looked at the implementation. I think this change is a good one because it will reduce the needed memory to the amount used and it will have better performance. I think option you post is a good thing to add, maybe as --enable-newlib-reent-tls. What will be the default? You mean a proper sb-set-builder option and not just a --with-newlib-tls? I would make it the default for the targets with known to work TLS support: aarch64, arm, nios2, powerpc, riscv, and sparc. For m68k we have a GCC code generation issue currently. -- 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 v2] aarch64: Use page table level 0
On 20.07.22 15:43, Kinsey Moore wrote: This alters the AArch64 page table generation and mapping code and MMU configuration to use page table level 0 in addition to levels 1, 2, and 3. This allows the mapping of up to 48 bits of memory space and is the maximum that can be mapped without relying on additional processor extensions. Mappings are restricted based on the number of physical address bits that the CPU supports. Looks good. -- 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] sptls04: Test an external TLS object
--- spec/build/testsuites/sptests/sptls04.yml | 1 + testsuites/sptests/sptls04/init.c | 9 +++-- testsuites/sptests/sptls04/sptls04.h | 41 +++ testsuites/sptests/sptls04/tls.c | 34 +++ 4 files changed, 82 insertions(+), 3 deletions(-) create mode 100644 testsuites/sptests/sptls04/sptls04.h create mode 100644 testsuites/sptests/sptls04/tls.c diff --git a/spec/build/testsuites/sptests/sptls04.yml b/spec/build/testsuites/sptests/sptls04.yml index 8243fb81b9..ed2cf1c3e1 100644 --- a/spec/build/testsuites/sptests/sptls04.yml +++ b/spec/build/testsuites/sptests/sptls04.yml @@ -12,6 +12,7 @@ ldflags: [] links: [] source: - testsuites/sptests/sptls04/init.c +- testsuites/sptests/sptls04/tls.c stlib: [] target: testsuites/sptests/sptls04.exe type: build diff --git a/testsuites/sptests/sptls04/init.c b/testsuites/sptests/sptls04/init.c index fad919f8ac..79ab5a5a9a 100644 --- a/testsuites/sptests/sptls04/init.c +++ b/testsuites/sptests/sptls04/init.c @@ -9,7 +9,7 @@ /* * This test program runs also on GNU/Linux and FreeBSD. Use * - * cc init.c && ./a.out + * cc init.c tls.c && ./a.out * * to run it. */ @@ -18,6 +18,8 @@ #include "config.h" #endif +#include "sptls04.h" + #ifdef __rtems__ #include @@ -30,9 +32,9 @@ #endif /* __rtems__ */ -static __thread int i; +static _Thread_local int i; -static __thread int j; +static _Thread_local int j; static __attribute__((__constructor__)) void con(void) { @@ -43,6 +45,7 @@ static void test(void) { rtems_test_assert(i == 1); rtems_test_assert(j == 0); + rtems_test_assert(k == 2); } #ifdef __rtems__ diff --git a/testsuites/sptests/sptls04/sptls04.h b/testsuites/sptests/sptls04/sptls04.h new file mode 100644 index 00..9aa737ecb0 --- /dev/null +++ b/testsuites/sptests/sptls04/sptls04.h @@ -0,0 +1,41 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/* + * Copyright (C) 2022 embedded brains GmbH + * + * 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. + */ + +#ifndef _SPTLS01_H +#define _SPTLS01_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern _Thread_local int k; + +#ifdef __cplusplus +} +#endif + +#endif /* _SPTLS01_H */ diff --git a/testsuites/sptests/sptls04/tls.c b/testsuites/sptests/sptls04/tls.c new file mode 100644 index 00..ce91518fd0 --- /dev/null +++ b/testsuites/sptests/sptls04/tls.c @@ -0,0 +1,34 @@ +/* SPDX-License-Identifier: BSD-2-Clause */ + +/* + * Copyright (C) 2022 embedded brains GmbH + * + * 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)
Re: [RSB 1/3] 6/7: Update Newlib
On 20/07/2022 10:11, Chris Johns wrote: There seems to be an issue with i386: 08:09:56 runner ['/opt/rtems/6/bin/rtems-ld', '-C', '/opt/rtems/6/bin/i386-rtems6-gcc', '-c', '-MMD -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -mtune=pentiumpro -march=pentium', '-O', 'rap', '-b', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06.pre', '-e', 'rtems_main', '-s', '-o', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06.rap', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06-o1.o', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06-o2.o', '-lm'] error: libc.a:libc_a-lcong48.o@922544: symbol not found:_GLOBAL_OFFSET_TABLE_> I will remove i386 from the patch. Good idea. We should only move those we know work. This error surfaced a GCC configuration issue for RTEMS. The problem is that the default TLS model should be local-exec for RTEMS. In this case, the GOT is not used. I have to check how this can be done in GCC. -- 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: [RSB 1/3] 6/7: Update Newlib
On 20/07/2022 10:11, Chris Johns wrote: Are these TLS allocations in newlib based on a single use of a newlib call that brings in the reent stuff? How does that work? No, each TLS object is defined in the translation unit which uses the object. The goal is to get only those objects linked in which are needed. Currently, the Newlib thread delete hook pulls in some objects, however, this dependency will go away once the TLS destructors are implemented. If I have task A and it opens a file and writes something to a file system will it pull in the TLS support for files? Yes. Given the TLS support is static does this mean all threads in the A app allocate the newlib file TLS variables even if they never use newlib? Yes. My understanding of the existing reent support is tasks that do not use newlib it never allocate a reent struct? No, the struct _reent is allocated for all tasks if you don't use CONFIGURE_DISABLE_NEWLIB_REENTRANCY (which is not recommended). How would you know if a task doesn't use Newlib? -- 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: [RSB 1/3] 6/7: Update Newlib
On 20/07/2022 02:24, Chris Johns wrote: On 19/7/2022 5:18 pm, Sebastian Huber wrote: On 13/07/2022 11:24, Sebastian Huber wrote: This makes the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option available. Any comments with respect to using the Newlib thread-local storage configuration option for arm, i386, microblaze, nios2, powerpc, riscv, and sparc? Do these archs have working TLS support? It seems Microblaze has issues which our tests are not picking up. It would be good to know why our tests are not picking up the reported problem. There seems to be an issue with i386: 08:09:56 runner ['/opt/rtems/6/bin/rtems-ld', '-C', '/opt/rtems/6/bin/i386-rtems6-gcc', '-c', '-MMD -Wall -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs -mtune=pentiumpro -march=pentium', '-O', 'rap', '-b', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06.pre', '-e', 'rtems_main', '-s', '-o', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06.rap', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06-o1.o', '/tmp/sh/b-rtems/i386/pc686/testsuites/libtests/dl06/dl06-o2.o', '-lm'] error: libc.a:libc_a-lcong48.o@922544: symbol not found: _GLOBAL_OFFSET_TABLE_ I will remove i386 from the patch. I can't say much about the microblaze. Which archs in the list have you run the testsuite on? I did test runs with simulators on aarch64, arm, powerpc, riscv, and sparc. Has any of newlib's tests been run? Can we run newlib tests? Are there Newlib tests? We added a newlib01 test which tests some Newlib details. Did the switch to TLS exceptions end up on 6? I cannot see anything in the RSB commit history mentioning it. No, I wait for your feedback. Here is a back port from GCC 13 to GCC 12: https://lists.rtems.org/pipermail/devel/2022-July/072555.html Are these TLS allocations in newlib based on a single use of a newlib call that brings in the reent stuff? How does that work? No, each TLS object is defined in the translation unit which uses the object. The goal is to get only those objects linked in which are needed. Currently, the Newlib thread delete hook pulls in some objects, however, this dependency will go away once the TLS destructors are implemented. Does this change effect libdl users? TLS has not been implemented in libdl and the current reent model still works for those users dependent on libdl It could affect libdl users. Can you load parts of libc.a with libdl? The libdl users could add TLS support or disable the Newlib configuration option. To disable the options, we probably need an RSB --without-newlib-tls support or use something like --with-newlib-tls=yes or --with-newlib-tls=no. On powerpc/psim for example I get an error like this in dl06: ] load: /dl06.rap ] dlopen failed: global symbol not found: _tls_rand48_add -- 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] aarch64: Use page table level 0
On 19/07/2022 18:58, Kinsey Moore wrote: + if ( begin >= max_mappable || end > max_mappable ) { +rtems_fatal_error_occurred( RTEMS_INVALID_ADDRESS ); + } Such a fatal error is not really helpful, since you cannot get the error location from the fatal source/code pair. I would add a new code for bsp_fatal() and use this function. Alternatively, we could add a new fatal error source which uses the link register or the source code file/line for generic fatal errors. -- 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: Possible tls bug on arm / microblaze
On 19/07/2022 20:10, Sam Price wrote: Where would the ti->offset member be updated / initialized at? The caller of __tls_get_addr() has to do this. On ARM, this is function is normally not used. -- 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: Possible tls bug on arm / microblaze
On 19/07/2022 14:51, Sam Price wrote: On microblaze i was getting a ESR: Unaligned data access exception I narrowed this down to this "ti->offset;" being uninitialized in the following two bsps https://git.rtems.org/rtems/tree/cpukit/score/cpu/microblaze/__tls_get_addr.c <https://git.rtems.org/rtems/tree/cpukit/score/cpu/microblaze/__tls_get_addr.c> Also this file cpukit/score/cpu/arm/__tls_get_addr.c I tried recompiling with this on the microblaze build with offset being renamed to offseta. This only caused a compilation error in the __tls_get_addr function. So I think this variable is being used without being initialized or ever changed. Is it safe to just remove the offset variable? No, it is not safe to remove the offset member. The offset member value is provided by the caller of __tls_get_addr(). You have to check that TLS_Index definition matches the GCC ABI. Do the sptls* tests run on your system? -- 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: [Feedback needed] Proposal for ADC API
Hello, we should also consider to use existing APIs and implementations for stuff we do not yet have in RTEMS, for example: https://docs.zephyrproject.org/latest/hardware/peripherals/adc.html The Zephyr project uses device trees to statically configure device drivers: https://docs.zephyrproject.org/latest/build/dts/index.html This is quite interesting for lower end targets. -- 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] score: Use PTHREAD_CANCELED for _Thread_Cancel()
The rtems_task_delete() directive is basically just a combined pthread_cancel() and pthread_join(). In addition, it removes the PTHREAD_DETACHED state. The exit value returned by pthread_join() of threads cancelled by rtems_task_delete() should reflect this by getting a PTHREAD_CANCELED value and instead of NULL. Close #4680. --- cpukit/include/rtems/score/threadimpl.h | 5 + cpukit/posix/src/cancel.c | 2 +- cpukit/score/src/threadrestart.c| 10 +- testsuites/psxtests/psx08/init.c| 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/cpukit/include/rtems/score/threadimpl.h b/cpukit/include/rtems/score/threadimpl.h index e6e77b195c..638815237f 100644 --- a/cpukit/include/rtems/score/threadimpl.h +++ b/cpukit/include/rtems/score/threadimpl.h @@ -429,14 +429,11 @@ typedef enum { * @param[in, out] life_states_to_clear is the set of thread life states to * clear for the thread to cancel. - - * @param exit_value is the exit value for the thread to cancel. */ Thread_Cancel_state _Thread_Cancel( Thread_Control *the_thread, Thread_Control *executing, - Thread_Life_state life_states_to_clear, - void *exit_value + Thread_Life_state life_states_to_clear ); /** diff --git a/cpukit/posix/src/cancel.c b/cpukit/posix/src/cancel.c index 0fb2199f0a..1ccfe75b0b 100644 --- a/cpukit/posix/src/cancel.c +++ b/cpukit/posix/src/cancel.c @@ -75,7 +75,7 @@ int pthread_cancel( pthread_t thread ) } else { _Thread_Dispatch_disable_with_CPU( cpu_self, _context ); _ISR_lock_ISR_enable( _context ); -(void) _Thread_Cancel( the_thread, executing, 0, PTHREAD_CANCELED ); +(void) _Thread_Cancel( the_thread, executing, 0 ); _Thread_Dispatch_enable( cpu_self ); } return 0; diff --git a/cpukit/score/src/threadrestart.c b/cpukit/score/src/threadrestart.c index e1911beb2b..584cfa5d8b 100644 --- a/cpukit/score/src/threadrestart.c +++ b/cpukit/score/src/threadrestart.c @@ -55,6 +55,8 @@ #include #include +#include + #define THREAD_JOIN_TQ_OPERATIONS &_Thread_queue_Operations_priority_inherit static void _Thread_Life_action_handler( @@ -433,8 +435,7 @@ static void _Thread_Try_life_change_request( Thread_Cancel_state _Thread_Cancel( Thread_Control *the_thread, Thread_Control *executing, - Thread_Life_state life_states_to_clear, - void *exit_value + Thread_Life_state life_states_to_clear ) { ISR_lock_Context lock_context; @@ -444,7 +445,7 @@ Thread_Cancel_state _Thread_Cancel( _Thread_State_acquire( the_thread, _context ); - _Thread_Set_exit_value( the_thread, exit_value ); + _Thread_Set_exit_value( the_thread, PTHREAD_CANCELED ); previous = _Thread_Change_life_locked( the_thread, life_states_to_clear, @@ -476,8 +477,7 @@ Status_Control _Thread_Close( ); _ISR_lock_ISR_enable( _context->Lock_context.Lock_context ); - cancel_state = -_Thread_Cancel( the_thread, executing, THREAD_LIFE_DETACHED, NULL ); + cancel_state = _Thread_Cancel( the_thread, executing, THREAD_LIFE_DETACHED ); if ( cancel_state == THREAD_CANCEL_DONE ) { _Thread_Dispatch_enable( cpu_self ); diff --git a/testsuites/psxtests/psx08/init.c b/testsuites/psxtests/psx08/init.c index 1caf9aa537..56124f4e23 100644 --- a/testsuites/psxtests/psx08/init.c +++ b/testsuites/psxtests/psx08/init.c @@ -144,7 +144,7 @@ static void test_delete_deadlock( void ) value = NULL; eno = pthread_join( ctx.protected_join, ); rtems_test_assert( eno == 0 ); - rtems_test_assert( value == NULL ); + rtems_test_assert( value == PTHREAD_CANCELED ); rtems_test_assert( ctx.delete_status == RTEMS_INCORRECT_STATE ); } -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [RSB 1/3] 6/7: Update Newlib
On 13/07/2022 11:24, Sebastian Huber wrote: This makes the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option available. Any comments with respect to using the Newlib thread-local storage configuration option for arm, i386, microblaze, nios2, powerpc, riscv, and sparc? I was a bit of work to add this Newlib option (about 50 patches). -- 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
[RTEMS 5 1/2] score: Fix _Objects_Active_count()
With unlimited objects the object maximum may be larger than the sum of active and inactive objects. Update #4676. --- cpukit/score/src/objectactivecount.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cpukit/score/src/objectactivecount.c b/cpukit/score/src/objectactivecount.c index c658fc21e3..12c15147c7 100644 --- a/cpukit/score/src/objectactivecount.c +++ b/cpukit/score/src/objectactivecount.c @@ -24,14 +24,22 @@ Objects_Maximum _Objects_Active_count( const Objects_Information *information ) { - Objects_Maximum inactive; - Objects_Maximum maximum; + Objects_Maximum active; + Objects_Maximum index; + Objects_Maximum maximum; + Objects_Control **local_table; _Assert( _Objects_Allocator_is_owner() ); - inactive = (Objects_Maximum) -_Chain_Node_count_unprotected( >Inactive ); + active = 0; maximum = _Objects_Get_maximum_index( information ); + local_table = information->local_table; - return maximum - inactive; + for ( index = 0; index < maximum; ++index ) { +if ( local_table[ index ] != NULL ) { + ++active; +} + } + + return active; } -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RTEMS 5 2/2] score: Fix unlimited objects support
Commit 21275b58a5a69c3c838082ffc8a7a3641f32ea9a ("score: Static Objects_Information initialization") introduced an off-by-one error in the maintenance of inactive objects. Close #4676. --- cpukit/include/rtems/score/objectimpl.h | 29 + cpukit/score/src/objectfree.c | 12 +- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h index c540f90166..ed0ce2aa10 100644 --- a/cpukit/include/rtems/score/objectimpl.h +++ b/cpukit/include/rtems/score/objectimpl.h @@ -937,6 +937,25 @@ RTEMS_INLINE_ROUTINE void _Objects_Free( ( *information->deallocate )( information, the_object ); } +/** + * @brief Returns true, if the object associated with the zero-based index is + * contained in an allocated block of objects, otherwise false. + * + * @param index is the zero-based object index. + * @param objects_per_block is the object count per block. + * + * @retval true The object associated with the zero-based index is in an + * allocated block of objects. + * @retval false Otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Objects_Is_in_allocated_block( + Objects_Maximum index, + Objects_Maximum objects_per_block +) +{ + return index >= objects_per_block; +} + /** * @brief Activate the object. * @@ -952,15 +971,17 @@ RTEMS_INLINE_ROUTINE void _Objects_Activate_unlimited( ) { Objects_Maximum objects_per_block; - Objects_Maximum block; + Objects_Maximum index; _Assert( _Objects_Is_auto_extend( information ) ); objects_per_block = information->objects_per_block; - block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; + index = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; + + if ( _Objects_Is_in_allocated_block( index, objects_per_block ) ) { +Objects_Maximum block; - if ( block > objects_per_block ) { -block /= objects_per_block; +block = index / objects_per_block; information->inactive_per_block[ block ]--; information->inactive--; diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c index 1f7aa37e3f..964adbc62a 100644 --- a/cpukit/score/src/objectfree.c +++ b/cpukit/score/src/objectfree.c @@ -30,14 +30,16 @@ void _Objects_Free_unlimited( if ( _Objects_Is_auto_extend( information ) ) { Objects_Maximum objects_per_block; -Objects_Maximum block; -Objects_Maximum inactive; +Objects_Maximum index; objects_per_block = information->objects_per_block; -block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; +index = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; -if ( block > objects_per_block ) { - block /= objects_per_block; +if ( _Objects_Is_in_allocated_block( index, objects_per_block ) ) { + Objects_Maximum block; + Objects_Maximum inactive; + + block = index / objects_per_block; ++information->inactive_per_block[ block ]; -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH v3 1/2] bsp/riscv: Work area size based on stack pointer
On 14.07.22 16:03, Daniel Cederman wrote: diff --git a/bsps/riscv/shared/start/start.S b/bsps/riscv/shared/start/start.S index 3702f8ac2f..21945a99f5 100644 --- a/bsps/riscv/shared/start/start.S +++ b/bsps/riscv/shared/start/start.S @@ -35,6 +35,16 @@ #include #include +#if __riscv_xlen == 32 +#define PTR_ALIGN 2 +#define PTR_SIZE 4 +#define PTR_VALUE .word +#elif __riscv_xlen == 64 +#define PTR_ALIGN 3 +#define PTR_SIZE 8 +#define PTR_VALUE .dword +#endif Maybe this should move to asm.h. + PUBLIC(_start) .section .bsp_start_text, "wax", @progbits @@ -60,6 +70,9 @@ SYM(_start): LADDR t0, _RISCV_Exception_handler csrwmtvec, t0 + /* Save stack pointer so it can mark end of work area later on */ + mv t3, sp + /* Load stack pointer and branch to secondary processor start if necessary */ #ifdef RTEMS_SMP LADDR sp, _ISR_Stack_area_begin @@ -75,6 +88,9 @@ SYM(_start): LADDR sp, _ISR_Stack_area_end #endif + LADDR t0, riscv_start_stack_pointer + SREGt3, 0(t0) + #ifdef BSP_START_COPY_FDT_FROM_U_BOOT mv a0, a1 callbsp_fdt_copy @@ -146,3 +162,12 @@ SYM(_start): #endif #endif /* RTEMS_SMP */ + + .section.data, "aw" This should be .bsp_start_data + .align PTR_ALIGN + + .globl riscv_start_stack_pointer + .type riscv_start_stack_pointer, @object + .size riscv_start_stack_pointer, PTR_SIZE +riscv_start_stack_pointer: + PTR_VALUE 0 -- 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 v3 1/2] bsp/riscv: Work area size based on stack pointer
On 14.07.22 16:03, Daniel Cederman wrote: +/* + * This variable is initialized by the first CPU entering the BSP start code. + * The value is the stack pointer at entry. + */ +extern uintptr_t riscv_start_stack_pointer; Since C code should not modify this, maybe declare it as const. -- 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 v3 2/2] bsp/riscv: Add NOEL-V BSP
On 14.07.22 16:03, Daniel Cederman wrote: diff --git a/spec/build/bsps/riscv/noel/optconirq.yml b/spec/build/bsps/riscv/noel/optconirq.yml new file mode 100644 index 00..d836822efb --- /dev/null +++ b/spec/build/bsps/riscv/noel/optconirq.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- define: null +build-type: option +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +default: 0 +default-by-variant: [] +description: | + The APBUART console driver can operate in either polled or interrupt mode. +enabled-by: true +format: '{}' +links: [] +name: CONSOLE_USE_INTERRUPTS +type: build Please use spec/build/bsps/optconsoleirq.yml diff --git a/spec/build/bsps/riscv/noel/optextirqmax.yml b/spec/build/bsps/riscv/noel/optextirqmax.yml new file mode 100644 index 00..ffa84748b6 --- /dev/null +++ b/spec/build/bsps/riscv/noel/optextirqmax.yml @@ -0,0 +1,16 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +actions: +- get-integer: null +- define: null +build-type: option +copyrights: +- Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de) +default: 64 +default-by-variant: [] +description: | + maximum number of external interrupts supported by the BSP (default 64) +enabled-by: true +format: '{}' +links: [] +name: RISCV_MAXIMUM_EXTERNAL_INTERRUPTS +type: build Please move this one level up and reuse it in the other riscv BSPs. -- 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] score: Remove PRIORITY_PSEUDO_ISR thread priority
The uniprocessor schedulers had some special case logic for the PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR were allowed to preempt a not preemptible task. If other higher priority task are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible task, then the other tasks run before the not preemptible task. This made the RTEMS_NO_PREEMPT mode ineffective. Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the uniprocessor schedulers. Move the uniprocessor-specific scheduler support to the new header file . Close #2365. --- cpukit/include/rtems/posix/priorityimpl.h | 2 +- cpukit/include/rtems/score/priority.h | 7 - cpukit/include/rtems/score/scheduleredfimpl.h | 19 +- cpukit/include/rtems/score/schedulerimpl.h| 65 -- .../rtems/score/schedulerpriorityimpl.h | 30 +-- .../include/rtems/score/schedulersimpleimpl.h | 22 +- cpukit/include/rtems/score/scheduleruniimpl.h | 221 ++ cpukit/rtems/src/timerserver.c| 2 +- cpukit/score/src/mpci.c | 2 +- cpukit/score/src/scheduleredfblock.c | 4 +- cpukit/score/src/scheduleredfchangepriority.c | 5 +- cpukit/score/src/scheduleredfschedule.c | 5 +- cpukit/score/src/scheduleredfunblock.c| 20 +- cpukit/score/src/scheduleredfyield.c | 2 +- cpukit/score/src/schedulerpriorityblock.c | 4 +- .../src/schedulerprioritychangepriority.c | 5 +- cpukit/score/src/schedulerpriorityschedule.c | 5 +- cpukit/score/src/schedulerpriorityunblock.c | 16 +- cpukit/score/src/schedulerpriorityyield.c | 5 +- cpukit/score/src/schedulersimpleblock.c | 4 +- .../score/src/schedulersimplechangepriority.c | 5 +- cpukit/score/src/schedulersimpleschedule.c| 5 +- cpukit/score/src/schedulersimpleunblock.c | 20 +- cpukit/score/src/schedulersimpleyield.c | 5 +- spec/build/cpukit/librtemscpu.yml | 1 + testsuites/sptests/sptasknopreempt01/init.c | 18 +- 26 files changed, 295 insertions(+), 204 deletions(-) create mode 100644 cpukit/include/rtems/score/scheduleruniimpl.h diff --git a/cpukit/include/rtems/posix/priorityimpl.h b/cpukit/include/rtems/posix/priorityimpl.h index e391448372..ce26787294 100644 --- a/cpukit/include/rtems/posix/priorityimpl.h +++ b/cpukit/include/rtems/posix/priorityimpl.h @@ -84,7 +84,7 @@ RTEMS_INLINE_ROUTINE int _POSIX_Priority_Get_maximum( * Thus, SuperCore has priorities run in the opposite sense of the POSIX API. * * Let N be the maximum priority of this scheduler instance. The SuperCore - * priority zero is system reserved (PRIORITY_PSEUDO_ISR). There are only + * priority zero is system reserved (PRIORITY_MINIMUM). There are only * N - 1 POSIX API priority levels since a thread at SuperCore priority N would * never run because of the idle threads. This is necessary because GNAT maps * the lowest Ada task priority to the lowest thread priority. The lowest diff --git a/cpukit/include/rtems/score/priority.h b/cpukit/include/rtems/score/priority.h index 568e3c4e3e..6f6cc12bac 100644 --- a/cpukit/include/rtems/score/priority.h +++ b/cpukit/include/rtems/score/priority.h @@ -95,13 +95,6 @@ typedef uint64_t Priority_Control; */ #define PRIORITY_MINIMUM 0 -/** - * @brief The priority value of pseudo-ISR threads. - * - * Examples are the MPCI and timer server threads. - */ -#define PRIORITY_PSEUDO_ISR PRIORITY_MINIMUM - /** * @brief The default lowest (least important) thread priority value. * diff --git a/cpukit/include/rtems/score/scheduleredfimpl.h b/cpukit/include/rtems/score/scheduleredfimpl.h index e0a07a8915..06a35ae95f 100644 --- a/cpukit/include/rtems/score/scheduleredfimpl.h +++ b/cpukit/include/rtems/score/scheduleredfimpl.h @@ -39,7 +39,7 @@ #define _RTEMS_SCORE_SCHEDULEREDFIMPL_H #include -#include +#include #ifdef __cplusplus extern "C" { @@ -216,30 +216,23 @@ RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Extract_body( } /** - * @brief Schedules the next ready thread as the heir. + * @brief Gets the highest priority ready thread of the scheduler. * - * @param scheduler The scheduler instance to schedule the minimum of the context of. - * @param the_thread This parameter is not used. - * @param force_dispatch Indicates whether the current heir is blocked even if it is - * not set as preemptible. + * @param scheduler is the scheduler. */ -RTEMS_INLINE_ROUTINE void _Scheduler_EDF_Schedule_body( - const Scheduler_Control *scheduler, - Thread_Control *the_thread, - bool force_dispatch +RTEMS_INLINE_ROUTINE Thread_Control *_Scheduler_EDF_Get_highest_ready( + const Scheduler_Control *scheduler ) { Scheduler_EDF_Context *context; RBTree_Node *first; Scheduler_EDF_Node*node; - (void) the_thread; - context = _Scheduler_EDF_Get_context( scheduler ); first =
[PATCH v2 1/3] bsps: Sort .noinit* sections
Sort the .noinit* input sections by name first, then by alignment if two sections have the same name. This allows the placement of begin/end symbols to initialize some areas with a special value. Update #4678. --- bsps/aarch64/shared/start/linkcmds.base | 2 +- bsps/arm/shared/start/linkcmds.base | 2 +- bsps/bfin/TLL6527M/start/linkcmds| 2 +- bsps/bfin/bf537Stamp/start/linkcmds | 2 +- bsps/bfin/eZKit533/start/linkcmds| 2 +- bsps/i386/pc386/start/linkcmds | 2 +- bsps/lm32/lm32_evr/start/linkcmds| 2 +- bsps/lm32/milkymist/start/linkcmds | 2 +- bsps/m68k/av5282/start/linkcmds | 2 +- bsps/m68k/av5282/start/linkcmdsflash | 2 +- bsps/m68k/av5282/start/linkcmdsram | 2 +- bsps/m68k/csb360/start/linkcmds | 2 +- bsps/m68k/gen68340/start/linkcmds| 2 +- bsps/m68k/gen68360/start/linkcmds| 2 +- bsps/m68k/gen68360/start/linkcmds.bootp | 2 +- bsps/m68k/gen68360/start/linkcmds.prom | 2 +- bsps/m68k/mcf5206elite/start/linkcmds| 2 +- bsps/m68k/mcf5206elite/start/linkcmds.flash | 2 +- bsps/m68k/mcf52235/start/linkcmds| 2 +- bsps/m68k/mcf5225x/start/linkcmds| 2 +- bsps/m68k/mcf5235/start/linkcmds | 2 +- bsps/m68k/mcf5235/start/linkcmdsflash| 2 +- bsps/m68k/mcf5235/start/linkcmdsram | 2 +- bsps/m68k/mcf5329/start/linkcmds | 2 +- bsps/m68k/mcf5329/start/linkcmdsflash| 2 +- bsps/m68k/mrm332/start/linkcmds | 2 +- bsps/m68k/shared/start/linkcmds.base | 2 +- bsps/m68k/uC5282/start/linkcmds | 2 +- bsps/mips/csb350/start/linkcmds | 2 +- bsps/mips/hurricane/start/linkcmds | 2 +- bsps/mips/jmr3904/start/linkcmds | 2 +- bsps/mips/malta/start/linkcmds | 2 +- bsps/mips/rbtx4925/start/linkcmds| 2 +- bsps/mips/rbtx4938/start/linkcmds| 2 +- bsps/moxie/moxiesim/start/linkcmds | 2 +- bsps/nios2/nios2_iss/start/linkcmds | 2 +- bsps/or1k/shared/start/linkcmds.base | 2 +- bsps/powerpc/gen5200/start/linkcmds.gen5200_base | 2 +- bsps/powerpc/mpc8260ads/start/linkcmds | 2 +- bsps/powerpc/shared/start/linkcmds.base | 2 +- bsps/powerpc/shared/start/linkcmds.share | 2 +- bsps/powerpc/ss555/start/linkcmds| 2 +- bsps/powerpc/virtex4/start/linkcmds | 2 +- bsps/powerpc/virtex5/start/linkcmds | 2 +- bsps/sh/gensh1/start/linkcmds| 2 +- bsps/sh/gensh2/start/linkcmds| 2 +- bsps/sh/gensh2/start/linkcmds.ram| 2 +- bsps/sh/gensh2/start/linkcmds.rom| 2 +- bsps/sh/gensh4/start/linkcmds| 2 +- bsps/sh/gensh4/start/linkcmds.rom| 2 +- bsps/sh/gensh4/start/linkcmds.rom2ram| 2 +- bsps/sh/shsim/start/linkcmds | 2 +- bsps/sparc/shared/start/linkcmds.base| 2 +- bsps/sparc64/shared/start/linkcmds | 2 +- bsps/v850/gdbv850sim/start/linkcmds | 2 +- bsps/x86_64/amd64/start/linkcmds | 2 +- 56 files changed, 56 insertions(+), 56 deletions(-) diff --git a/bsps/aarch64/shared/start/linkcmds.base b/bsps/aarch64/shared/start/linkcmds.base index d3b5485777..bcdf4715d7 100644 --- a/bsps/aarch64/shared/start/linkcmds.base +++ b/bsps/aarch64/shared/start/linkcmds.base @@ -323,7 +323,7 @@ SECTIONS { .noinit (NOLOAD) : ALIGN_WITH_INPUT { bsp_section_noinit_begin = .; - *(.noinit*) + *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*))) bsp_section_noinit_end = .; } > REGION_WORK AT > REGION_WORK bsp_section_noinit_size = bsp_section_noinit_end - bsp_section_noinit_begin; diff --git a/bsps/arm/shared/start/linkcmds.base b/bsps/arm/shared/start/linkcmds.base index 10d2c54028..c9cf360ee7 100644 --- a/bsps/arm/shared/start/linkcmds.base +++ b/bsps/arm/shared/start/linkcmds.base @@ -334,7 +334,7 @@ SECTIONS { .noinit (NOLOAD) : ALIGN_WITH_INPUT { bsp_section_noinit_begin = .; - *(.noinit*) + *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*))) bsp_section_noinit_end = .; } > REGION_WORK AT > REGION_WORK bsp_section_noinit_size = bsp_section_noinit_end - bsp_section_noinit_begin; diff --git a/bsps/bfin/TLL6527M/start/linkcmds b/bsps/bfin/TLL6527M/start/linkcmds index 315f1b7149..2185678184 100644 --- a/bsps/bfin/TLL6527M/start/linkcmds +++ b/bsps/bfin/TLL6527M/start/linkcmds @@ -129,7 +129,7 @@ SECTIONS } > sdram .noinit (NOLOAD) : { -*(.noinit*) +*(SORT_BY_NAME
[PATCH v2 2/3] score: Place object controls into .noinit sections
Place the statically allocated object control blocks, local tables, and thread queue heads into the dedicated .noinit intput sections. The output section is not zero initialized. Placing these elements into the .noinit section reduces the system initialization time by decreasing the .bss section size. It may improve the cache efficiency since the mostly read local tables are placed in a contiguous memory area. Update #4678. --- cpukit/include/rtems/score/objectdata.h | 7 +-- cpukit/include/rtems/score/thread.h | 9 ++--- testsuites/sptests/sp01/init.c | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cpukit/include/rtems/score/objectdata.h b/cpukit/include/rtems/score/objectdata.h index d624f182f9..dc03f23461 100644 --- a/cpukit/include/rtems/score/objectdata.h +++ b/cpukit/include/rtems/score/objectdata.h @@ -447,9 +447,12 @@ Objects_Information name##_Information = { \ * multiprocessing (RTEMS_MULTIPROCESSING) is enabled. */ #define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \ -static Objects_Control * \ +static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \ +Objects_Control * \ name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \ -static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ +static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \ +type \ +name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ Objects_Information name##_Information = { \ _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \ name##_Local_table, \ diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h index 94eab18ea3..f5a56887a4 100644 --- a/cpukit/include/rtems/score/thread.h +++ b/cpukit/include/rtems/score/thread.h @@ -1149,11 +1149,14 @@ Thread_Information name##_Information = { \ Objects_Control *_Thread_Allocate_unlimited( Objects_Information *information ); #define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \ -static Objects_Control * \ +static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \ +Objects_Control * \ name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \ -static Thread_Configured_control \ +static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \ +Thread_Configured_control \ name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ -static Thread_queue_Configured_heads \ +static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \ +Thread_queue_Configured_heads \ name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \ Thread_Information name##_Information = { \ { \ diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c index 2384430824..26d715b0ba 100644 --- a/testsuites/sptests/sp01/init.c +++ b/testsuites/sptests/sp01/init.c @@ -35,7 +35,8 @@ const char rtems_test_name[] = "SP 1"; -RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char Task_1_storage[ +static RTEMS_NOINIT RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char +Task_1_storage[ RTEMS_TASK_STORAGE_SIZE( 2 * RTEMS_MINIMUM_STACK_SIZE, RTEMS_FLOATING_POINT ) ]; -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH v2 3/3] score: Extend memory dirty/zero actions
Dirty or zero also the part of the .noinit section used by RTEMS. Close #4678. --- cpukit/include/rtems/score/memory.h | 14 +++- cpukit/score/src/memorydirtyfreeareas.c | 9 - cpukit/score/src/memorynoinit.c | 45 +++ cpukit/score/src/memoryzerofreeareas.c | 9 - spec/build/cpukit/librtemscpu.yml | 1 + testsuites/sptests/sp54/init.c | 48 + 6 files changed, 117 insertions(+), 9 deletions(-) create mode 100644 cpukit/score/src/memorynoinit.c diff --git a/cpukit/include/rtems/score/memory.h b/cpukit/include/rtems/score/memory.h index 5761402711..fa17ea164c 100644 --- a/cpukit/include/rtems/score/memory.h +++ b/cpukit/include/rtems/score/memory.h @@ -10,7 +10,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2019 embedded brains GmbH + * Copyright (C) 2019, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -352,6 +352,18 @@ void _Memory_Zero_free_areas( void ); */ void _Memory_Dirty_free_areas( void ); +/** + * @brief This symbol marks the begin of the non-initialized section used by + * RTEMS. + */ +extern char _Memory_Noinit_begin[]; + +/** + * @brief This symbol marks the end of the non-initialized section used by + * RTEMS. + */ +extern char _Memory_Noinit_end[]; + /** @} */ #ifdef __cplusplus diff --git a/cpukit/score/src/memorydirtyfreeareas.c b/cpukit/score/src/memorydirtyfreeareas.c index fc6c2630bf..8a817c2208 100644 --- a/cpukit/score/src/memorydirtyfreeareas.c +++ b/cpukit/score/src/memorydirtyfreeareas.c @@ -10,7 +10,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2020 embedded brains GmbH + * Copyright (C) 2020, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,7 +40,14 @@ #include +#include + void _Memory_Dirty_free_areas( void ) { _Memory_Fill( _Memory_Get(), 0xcf ); + memset( +_Memory_Noinit_begin, +0xcf, +(uintptr_t) _Memory_Noinit_end - (uintptr_t) _Memory_Noinit_begin + ); } diff --git a/cpukit/score/src/memorynoinit.c b/cpukit/score/src/memorynoinit.c new file mode 100644 index 00..19772356cd --- /dev/null +++ b/cpukit/score/src/memorynoinit.c @@ -0,0 +1,45 @@ +/** + * @file + * + * @ingroup RTEMSScoreMemory + * + * @brief This source file contains the definition of ::_Memory_Noinit_begin + * and ::_Memory_Noinit_end. + */ + +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2022 embedded brains GmbH + * + * 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_CONFIG_H +#include "config.h" +#endif + +#include + +RTEMS_SECTION( ".noinit.rtems.begin" ) char _Memory_Noinit_begin[ 0 ]; + +RTEMS_SECTION( ".noinit.rtems.end" ) char _Memory_Noinit_end[ 0 ]; diff --git a/cpukit/score/src/memoryzerofreeareas.c b/cpukit/score/src/memoryzerofreeareas.c index 4ea0812426..b1cef47ef9 100644 --- a/cpukit/score/src/memoryzerofreeareas.c +++ b/cpukit/score/src/memoryzerofreeareas.c @@ -10,7 +10,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2020 embedded brains GmbH + * Copyright (C) 2020, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,7 +40,14 @@ #include +#include + void _Memory_Zero_free_areas( void ) { _Memory_Fill( _Memory_Get(), 0 ); + memset( +_Memory_Noinit_begin, +0, +(uintptr_t) _Memory_Noinit_end -
[PATCH v2 0/3] Reduce system initialization time
This patch set reduces the system initialization time in the default configuration. Applications can change the default behaviour through the CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY and CONFIGURE_DIRTY_MEMORY configuration options. v2: * Reference ticket * Improve sp54 Sebastian Huber (3): bsps: Sort .noinit* sections score: Place object controls into .noinit sections score: Extend memory dirty/zero actions bsps/aarch64/shared/start/linkcmds.base | 2 +- bsps/arm/shared/start/linkcmds.base | 2 +- bsps/bfin/TLL6527M/start/linkcmds | 2 +- bsps/bfin/bf537Stamp/start/linkcmds | 2 +- bsps/bfin/eZKit533/start/linkcmds | 2 +- bsps/i386/pc386/start/linkcmds| 2 +- bsps/lm32/lm32_evr/start/linkcmds | 2 +- bsps/lm32/milkymist/start/linkcmds| 2 +- bsps/m68k/av5282/start/linkcmds | 2 +- bsps/m68k/av5282/start/linkcmdsflash | 2 +- bsps/m68k/av5282/start/linkcmdsram| 2 +- bsps/m68k/csb360/start/linkcmds | 2 +- bsps/m68k/gen68340/start/linkcmds | 2 +- bsps/m68k/gen68360/start/linkcmds | 2 +- bsps/m68k/gen68360/start/linkcmds.bootp | 2 +- bsps/m68k/gen68360/start/linkcmds.prom| 2 +- bsps/m68k/mcf5206elite/start/linkcmds | 2 +- bsps/m68k/mcf5206elite/start/linkcmds.flash | 2 +- bsps/m68k/mcf52235/start/linkcmds | 2 +- bsps/m68k/mcf5225x/start/linkcmds | 2 +- bsps/m68k/mcf5235/start/linkcmds | 2 +- bsps/m68k/mcf5235/start/linkcmdsflash | 2 +- bsps/m68k/mcf5235/start/linkcmdsram | 2 +- bsps/m68k/mcf5329/start/linkcmds | 2 +- bsps/m68k/mcf5329/start/linkcmdsflash | 2 +- bsps/m68k/mrm332/start/linkcmds | 2 +- bsps/m68k/shared/start/linkcmds.base | 2 +- bsps/m68k/uC5282/start/linkcmds | 2 +- bsps/mips/csb350/start/linkcmds | 2 +- bsps/mips/hurricane/start/linkcmds| 2 +- bsps/mips/jmr3904/start/linkcmds | 2 +- bsps/mips/malta/start/linkcmds| 2 +- bsps/mips/rbtx4925/start/linkcmds | 2 +- bsps/mips/rbtx4938/start/linkcmds | 2 +- bsps/moxie/moxiesim/start/linkcmds| 2 +- bsps/nios2/nios2_iss/start/linkcmds | 2 +- bsps/or1k/shared/start/linkcmds.base | 2 +- .../gen5200/start/linkcmds.gen5200_base | 2 +- bsps/powerpc/mpc8260ads/start/linkcmds| 2 +- bsps/powerpc/shared/start/linkcmds.base | 2 +- bsps/powerpc/shared/start/linkcmds.share | 2 +- bsps/powerpc/ss555/start/linkcmds | 2 +- bsps/powerpc/virtex4/start/linkcmds | 2 +- bsps/powerpc/virtex5/start/linkcmds | 2 +- bsps/sh/gensh1/start/linkcmds | 2 +- bsps/sh/gensh2/start/linkcmds | 2 +- bsps/sh/gensh2/start/linkcmds.ram | 2 +- bsps/sh/gensh2/start/linkcmds.rom | 2 +- bsps/sh/gensh4/start/linkcmds | 2 +- bsps/sh/gensh4/start/linkcmds.rom | 2 +- bsps/sh/gensh4/start/linkcmds.rom2ram | 2 +- bsps/sh/shsim/start/linkcmds | 2 +- bsps/sparc/shared/start/linkcmds.base | 2 +- bsps/sparc64/shared/start/linkcmds| 2 +- bsps/v850/gdbv850sim/start/linkcmds | 2 +- bsps/x86_64/amd64/start/linkcmds | 2 +- cpukit/include/rtems/score/memory.h | 14 +- cpukit/include/rtems/score/objectdata.h | 7 ++- cpukit/include/rtems/score/thread.h | 9 ++-- cpukit/score/src/memorydirtyfreeareas.c | 9 +++- cpukit/score/src/memorynoinit.c | 45 + cpukit/score/src/memoryzerofreeareas.c| 9 +++- spec/build/cpukit/librtemscpu.yml | 1 + testsuites/sptests/sp01/init.c| 3 +- testsuites/sptests/sp54/init.c| 48 --- 65 files changed, 186 insertions(+), 71 deletions(-) create mode 100644 cpukit/score/src/memorynoinit.c -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH 2/3] score: Place object controls into .noinit sections
On 15.07.22 07:41, Sebastian Huber wrote: Placing these elements into the .noinit section reduces the system initialization time by decreasing the .bss section size. How much data do you see that is being moved out of .bss to .noinit? It depends on your application configuration. You have for example about 700 bytes per task. I noticed this in an application which hit the watchdog due to an update to RTEMS 6 because of the longer boot time to the initialization task. I added a ticket for this: https://devel.rtems.org/ticket/4678 -- 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 2/3] score: Place object controls into .noinit sections
On 15.07.22 04:03, Chris Johns wrote: On 14/7/2022 11:13 pm, Sebastian Huber wrote: Place the statically allocated object control blocks, local tables, and thread queue heads into the dedicated .noinit intput sections. The output section is not zero initialized. Does the data held in no-init rely on code having to initialise all fields? Is the saving because there is code that already does this? Yes, we have a double initialization. These elements were allocated from the workspace before the static allocation. The workspace allocates uninitialized data. We still have this uninitialized data if unlimited objects are used. Placing these elements into the .noinit section reduces the system initialization time by decreasing the .bss section size. How much data do you see that is being moved out of .bss to .noinit? It depends on your application configuration. You have for example about 700 bytes per task. I noticed this in an application which hit the watchdog due to an update to RTEMS 6 because of the longer boot time to the initialization task. -- 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 1/3] bsps: Sort .noinit* sections
On 15.07.22 04:05, Chris Johns wrote: On 14/7/2022 11:13 pm, Sebastian Huber wrote: Sort the .noinit* input sections by name first, then by alignment if two sections have the same name. This allows the placement of begin/end symbols to initialize some areas with a special value. How are the areas initialised with a special value? I do not see the connection between sorting a section and initialisation with a value. It is done in patch 3/3. -- 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 2/3] score: Place object controls into .noinit sections
Place the statically allocated object control blocks, local tables, and thread queue heads into the dedicated .noinit intput sections. The output section is not zero initialized. Placing these elements into the .noinit section reduces the system initialization time by decreasing the .bss section size. --- cpukit/include/rtems/score/objectdata.h | 7 +-- cpukit/include/rtems/score/thread.h | 9 ++--- testsuites/sptests/sp01/init.c | 3 ++- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cpukit/include/rtems/score/objectdata.h b/cpukit/include/rtems/score/objectdata.h index d624f182f9..dc03f23461 100644 --- a/cpukit/include/rtems/score/objectdata.h +++ b/cpukit/include/rtems/score/objectdata.h @@ -447,9 +447,12 @@ Objects_Information name##_Information = { \ * multiprocessing (RTEMS_MULTIPROCESSING) is enabled. */ #define OBJECTS_INFORMATION_DEFINE( name, api, cls, type, max, nl, ex ) \ -static Objects_Control * \ +static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \ +Objects_Control * \ name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \ -static type name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ +static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \ +type \ +name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ Objects_Information name##_Information = { \ _Objects_Build_id( api, cls, 1, _Objects_Maximum_per_allocation( max ) ), \ name##_Local_table, \ diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h index 94eab18ea3..f5a56887a4 100644 --- a/cpukit/include/rtems/score/thread.h +++ b/cpukit/include/rtems/score/thread.h @@ -1149,11 +1149,14 @@ Thread_Information name##_Information = { \ Objects_Control *_Thread_Allocate_unlimited( Objects_Information *information ); #define THREAD_INFORMATION_DEFINE( name, api, cls, max ) \ -static Objects_Control * \ +static RTEMS_SECTION( ".noinit.rtems.content.local_table" ) \ +Objects_Control * \ name##_Local_table[ _Objects_Maximum_per_allocation( max ) ]; \ -static Thread_Configured_control \ +static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \ +Thread_Configured_control \ name##_Objects[ _Objects_Maximum_per_allocation( max ) ]; \ -static Thread_queue_Configured_heads \ +static RTEMS_SECTION( ".noinit.rtems.content.objects" ) \ +Thread_queue_Configured_heads \ name##_Heads[ _Objects_Maximum_per_allocation( max ) ]; \ Thread_Information name##_Information = { \ { \ diff --git a/testsuites/sptests/sp01/init.c b/testsuites/sptests/sp01/init.c index 2384430824..26d715b0ba 100644 --- a/testsuites/sptests/sp01/init.c +++ b/testsuites/sptests/sp01/init.c @@ -35,7 +35,8 @@ const char rtems_test_name[] = "SP 1"; -RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) static char Task_1_storage[ +static RTEMS_NOINIT RTEMS_ALIGNED( RTEMS_TASK_STORAGE_ALIGNMENT ) char +Task_1_storage[ RTEMS_TASK_STORAGE_SIZE( 2 * RTEMS_MINIMUM_STACK_SIZE, RTEMS_FLOATING_POINT ) ]; -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 0/3] Reduce system initialization time
This patch set reduces the system initialization time in the default configuration. Applications can change the default behaviour through the CONFIGURE_ZERO_WORKSPACE_AUTOMATICALLY and CONFIGURE_DIRTY_MEMORY configuration options. Sebastian Huber (3): bsps: Sort .noinit* sections score: Place object controls into .noinit sections score: Extend memory dirty/zero actions bsps/aarch64/shared/start/linkcmds.base | 2 +- bsps/arm/shared/start/linkcmds.base | 2 +- bsps/bfin/TLL6527M/start/linkcmds | 2 +- bsps/bfin/bf537Stamp/start/linkcmds | 2 +- bsps/bfin/eZKit533/start/linkcmds | 2 +- bsps/i386/pc386/start/linkcmds| 2 +- bsps/lm32/lm32_evr/start/linkcmds | 2 +- bsps/lm32/milkymist/start/linkcmds| 2 +- bsps/m68k/av5282/start/linkcmds | 2 +- bsps/m68k/av5282/start/linkcmdsflash | 2 +- bsps/m68k/av5282/start/linkcmdsram| 2 +- bsps/m68k/csb360/start/linkcmds | 2 +- bsps/m68k/gen68340/start/linkcmds | 2 +- bsps/m68k/gen68360/start/linkcmds | 2 +- bsps/m68k/gen68360/start/linkcmds.bootp | 2 +- bsps/m68k/gen68360/start/linkcmds.prom| 2 +- bsps/m68k/mcf5206elite/start/linkcmds | 2 +- bsps/m68k/mcf5206elite/start/linkcmds.flash | 2 +- bsps/m68k/mcf52235/start/linkcmds | 2 +- bsps/m68k/mcf5225x/start/linkcmds | 2 +- bsps/m68k/mcf5235/start/linkcmds | 2 +- bsps/m68k/mcf5235/start/linkcmdsflash | 2 +- bsps/m68k/mcf5235/start/linkcmdsram | 2 +- bsps/m68k/mcf5329/start/linkcmds | 2 +- bsps/m68k/mcf5329/start/linkcmdsflash | 2 +- bsps/m68k/mrm332/start/linkcmds | 2 +- bsps/m68k/shared/start/linkcmds.base | 2 +- bsps/m68k/uC5282/start/linkcmds | 2 +- bsps/mips/csb350/start/linkcmds | 2 +- bsps/mips/hurricane/start/linkcmds| 2 +- bsps/mips/jmr3904/start/linkcmds | 2 +- bsps/mips/malta/start/linkcmds| 2 +- bsps/mips/rbtx4925/start/linkcmds | 2 +- bsps/mips/rbtx4938/start/linkcmds | 2 +- bsps/moxie/moxiesim/start/linkcmds| 2 +- bsps/nios2/nios2_iss/start/linkcmds | 2 +- bsps/or1k/shared/start/linkcmds.base | 2 +- .../gen5200/start/linkcmds.gen5200_base | 2 +- bsps/powerpc/mpc8260ads/start/linkcmds| 2 +- bsps/powerpc/shared/start/linkcmds.base | 2 +- bsps/powerpc/shared/start/linkcmds.share | 2 +- bsps/powerpc/ss555/start/linkcmds | 2 +- bsps/powerpc/virtex4/start/linkcmds | 2 +- bsps/powerpc/virtex5/start/linkcmds | 2 +- bsps/sh/gensh1/start/linkcmds | 2 +- bsps/sh/gensh2/start/linkcmds | 2 +- bsps/sh/gensh2/start/linkcmds.ram | 2 +- bsps/sh/gensh2/start/linkcmds.rom | 2 +- bsps/sh/gensh4/start/linkcmds | 2 +- bsps/sh/gensh4/start/linkcmds.rom | 2 +- bsps/sh/gensh4/start/linkcmds.rom2ram | 2 +- bsps/sh/shsim/start/linkcmds | 2 +- bsps/sparc/shared/start/linkcmds.base | 2 +- bsps/sparc64/shared/start/linkcmds| 2 +- bsps/v850/gdbv850sim/start/linkcmds | 2 +- bsps/x86_64/amd64/start/linkcmds | 2 +- cpukit/include/rtems/score/memory.h | 14 +- cpukit/include/rtems/score/objectdata.h | 7 ++- cpukit/include/rtems/score/thread.h | 9 ++-- cpukit/score/src/memorydirtyfreeareas.c | 9 +++- cpukit/score/src/memorynoinit.c | 45 +++ cpukit/score/src/memoryzerofreeareas.c| 9 +++- spec/build/cpukit/librtemscpu.yml | 1 + testsuites/sptests/sp01/init.c| 3 +- 64 files changed, 144 insertions(+), 65 deletions(-) create mode 100644 cpukit/score/src/memorynoinit.c -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 1/3] bsps: Sort .noinit* sections
Sort the .noinit* input sections by name first, then by alignment if two sections have the same name. This allows the placement of begin/end symbols to initialize some areas with a special value. --- bsps/aarch64/shared/start/linkcmds.base | 2 +- bsps/arm/shared/start/linkcmds.base | 2 +- bsps/bfin/TLL6527M/start/linkcmds| 2 +- bsps/bfin/bf537Stamp/start/linkcmds | 2 +- bsps/bfin/eZKit533/start/linkcmds| 2 +- bsps/i386/pc386/start/linkcmds | 2 +- bsps/lm32/lm32_evr/start/linkcmds| 2 +- bsps/lm32/milkymist/start/linkcmds | 2 +- bsps/m68k/av5282/start/linkcmds | 2 +- bsps/m68k/av5282/start/linkcmdsflash | 2 +- bsps/m68k/av5282/start/linkcmdsram | 2 +- bsps/m68k/csb360/start/linkcmds | 2 +- bsps/m68k/gen68340/start/linkcmds| 2 +- bsps/m68k/gen68360/start/linkcmds| 2 +- bsps/m68k/gen68360/start/linkcmds.bootp | 2 +- bsps/m68k/gen68360/start/linkcmds.prom | 2 +- bsps/m68k/mcf5206elite/start/linkcmds| 2 +- bsps/m68k/mcf5206elite/start/linkcmds.flash | 2 +- bsps/m68k/mcf52235/start/linkcmds| 2 +- bsps/m68k/mcf5225x/start/linkcmds| 2 +- bsps/m68k/mcf5235/start/linkcmds | 2 +- bsps/m68k/mcf5235/start/linkcmdsflash| 2 +- bsps/m68k/mcf5235/start/linkcmdsram | 2 +- bsps/m68k/mcf5329/start/linkcmds | 2 +- bsps/m68k/mcf5329/start/linkcmdsflash| 2 +- bsps/m68k/mrm332/start/linkcmds | 2 +- bsps/m68k/shared/start/linkcmds.base | 2 +- bsps/m68k/uC5282/start/linkcmds | 2 +- bsps/mips/csb350/start/linkcmds | 2 +- bsps/mips/hurricane/start/linkcmds | 2 +- bsps/mips/jmr3904/start/linkcmds | 2 +- bsps/mips/malta/start/linkcmds | 2 +- bsps/mips/rbtx4925/start/linkcmds| 2 +- bsps/mips/rbtx4938/start/linkcmds| 2 +- bsps/moxie/moxiesim/start/linkcmds | 2 +- bsps/nios2/nios2_iss/start/linkcmds | 2 +- bsps/or1k/shared/start/linkcmds.base | 2 +- bsps/powerpc/gen5200/start/linkcmds.gen5200_base | 2 +- bsps/powerpc/mpc8260ads/start/linkcmds | 2 +- bsps/powerpc/shared/start/linkcmds.base | 2 +- bsps/powerpc/shared/start/linkcmds.share | 2 +- bsps/powerpc/ss555/start/linkcmds| 2 +- bsps/powerpc/virtex4/start/linkcmds | 2 +- bsps/powerpc/virtex5/start/linkcmds | 2 +- bsps/sh/gensh1/start/linkcmds| 2 +- bsps/sh/gensh2/start/linkcmds| 2 +- bsps/sh/gensh2/start/linkcmds.ram| 2 +- bsps/sh/gensh2/start/linkcmds.rom| 2 +- bsps/sh/gensh4/start/linkcmds| 2 +- bsps/sh/gensh4/start/linkcmds.rom| 2 +- bsps/sh/gensh4/start/linkcmds.rom2ram| 2 +- bsps/sh/shsim/start/linkcmds | 2 +- bsps/sparc/shared/start/linkcmds.base| 2 +- bsps/sparc64/shared/start/linkcmds | 2 +- bsps/v850/gdbv850sim/start/linkcmds | 2 +- bsps/x86_64/amd64/start/linkcmds | 2 +- 56 files changed, 56 insertions(+), 56 deletions(-) diff --git a/bsps/aarch64/shared/start/linkcmds.base b/bsps/aarch64/shared/start/linkcmds.base index d3b5485777..bcdf4715d7 100644 --- a/bsps/aarch64/shared/start/linkcmds.base +++ b/bsps/aarch64/shared/start/linkcmds.base @@ -323,7 +323,7 @@ SECTIONS { .noinit (NOLOAD) : ALIGN_WITH_INPUT { bsp_section_noinit_begin = .; - *(.noinit*) + *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*))) bsp_section_noinit_end = .; } > REGION_WORK AT > REGION_WORK bsp_section_noinit_size = bsp_section_noinit_end - bsp_section_noinit_begin; diff --git a/bsps/arm/shared/start/linkcmds.base b/bsps/arm/shared/start/linkcmds.base index 10d2c54028..c9cf360ee7 100644 --- a/bsps/arm/shared/start/linkcmds.base +++ b/bsps/arm/shared/start/linkcmds.base @@ -334,7 +334,7 @@ SECTIONS { .noinit (NOLOAD) : ALIGN_WITH_INPUT { bsp_section_noinit_begin = .; - *(.noinit*) + *(SORT_BY_NAME (SORT_BY_ALIGNMENT (.noinit*))) bsp_section_noinit_end = .; } > REGION_WORK AT > REGION_WORK bsp_section_noinit_size = bsp_section_noinit_end - bsp_section_noinit_begin; diff --git a/bsps/bfin/TLL6527M/start/linkcmds b/bsps/bfin/TLL6527M/start/linkcmds index 315f1b7149..2185678184 100644 --- a/bsps/bfin/TLL6527M/start/linkcmds +++ b/bsps/bfin/TLL6527M/start/linkcmds @@ -129,7 +129,7 @@ SECTIONS } > sdram .noinit (NOLOAD) : { -*(.noinit*) +*(SORT_BY_NAME (SORT_BY_ALIGNMENT
[PATCH 3/3] score: Extend memory dirty/zero actions
Dirty or zero also the part of the .noinit section used by RTEMS. --- cpukit/include/rtems/score/memory.h | 14 +++- cpukit/score/src/memorydirtyfreeareas.c | 9 - cpukit/score/src/memorynoinit.c | 45 + cpukit/score/src/memoryzerofreeareas.c | 9 - spec/build/cpukit/librtemscpu.yml | 1 + 5 files changed, 75 insertions(+), 3 deletions(-) create mode 100644 cpukit/score/src/memorynoinit.c diff --git a/cpukit/include/rtems/score/memory.h b/cpukit/include/rtems/score/memory.h index 5761402711..fa17ea164c 100644 --- a/cpukit/include/rtems/score/memory.h +++ b/cpukit/include/rtems/score/memory.h @@ -10,7 +10,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2019 embedded brains GmbH + * Copyright (C) 2019, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -352,6 +352,18 @@ void _Memory_Zero_free_areas( void ); */ void _Memory_Dirty_free_areas( void ); +/** + * @brief This symbol marks the begin of the non-initialized section used by + * RTEMS. + */ +extern char _Memory_Noinit_begin[]; + +/** + * @brief This symbol marks the end of the non-initialized section used by + * RTEMS. + */ +extern char _Memory_Noinit_end[]; + /** @} */ #ifdef __cplusplus diff --git a/cpukit/score/src/memorydirtyfreeareas.c b/cpukit/score/src/memorydirtyfreeareas.c index fc6c2630bf..8a817c2208 100644 --- a/cpukit/score/src/memorydirtyfreeareas.c +++ b/cpukit/score/src/memorydirtyfreeareas.c @@ -10,7 +10,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2020 embedded brains GmbH + * Copyright (C) 2020, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,7 +40,14 @@ #include +#include + void _Memory_Dirty_free_areas( void ) { _Memory_Fill( _Memory_Get(), 0xcf ); + memset( +_Memory_Noinit_begin, +0xcf, +(uintptr_t) _Memory_Noinit_end - (uintptr_t) _Memory_Noinit_begin + ); } diff --git a/cpukit/score/src/memorynoinit.c b/cpukit/score/src/memorynoinit.c new file mode 100644 index 00..19772356cd --- /dev/null +++ b/cpukit/score/src/memorynoinit.c @@ -0,0 +1,45 @@ +/** + * @file + * + * @ingroup RTEMSScoreMemory + * + * @brief This source file contains the definition of ::_Memory_Noinit_begin + * and ::_Memory_Noinit_end. + */ + +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2022 embedded brains GmbH + * + * 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_CONFIG_H +#include "config.h" +#endif + +#include + +RTEMS_SECTION( ".noinit.rtems.begin" ) char _Memory_Noinit_begin[ 0 ]; + +RTEMS_SECTION( ".noinit.rtems.end" ) char _Memory_Noinit_end[ 0 ]; diff --git a/cpukit/score/src/memoryzerofreeareas.c b/cpukit/score/src/memoryzerofreeareas.c index 4ea0812426..b1cef47ef9 100644 --- a/cpukit/score/src/memoryzerofreeareas.c +++ b/cpukit/score/src/memoryzerofreeareas.c @@ -10,7 +10,7 @@ /* * SPDX-License-Identifier: BSD-2-Clause * - * Copyright (C) 2020 embedded brains GmbH + * Copyright (C) 2020, 2022 embedded brains GmbH * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -40,7 +40,14 @@ #include +#include + void _Memory_Zero_free_areas( void ) { _Memory_Fill( _Memory_Get(), 0 ); + memset( +_Memory_Noinit_begin, +0, +(uintptr_t) _Memory_Noinit_end - (uintptr_t) _Memory_Noinit_begin + ); } diff --git
Re: [PATCH 0/5] NOEL-V BSP
On 14/07/2022 09:59, Daniel Cederman wrote: Currently there is a problem linking the ts-validation-cache.exe test for 64-bit configurations. It fails with the following error message: bsps/riscv/shared/start/start.S:100:(.bsp_start_text+0x70): relocation truncated to fit: R_RISCV_GPREL_I against symbol `bsp_section_bss_size' defined in*ABS* section Anyone have an idea of what could be causing this? This is: http://devel.rtems.org/ticket/4658 -- 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 4/5] bsp/riscv: Add NOEL-V BSP build specification
On 14/07/2022 10:00, Daniel Cederman wrote: From: Martin Aberg --- spec/build/bsps/riscv/noel/abi.yml| 48 +++ This should be merged into patch 2. Patch 3 should move before patch 2. -- 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 5/5] bsp/riscv: Add NOEL-V configuration files
On 14/07/2022 10:00, Daniel Cederman wrote: From: Martin Aberg --- bsps/riscv/noel/config/noel32im.cfg | 9 + bsps/riscv/noel/config/noel32imafd.cfg | 9 + bsps/riscv/noel/config/noel64imac.cfg | 9 + bsps/riscv/noel/config/noel64imafd.cfg | 9 + bsps/riscv/noel/config/noel64imafdc.cfg | 9 + 5 files changed, 45 insertions(+) create mode 100644 bsps/riscv/noel/config/noel32im.cfg create mode 100644 bsps/riscv/noel/config/noel32imafd.cfg create mode 100644 bsps/riscv/noel/config/noel64imac.cfg create mode 100644 bsps/riscv/noel/config/noel64imafd.cfg create mode 100644 bsps/riscv/noel/config/noel64imafdc.cfg These files are no longer needed. Please do not commit this patch. -- 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 1/5] apbuart_termios: use bsp/irq.h
On 14/07/2022 09:59, Daniel Cederman wrote: From: Martin Aberg The real dependency in this case is on rtems/irq-extension.h. The theme in other other console drivers is to get it via bsp/irq.h, so that pattern is followed. This API is now part of the Interrupt Manager. Is this patch still necessary? -- 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] cdtest: Restrict exceptions during sysinit
On 14/07/2022 10:33, Chris Johns wrote: On 14/7/2022 4:08 pm, Sebastian Huber wrote: On 14/07/2022 02:36, Chris Johns wrote: Exceptions during system initialization work only on targets which do not need a registration of exception frames during the global construction. In particular, targets which use the DWARF2 unwinder cannot use exceptions during system initialization. I would like to complete the discussion on the other thread about this issue before we work around the issue like this. If this patch masks a failure that the standard expects to work we should not hide it. Don't shoot the messenger. This is a fundamental limitation of the DWARF2 unwinder. I am sorry, I did not mean to say it was your fault. So this has been an issue for while? I have been through this area of code a while back when adding support for libdl. This problem exists since the global construction is done by the initialization thread. If exceptions work post construction is the issue the ordering of a call somewhere? If you create a thread during system initialization and this thread runs before the global construction and it uses a C++ exception, then you end up with a failed gcc_assert(). I think the message is clear, applications should start their work in the initialization thread. -- 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] cdtest: Restrict exceptions during sysinit
On 14/07/2022 02:36, Chris Johns wrote: Exceptions during system initialization work only on targets which do not need a registration of exception frames during the global construction. In particular, targets which use the DWARF2 unwinder cannot use exceptions during system initialization. I would like to complete the discussion on the other thread about this issue before we work around the issue like this. If this patch masks a failure that the standard expects to work we should not hide it. Don't shoot the messenger. This is a fundamental limitation of the DWARF2 unwinder. -- 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] samples/cdtest: Test execeptions during system init
On 14/07/2022 02:31, Chris Johns wrote: On 13/7/2022 6:42 pm, Sebastian Huber wrote: On 01/07/2022 12:02, Sebastian Huber wrote: +static void early_exception() +{ + try + { + throw "early exception"; + } + catch( const char *e ) + { + rtems_test_assert(strcmp(e, "early exception") == 0); + throw "early exception 2"; + } +} + +static void test_exceptions_during_system_init() +{ + TEST_BEGIN(); + + try + { + early_exception(); + } + catch( const char *e ) + { + rtems_test_assert(strcmp(e, "early exception 2") == 0); + } +} + +RTEMS_SYSINIT_ITEM( + test_exceptions_during_system_init, + RTEMS_SYSINIT_IDLE_THREADS, + RTEMS_SYSINIT_ORDER_LAST +); Actually, on targets which use the DWARF2 unwinder (for example sparc), this doesn't work since the exception frames are no yet registered. Is the result a terminate with an unknown type of exception of something else? It is a failed gcc_assert() in the unwinder code. Depending on the GCC options, this results in a __builtin_trap(). Kinsey is reporting an issue with aarch64 and cdtest on discord. Yes, it seems ARM changed the exception implementation for aarch64 to use what everyone else uses. So we essentially have: #if defined(__arm__) #define CAN_DO_EXCEPTIONS_DURING_SYSINIT #endif What mechanism is being used to initialise the unwinder support? It is the C runtime initialization done during global construction. With libdl the unwind tables are registered as part of the loading. They are registered during global construction. This also means that C++ exceptions can only be used once the global construction completed on these targets. Has this always been the case? Yes, but there was no test which used the C++ exceptions during system initialization until recently. It is part of the well documented RAII principle so we need this to work. Probably the only thing we can do is to document this constraint somewhere. -- 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: Build Linux: FAILED 6/rtems-m68k on x86_64-linux-gnu (m68k-rtems6-gcc-1ad2ee2-newlib-ea99f21-x86_64-linux-gnu-1)
On 13/07/2022 11:58, sebastian.hu...@embedded-brains.de wrote: RTEMS Source Builder - Set Builder, 6 (53c42b08508f) warning: exe: absolute exe found in path: (__chown) /usr/sbin/chown Host: Linux-5.3.18-150300.59.76-default-x86_64-with-glibc2.3.4 Linux lupus 5.3.18-150300.59.76-default #1 SMP Thu Jun 16 04:23:47 UTC 2022 (2cc2ade) x86_64 x86_64 Build Time: 0:06:49.920595 I added a GCC bug report for this error: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106282 I will disable the configuration option for m68k until this is fixed. -- 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 3/3] score: Fix unlimited objects support
Commit 21275b58a5a69c3c838082ffc8a7a3641f32ea9a ("score: Static Objects_Information initialization") introduced an off-by-one error in the maintenance of inactive objects. Close #4677. --- cpukit/include/rtems/score/objectimpl.h | 29 + cpukit/score/src/objectfree.c | 12 +- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cpukit/include/rtems/score/objectimpl.h b/cpukit/include/rtems/score/objectimpl.h index 72a5f6b126..7938996df8 100644 --- a/cpukit/include/rtems/score/objectimpl.h +++ b/cpukit/include/rtems/score/objectimpl.h @@ -911,6 +911,25 @@ RTEMS_INLINE_ROUTINE void _Objects_Free( ( *information->deallocate )( information, the_object ); } +/** + * @brief Returns true, if the object associated with the zero-based index is + * contained in an allocated block of objects, otherwise false. + * + * @param index is the zero-based object index. + * @param objects_per_block is the object count per block. + * + * @retval true The object associated with the zero-based index is in an + * allocated block of objects. + * @retval false Otherwise. + */ +RTEMS_INLINE_ROUTINE bool _Objects_Is_in_allocated_block( + Objects_Maximum index, + Objects_Maximum objects_per_block +) +{ + return index >= objects_per_block; +} + /** * @brief Activate the object. * @@ -926,15 +945,17 @@ RTEMS_INLINE_ROUTINE void _Objects_Activate_unlimited( ) { Objects_Maximum objects_per_block; - Objects_Maximum block; + Objects_Maximum index; _Assert( _Objects_Is_auto_extend( information ) ); objects_per_block = information->objects_per_block; - block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; + index = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; + + if ( _Objects_Is_in_allocated_block( index, objects_per_block ) ) { +Objects_Maximum block; - if ( block > objects_per_block ) { -block /= objects_per_block; +block = index / objects_per_block; information->inactive_per_block[ block ]--; information->inactive--; diff --git a/cpukit/score/src/objectfree.c b/cpukit/score/src/objectfree.c index 45b2ba2c86..06d7d82672 100644 --- a/cpukit/score/src/objectfree.c +++ b/cpukit/score/src/objectfree.c @@ -51,14 +51,16 @@ void _Objects_Free_unlimited( if ( _Objects_Is_auto_extend( information ) ) { Objects_Maximum objects_per_block; -Objects_Maximum block; -Objects_Maximum inactive; +Objects_Maximum index; objects_per_block = information->objects_per_block; -block = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; +index = _Objects_Get_index( the_object->id ) - OBJECTS_INDEX_MINIMUM; -if ( block > objects_per_block ) { - block /= objects_per_block; +if ( _Objects_Is_in_allocated_block( index, objects_per_block ) ) { + Objects_Maximum block; + Objects_Maximum inactive; + + block = index / objects_per_block; ++information->inactive_per_block[ block ]; -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/3] spunlimited01: New test
Update #4677. --- spec/build/testsuites/sptests/grp.yml | 2 + .../testsuites/sptests/spunlimited01.yml | 20 +++ testsuites/sptests/spunlimited01/init.c | 125 ++ .../sptests/spunlimited01/spunlimited01.doc | 14 ++ 4 files changed, 161 insertions(+) create mode 100644 spec/build/testsuites/sptests/spunlimited01.yml create mode 100644 testsuites/sptests/spunlimited01/init.c create mode 100644 testsuites/sptests/spunlimited01/spunlimited01.doc diff --git a/spec/build/testsuites/sptests/grp.yml b/spec/build/testsuites/sptests/grp.yml index c6d07b07fd..891a78eb86 100644 --- a/spec/build/testsuites/sptests/grp.yml +++ b/spec/build/testsuites/sptests/grp.yml @@ -448,6 +448,8 @@ links: uid: sptls03 - role: build-dependency uid: sptls04 +- role: build-dependency + uid: spunlimited01 - role: build-dependency uid: spversion01 - role: build-dependency diff --git a/spec/build/testsuites/sptests/spunlimited01.yml b/spec/build/testsuites/sptests/spunlimited01.yml new file mode 100644 index 00..e0f530da74 --- /dev/null +++ b/spec/build/testsuites/sptests/spunlimited01.yml @@ -0,0 +1,20 @@ +SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause +build-type: test-program +cflags: [] +copyrights: +- Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) +cppflags: [] +cxxflags: [] +enabled-by: true +features: c cprogram +includes: [] +ldflags: +- -Wl,--wrap=_Workspace_Free +links: [] +source: +- testsuites/sptests/spunlimited01/init.c +stlib: [] +target: testsuites/sptests/spunlimited01.exe +type: build +use-after: [] +use-before: [] diff --git a/testsuites/sptests/spunlimited01/init.c b/testsuites/sptests/spunlimited01/init.c new file mode 100644 index 00..ce64324768 --- /dev/null +++ b/testsuites/sptests/spunlimited01/init.c @@ -0,0 +1,125 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (C) 2022 embedded brains GmbH (http://www.embedded-brains.de) + * + * 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_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include + +#include +#include + +const char rtems_test_name[] = "SPUNLIMITED 1"; + +void __real__Workspace_Free( void * ); +void __wrap__Workspace_Free( void * ); + +void __wrap__Workspace_Free( void *ptr ) +{ + uintptr_t alloc_begin; + uintptr_t block_size; + uintptr_t block_end; + Heap_Block *block; + + if ( ptr == NULL ) { +return; + } + + alloc_begin = (uintptr_t) ptr; + block = _Heap_Block_of_alloc_area( alloc_begin, CPU_HEAP_ALIGNMENT ); + block_size = _Heap_Block_size( block ); + block_end = (uintptr_t) block + block_size; + memset( ptr, 0, block_end - alloc_begin ); + + __real__Workspace_Free( ptr ); +} + +static void delete_mutex( rtems_id id ) +{ + rtems_status_code sc; + + sc = rtems_semaphore_delete( id ); + T_rsc_success( sc ); +} + +T_TEST_CASE( UnlimitedShrink ) +{ + rtems_id ids[ 6 ]; + size_t i; + rtems_status_code sc; + + for ( i = 0; i < RTEMS_ARRAY_SIZE( ids ); ++i ) { +sc = rtems_semaphore_create( + rtems_build_name( 'M', 'U', 'T', 'X' ), + 1, + RTEMS_BINARY_SEMAPHORE, + 0, + [ i ] +); +T_assert_rsc_success( sc ); + } + + sc = rtems_semaphore_obtain( ids[ 2 ], RTEMS_WAIT, RTEMS_NO_TIMEOUT ); + T_rsc_success( sc ); + + delete_mutex( ids[ 5 ] ); + delete_mutex( ids[ 4 ] ); + delete_mutex( ids[ 3 ] ); + + sc = rtems_semaphore_release( ids[ 2 ] ); + T_rsc_success( sc ); + + delete_mutex( ids[ 2 ] ); + delete_mutex( ids[ 1 ] ); + delete_mutex( ids[ 0 ] ); +} + +static rtems_task Init( rtems_task_argument argument ) +{ + rtems_test_run( argument, TEST_STATE ); +} + +#define
[PATCH 1/3] score: Fix _Objects_Active_count()
With unlimited objects the object maximum may be larger than the sum of active and inactive objects. --- cpukit/score/src/objectactivecount.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/cpukit/score/src/objectactivecount.c b/cpukit/score/src/objectactivecount.c index 028058e473..5f0304fead 100644 --- a/cpukit/score/src/objectactivecount.c +++ b/cpukit/score/src/objectactivecount.c @@ -46,14 +46,22 @@ Objects_Maximum _Objects_Active_count( const Objects_Information *information ) { - Objects_Maximum inactive; - Objects_Maximum maximum; + Objects_Maximum active; + Objects_Maximum index; + Objects_Maximum maximum; + Objects_Control **local_table; _Assert( _Objects_Allocator_is_owner() ); - inactive = (Objects_Maximum) -_Chain_Node_count_unprotected( >Inactive ); + active = 0; maximum = _Objects_Get_maximum_index( information ); + local_table = information->local_table; - return maximum - inactive; + for ( index = 0; index < maximum; ++index ) { +if ( local_table[ index ] != NULL ) { + ++active; +} + } + + return active; } -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] cdtest: Restrict exceptions during sysinit
Exceptions during system initialization work only on targets which do not need a registration of exception frames during the global construction. In particular, targets which use the DWARF2 unwinder cannot use exceptions during system initialization. --- testsuites/samples/cdtest/main.cc | 14 ++ 1 file changed, 14 insertions(+) diff --git a/testsuites/samples/cdtest/main.cc b/testsuites/samples/cdtest/main.cc index 44cdaf84bb..d5530a657d 100644 --- a/testsuites/samples/cdtest/main.cc +++ b/testsuites/samples/cdtest/main.cc @@ -238,6 +238,17 @@ rtems_task main_task( exit(0); } +/* + * Exceptions during system initialization work only on targets which do not + * need a registration of exception frames during the global construction. In + * particular, targets which use the DWARF2 unwinder cannot use exceptions + * during system initialization. + */ +#if defined(__arm__) || defined(__aarch64__) +#define CAN_DO_EXCEPTIONS_DURING_SYSINIT +#endif + +#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT static void early_exception() { try @@ -250,11 +261,13 @@ static void early_exception() throw "early exception 2"; } } +#endif static void test_exceptions_during_system_init() { TEST_BEGIN(); +#ifdef CAN_DO_EXCEPTIONS_DURING_SYSINIT try { early_exception(); @@ -263,6 +276,7 @@ static void test_exceptions_during_system_init() { rtems_test_assert(strcmp(e, "early exception 2") == 0); } +#endif } RTEMS_SYSINIT_ITEM( -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 0/2] Add support for using TLS in Newlib
This patch set adds support for the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option. By default, Newlib uses a huge object of type struct _reent to store thread-specific data. This object is returned by __getreent() if the __DYNAMIC_REENT__ Newlib configuration option is defined. The reentrancy structure contains for example errno and the standard input, output, and error file streams. This means that if an application only uses errno it has a dependency on the file stream support even if it does not use it. This is an issue for lower end targets and applications which need to qualify the software according to safety standards (for example ECSS-E-ST-40C, ECSS-Q-ST-80C, IEC 61508, ISO 26262, DO-178, DO-330, DO-333). If the new _REENT_THREAD_LOCAL configuration option is enabled, then struct _reent is replaced by dedicated thread-local objects for each struct _reent member. The thread-local objects are defined in translation units which use the corresponding object. Matt Joyce (2): sptests: Disable Newlib reentrancy Support _REENT_THREAD_LOCAL Newlib configuration cpukit/include/rtems/confdefs/newlib.h| 3 +- cpukit/include/rtems/confdefs/threads.h | 6 ++-- cpukit/include/rtems/libcsupport.h| 28 +++ cpukit/include/rtems/score/thread.h | 4 +++ cpukit/libcsupport/src/newlibc_reent.c| 6 testsuites/libtests/newlib01/init.c | 11 +--- testsuites/sptests/sp01/system.h | 7 + testsuites/sptests/spstkalloc02/init.c| 7 + .../sptests/spstkalloc02/spstkalloc02.doc | 2 +- testsuites/sptests/sptls03/init.c | 7 + 10 files changed, 62 insertions(+), 19 deletions(-) -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH 2/2] Support _REENT_THREAD_LOCAL Newlib configuration
From: Matt Joyce In case the Newlib _REENT_THREAD_LOCAL configuration option is enabled, the struct _reent is not defined (there is only a forward declaration in ). Instead, the usual members of struct _reent are available as dedicatd thread-local storage objects. Update #4560. --- cpukit/include/rtems/confdefs/newlib.h | 3 ++- cpukit/include/rtems/confdefs/threads.h | 6 -- cpukit/include/rtems/libcsupport.h | 28 +++-- cpukit/include/rtems/score/thread.h | 4 cpukit/libcsupport/src/newlibc_reent.c | 6 ++ testsuites/libtests/newlib01/init.c | 11 ++ 6 files changed, 40 insertions(+), 18 deletions(-) diff --git a/cpukit/include/rtems/confdefs/newlib.h b/cpukit/include/rtems/confdefs/newlib.h index 96bf850163..fef71a8855 100644 --- a/cpukit/include/rtems/confdefs/newlib.h +++ b/cpukit/include/rtems/confdefs/newlib.h @@ -57,7 +57,8 @@ extern "C" { #endif -#ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY +#if defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY) && \ + !defined(_REENT_THREAD_LOCAL) struct _reent *__getreent( void ) { return _Thread_Get_executing()->libc_reent; diff --git a/cpukit/include/rtems/confdefs/threads.h b/cpukit/include/rtems/confdefs/threads.h index 503a4b20ec..8e4537f90b 100644 --- a/cpukit/include/rtems/confdefs/threads.h +++ b/cpukit/include/rtems/confdefs/threads.h @@ -159,7 +159,8 @@ struct Thread_Configured_control { #if CONFIGURE_MAXIMUM_THREAD_NAME_SIZE > 1 char name[ CONFIGURE_MAXIMUM_THREAD_NAME_SIZE ]; #endif - #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY + #if defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY) && \ +!defined(_REENT_THREAD_LOCAL) struct _reent Newlib; #endif }; @@ -175,7 +176,8 @@ const Thread_Control_add_on _Thread_Control_add_ons[] = { ), offsetof( Thread_Configured_control, API_RTEMS ) } - #ifdef _CONFIGURE_ENABLE_NEWLIB_REENTRANCY + #if defined(_CONFIGURE_ENABLE_NEWLIB_REENTRANCY) && \ +!defined(_REENT_THREAD_LOCAL) , { offsetof( Thread_Configured_control, diff --git a/cpukit/include/rtems/libcsupport.h b/cpukit/include/rtems/libcsupport.h index 212eb16e59..67a09dc2a2 100644 --- a/cpukit/include/rtems/libcsupport.h +++ b/cpukit/include/rtems/libcsupport.h @@ -96,27 +96,33 @@ extern int malloc_info(Heap_Information_block *the_info); /* * Prototypes required to install newlib reentrancy user extension */ + +#ifdef _REENT_THREAD_LOCAL +#define _NEWLIB_CREATE_HOOK NULL +#else bool newlib_create_hook( rtems_tcb *current_task, rtems_tcb *creating_task ); +#define _NEWLIB_CREATE_HOOK newlib_create_hook +#endif void newlib_terminate_hook( rtems_tcb *current_task ); #define RTEMS_NEWLIB_EXTENSION \ -{ \ - newlib_create_hook, /* rtems_task_create */ \ - 0, /* rtems_task_start */ \ - 0, /* rtems_task_restart */ \ - 0, /* rtems_task_delete */ \ - 0, /* task_switch */ \ - 0, /* task_begin */ \ - 0, /* task_exitted */ \ - 0, /* fatal*/ \ - newlib_terminate_hook /* thread terminate */ \ -} + { \ +_NEWLIB_CREATE_HOOK, /* thread_create*/ \ +NULL, /* thread_start */ \ +NULL, /* thread_restart */ \ +NULL, /* thread_delete*/ \ +NULL, /* thread_switch*/ \ +NULL, /* thread_begin */ \ +NULL, /* thread_exitted */ \ +NULL, /* fatal*/ \ +newlib_terminate_hook /* thread_terminate */ \ + } typedef struct { uint32_t active_barriers; diff --git a/cpukit/include/rtems/score/thread.h b/cpukit/include/rtems/score/thread.h index dd32b51a5f..94eab18ea3 100644 --- a/cpukit/include/rtems/score/thread.h +++ b/cpukit/include/rtems/score/thread.h @@ -921,8 +921,12 @@ struct _Thread_Control { */ Context_Control_fp *fp_context; #endif + +#ifndef _REENT_THREAD_LOCAL /** This field points to the newlib reentrancy structure for this thread. */ struct _reent*libc_reent; +#endif + /** This array contains the API extension area pointers. */ void *API_Extensions[ THREAD_API_LAST + 1 ]; diff --git a/cpukit/libcsupport/src/newlibc_reent.c b/cpukit/libcsupport/src/newlibc_reent.c index 2dccfd0375..ee82f00858 100644 --- a/cpukit/libcsupport/src/newlibc_reent.c +++ b/cpukit/libcsupport/src/newlibc_reent.c @@ -29,6 +29,7 @@ #include #include +#ifndef _REENT_THREAD_LOCAL bool newlib_create_hook( rtems_tcb *current_task RTEMS_UNUSED, rtems_tcb *creating_task @@ -38,12 +39,17 @@ bool newlib_create_hook( return true; } +#endif void newlib_terminate_hook( rtems_tcb *current_task ) { +#ifdef _REENT_THREAD_LOCAL + _reclaim_reent(NULL); +#else
[PATCH 1/2] sptests: Disable Newlib reentrancy
From: Matt Joyce Update #4560. --- testsuites/sptests/sp01/system.h | 7 +++ testsuites/sptests/spstkalloc02/init.c | 7 +++ testsuites/sptests/spstkalloc02/spstkalloc02.doc | 2 +- testsuites/sptests/sptls03/init.c| 7 +++ 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/testsuites/sptests/sp01/system.h b/testsuites/sptests/sp01/system.h index 46fa76f1e4..782fd929a7 100644 --- a/testsuites/sptests/sp01/system.h +++ b/testsuites/sptests/sp01/system.h @@ -48,6 +48,13 @@ rtems_task Task_1_through_3( */ #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM +/* + * This test requires full control over the present thread-local objects. In + * certain Newlib configurations, the Newlib reentrancy support may add + * thread-local objects. + */ +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY + #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION #define CONFIGURE_RTEMS_INIT_TASKS_TABLE diff --git a/testsuites/sptests/spstkalloc02/init.c b/testsuites/sptests/spstkalloc02/init.c index 5e5db20f0f..3613a6a563 100644 --- a/testsuites/sptests/spstkalloc02/init.c +++ b/testsuites/sptests/spstkalloc02/init.c @@ -138,6 +138,13 @@ static rtems_task Init(rtems_task_argument argument) */ #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM +/* + * This test requires full control over the present thread-local objects. This + * is necessary for the custom stack allocator below. In certain Newlib + * configurations, the Newlib reentrancy support may add thread-local objects. + */ +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY + #define CONFIGURE_MAXIMUM_TASKS TASK_COUNT #define CONFIGURE_TASK_STACK_ALLOCATOR_INIT task_stack_init diff --git a/testsuites/sptests/spstkalloc02/spstkalloc02.doc b/testsuites/sptests/spstkalloc02/spstkalloc02.doc index a2dd0357ba..f4c09b4558 100644 --- a/testsuites/sptests/spstkalloc02/spstkalloc02.doc +++ b/testsuites/sptests/spstkalloc02/spstkalloc02.doc @@ -26,7 +26,7 @@ This file describes the directives and concepts tested by this test set. -test set name: spstkalloc01 +test set name: spstkalloc02 The test expects that no thread-local object is present. diff --git a/testsuites/sptests/sptls03/init.c b/testsuites/sptests/sptls03/init.c index 2b60828808..6625327f45 100644 --- a/testsuites/sptests/sptls03/init.c +++ b/testsuites/sptests/sptls03/init.c @@ -68,6 +68,13 @@ static void Init(rtems_task_argument arg) */ #define CONFIGURE_APPLICATION_DISABLE_FILESYSTEM +/* + * This test requires full control over the present thread-local objects. In + * certain Newlib configurations, the Newlib reentrancy support may add + * thread-local objects. + */ +#define CONFIGURE_DISABLE_NEWLIB_REENTRANCY + #define CONFIGURE_MAXIMUM_TASKS 1 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[RSB 1/3] 6/7: Update Newlib
This makes the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option available. Update #4560. --- .../config/tools/rtems-gcc-10-newlib-head.cfg | 4 +-- .../tools/rtems-gcc-10.4-newlib-ea99f21.cfg | 27 +++ .../config/tools/rtems-gcc-12-newlib-head.cfg | 4 +-- .../tools/rtems-gcc-head-newlib-head.cfg | 4 +-- 4 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 rtems/config/tools/rtems-gcc-10.4-newlib-ea99f21.cfg diff --git a/rtems/config/tools/rtems-gcc-10-newlib-head.cfg b/rtems/config/tools/rtems-gcc-10-newlib-head.cfg index 1d08b61..07f92d1 100644 --- a/rtems/config/tools/rtems-gcc-10-newlib-head.cfg +++ b/rtems/config/tools/rtems-gcc-10-newlib-head.cfg @@ -16,11 +16,11 @@ %patch add newlib -p1 https://devel.rtems.org/raw-attachment/ticket/4510/0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch %hash sha512 0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch 7ca237eabfd5b382713186e1fc290dfc999a353315795ecb8dd0d22fcd1ab7f5bf31f4329954adab91ad04c100dcac0e86d406fdbce8f82cf9dc23842c88caf6 -%define newlib_version 27fd806 +%define newlib_version ea99f21 %define newlib_external 1 %define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version} %source set newlib --rsb-file=newlib-%{newlib_version}.tar.gz https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/%{newlib_version} -%hash sha512 newlib-%{newlib_version}.tar.gz 02fc2a0ffc8bf581f3f98deab582469130cfd6e10983b2be69f9971a326bbc9abedd1e828f990ae69ea984fd5dcad0889345ccab37d83c2f025437f65c53dab6 +%hash sha512 newlib-%{newlib_version}.tar.gz a4216024740c7d5ae6d21a6ab731dcf0bd7a4d70710bc1e79683e7d819812829216df08cd54d0ce7d61c2a959924419ea89367e4c6fb442e59839cacd85d2c52 %define with_threads 1 %define with_plugin 0 diff --git a/rtems/config/tools/rtems-gcc-10.4-newlib-ea99f21.cfg b/rtems/config/tools/rtems-gcc-10.4-newlib-ea99f21.cfg new file mode 100644 index 000..270b5ad --- /dev/null +++ b/rtems/config/tools/rtems-gcc-10.4-newlib-ea99f21.cfg @@ -0,0 +1,27 @@ +%include %{_configdir}/checks.cfg +%include %{_configdir}/base.cfg + +%define gcc_version 10.4.0 +%source set gcc https://ftp.gnu.org/gnu/gcc/gcc-%{gcc_version}/gcc-%{gcc_version}.tar.xz +%hash sha512 gcc-%{gcc_version}.tar.xz 440c08ca746da450d9a1b35e8fd2305cb27e7e6987cd9d0f7d375f3b1fc9e4b0bd7acb3cd7bf795e72fcbead59cdef5b6c152862f5d35cd9fbfe6902101ce648 + +%patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4196/0001-Back-port-v8-of-gcov-improvements-to-GCC-10.patch +%hash sha512 0001-Back-port-v8-of-gcov-improvements-to-GCC-10.patch c2d1faed68aa0f60bef917365545cc4cc899df428a5d08f178417c06def4fd3cd3a749c1871c8a22552022c29dfae4a3d21161e2b01291e458ea8d670f01887e + +%patch add gcc -p1 https://devel.rtems.org/raw-attachment/ticket/4215/0001-nios2-Remove-custom-instruction-warnings.patch +%hash sha512 0001-nios2-Remove-custom-instruction-warnings.patch afd8a5e6bdcc5b75d5fbbf558bdf56ccac400521a6eec9d88cc95f6be67c481f2dbf8faa0f6ddc1e4ac7c56a84938714d80e46e9cf80ec4b8fcd739986449881 + +%patch add newlib -p1 https://devel.rtems.org/raw-attachment/ticket/4510/0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch +%hash sha512 0001-aarch64-Add-ILP32-ABI-support-in-assembly-v2.patch 7ca237eabfd5b382713186e1fc290dfc999a353315795ecb8dd0d22fcd1ab7f5bf31f4329954adab91ad04c100dcac0e86d406fdbce8f82cf9dc23842c88caf6 + +%define newlib_version ea99f21 +%define newlib_external 1 +%define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version} +%source set newlib --rsb-file=newlib-%{newlib_version}.tar.gz https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/%{newlib_version} +%hash sha512 newlib-%{newlib_version}.tar.gz a4216024740c7d5ae6d21a6ab731dcf0bd7a4d70710bc1e79683e7d819812829216df08cd54d0ce7d61c2a959924419ea89367e4c6fb442e59839cacd85d2c52 + +%define with_threads 1 +%define with_plugin 0 +%define with_iconv 1 + +%include %{_configdir}/gcc-10.cfg diff --git a/rtems/config/tools/rtems-gcc-12-newlib-head.cfg b/rtems/config/tools/rtems-gcc-12-newlib-head.cfg index cec65a8..a15fcf2 100644 --- a/rtems/config/tools/rtems-gcc-12-newlib-head.cfg +++ b/rtems/config/tools/rtems-gcc-12-newlib-head.cfg @@ -27,11 +27,11 @@ %hash sha512 fix-mac-arm64-mpc-config.patch 2849b11e360ea98e0b4d708c67723ad2d6c7bac6d1e469673f408b0111cf0278429e8bc38fd2b7538dc2d5bb0cc430c646a0fa7f0b6b105a0482a5455fadc8b9 # Comment above related to #4657 and patches ends here -%define newlib_version 27fd806 +%define newlib_version ea99f21 %define newlib_external 1 %define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version} %source set newlib --rsb-file=newlib-%{newlib_version}.tar.gz https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/%{newlib_version} -%hash sha512 newlib-%{newlib_version}.tar.gz
[RSB 3/3] 6/7: Use TLS in Newlib
Use the --enable-newlib-reent-thread-local (_REENT_THREAD_LOCAL_STORAGE) Newlib configuration option on all targets which support thread-local storage. Update #4560. --- rtems/config/6/rtems-aarch64.bset| 1 + rtems/config/6/rtems-arm.bset| 1 + rtems/config/6/rtems-i386.bset | 1 + rtems/config/6/rtems-m68k.bset | 1 + rtems/config/6/rtems-microblaze.bset | 1 + rtems/config/6/rtems-nios2.bset | 1 + rtems/config/6/rtems-powerpc.bset| 1 + rtems/config/6/rtems-riscv.bset | 1 + rtems/config/6/rtems-sparc.bset | 1 + rtems/config/6/rtems-x86_64.bset | 1 + rtems/config/7/rtems-aarch64.bset| 1 + rtems/config/7/rtems-arm.bset| 1 + rtems/config/7/rtems-i386.bset | 1 + rtems/config/7/rtems-m68k.bset | 1 + rtems/config/7/rtems-microblaze.bset | 1 + rtems/config/7/rtems-nios2.bset | 1 + rtems/config/7/rtems-powerpc.bset| 1 + rtems/config/7/rtems-riscv.bset | 1 + rtems/config/7/rtems-sparc.bset | 1 + rtems/config/7/rtems-x86_64.bset | 1 + 20 files changed, 20 insertions(+) diff --git a/rtems/config/6/rtems-aarch64.bset b/rtems/config/6/rtems-aarch64.bset index e3c91af..99051eb 100644 --- a/rtems/config/6/rtems-aarch64.bset +++ b/rtems/config/6/rtems-aarch64.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch aarch64 %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-arm.bset b/rtems/config/6/rtems-arm.bset index 425d66b..c4e6613 100644 --- a/rtems/config/6/rtems-arm.bset +++ b/rtems/config/6/rtems-arm.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch arm %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-i386.bset b/rtems/config/6/rtems-i386.bset index a27319d..99a6d98 100644 --- a/rtems/config/6/rtems-i386.bset +++ b/rtems/config/6/rtems-i386.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch i386 %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-m68k.bset b/rtems/config/6/rtems-m68k.bset index 0932d20..a8e758b 100644 --- a/rtems/config/6/rtems-m68k.bset +++ b/rtems/config/6/rtems-m68k.bset @@ -1,3 +1,4 @@ %define release 1 %define rtems_arch m68k +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-microblaze.bset b/rtems/config/6/rtems-microblaze.bset index ea59313..17b674e 100644 --- a/rtems/config/6/rtems-microblaze.bset +++ b/rtems/config/6/rtems-microblaze.bset @@ -1,5 +1,6 @@ %define release 1 %define rtems_arch microblaze +%define with_newlib_tls # # Default tools configuration. diff --git a/rtems/config/6/rtems-nios2.bset b/rtems/config/6/rtems-nios2.bset index 522eff5..d45024d 100644 --- a/rtems/config/6/rtems-nios2.bset +++ b/rtems/config/6/rtems-nios2.bset @@ -1,3 +1,4 @@ %define release 1 %define rtems_arch nios2 +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-powerpc.bset b/rtems/config/6/rtems-powerpc.bset index c19327a..3309057 100644 --- a/rtems/config/6/rtems-powerpc.bset +++ b/rtems/config/6/rtems-powerpc.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch powerpc %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset diff --git a/rtems/config/6/rtems-riscv.bset b/rtems/config/6/rtems-riscv.bset index ad7cb5b..ec1ab3a 100644 --- a/rtems/config/6/rtems-riscv.bset +++ b/rtems/config/6/rtems-riscv.bset @@ -1,5 +1,6 @@ %define release 1 %define rtems_arch riscv %define with_libgomp +%define with_newlib_tls %include 6/rtems-default.bset devel/sis-2-1 diff --git a/rtems/config/6/rtems-sparc.bset b/rtems/config/6/rtems-sparc.bset index 48d152d..809d47e 100644 --- a/rtems/config/6/rtems-sparc.bset +++ b/rtems/config/6/rtems-sparc.bset @@ -1,6 +1,7 @@ %define release 1 %define rtems_arch sparc %define with_libgomp +%define with_newlib_tls %define gdb-disable-sim 1 %include 6/rtems-default.bset devel/sis-2-1 diff --git a/rtems/config/6/rtems-x86_64.bset b/rtems/config/6/rtems-x86_64.bset index 088c9f5..1f2cefb 100644 --- a/rtems/config/6/rtems-x86_64.bset +++ b/rtems/config/6/rtems-x86_64.bset @@ -1,6 +1,7 @@ %define release 1 %define rtems_arch x86_64 %define with_libgomp +%define with_newlib_tls %define grub2_platform efi %define grub2_target x86_64 diff --git a/rtems/config/7/rtems-aarch64.bset b/rtems/config/7/rtems-aarch64.bset index fc794aa..d899dc7 100644 --- a/rtems/config/7/rtems-aarch64.bset +++ b/rtems/config/7/rtems-aarch64.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch aarch64 %define with_libgomp +%define with_newlib_tls %include 7/rtems-default.bset diff --git a/rtems/config/7/rtems-arm.bset b/rtems/config/7/rtems-arm.bset index 7518812..a9bd612 100644 --- a/rtems/config/7/rtems-arm.bset +++ b/rtems/config/7/rtems-arm.bset @@ -1,4 +1,5 @@ %define release 1 %define rtems_arch arm %define with_libgomp +%define
[RSB 2/3] newlib: Support "with_newlib_tls"
Update #4560. --- source-builder/config/gcc-common-1.cfg | 1 + 1 file changed, 1 insertion(+) diff --git a/source-builder/config/gcc-common-1.cfg b/source-builder/config/gcc-common-1.cfg index 694a1f3..f6ec883 100644 --- a/source-builder/config/gcc-common-1.cfg +++ b/source-builder/config/gcc-common-1.cfg @@ -192,6 +192,7 @@ URL: http://gcc.gnu.org/ --enable-version-specific-runtime-libs \ --enable-newlib-io-c99-formats \ %{?disable_MAKEINFO:MAKEINFO=missing} \ +%{?with_newlib_tls:--enable-newlib-reent-thread-local} \ %{?with_iconv:--enable-newlib-iconv} \ %{?with_iconv:--enable-newlib-iconv-encodings=%{_newlib_iconv_encodings}} \ %{?with_threads:--enable-threads}%{!?with_threads:--disable-threads} \ -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
Re: [PATCH] samples/cdtest: Test execeptions during system init
On 01/07/2022 12:02, Sebastian Huber wrote: +static void early_exception() +{ +try +{ + throw "early exception"; +} +catch( const char *e ) +{ + rtems_test_assert(strcmp(e, "early exception") == 0); + throw "early exception 2"; +} +} + +static void test_exceptions_during_system_init() +{ +TEST_BEGIN(); + +try +{ + early_exception(); +} +catch( const char *e ) +{ + rtems_test_assert(strcmp(e, "early exception 2") == 0); +} +} + +RTEMS_SYSINIT_ITEM( +test_exceptions_during_system_init, +RTEMS_SYSINIT_IDLE_THREADS, +RTEMS_SYSINIT_ORDER_LAST +); Actually, on targets which use the DWARF2 unwinder (for example sparc), this doesn't work since the exception frames are no yet registered. They are registered during global construction. This also means that C++ exceptions can only be used once the global construction completed on these targets. -- 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] spextensions01: Fix assertion
Commit 80090639a62b50d7d66614ca789e4592924a06e5 altered the system state change. Account for this in assert_allocator_protected_thread_context(). --- testsuites/sptests/spextensions01/init.c | 13 +++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/testsuites/sptests/spextensions01/init.c b/testsuites/sptests/spextensions01/init.c index 66e8fac260..ceae2d3062 100644 --- a/testsuites/sptests/spextensions01/init.c +++ b/testsuites/sptests/spextensions01/init.c @@ -30,6 +30,11 @@ static int active_extensions = 2; static rtems_id master_task; +static bool before_initialization(void) +{ + return _System_state_Is_before_initialization(_System_state_Get()); +} + static bool before_multitasking(void) { return _System_state_Is_before_multitasking(_System_state_Get()); @@ -61,9 +66,13 @@ static void assert_life_protected_thread_context(void) static void assert_allocator_protected_thread_context(void) { - assert(_Thread_Dispatch_is_enabled() || before_multitasking()); + assert( +_Thread_Dispatch_is_enabled() || +before_initialization() || +before_multitasking() + ); assert(_RTEMS_Allocator_is_owner()); - assert(life_protected() || before_multitasking()); + assert(life_protected()); } static void assert_thread_dispatch_disabled_context(void) -- 2.35.3 ___ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel
[PATCH] validation: SMP-specific spurious interrupt test
Update #3716. --- .../validation/tc-bsp-interrupt-spurious.c| 148 +++--- 1 file changed, 125 insertions(+), 23 deletions(-) diff --git a/testsuites/validation/tc-bsp-interrupt-spurious.c b/testsuites/validation/tc-bsp-interrupt-spurious.c index 0cb14f8f1a..f5e992a51d 100644 --- a/testsuites/validation/tc-bsp-interrupt-spurious.c +++ b/testsuites/validation/tc-bsp-interrupt-spurious.c @@ -74,6 +74,12 @@ typedef enum { BspReqInterruptSpurious_Pre_First_NA } BspReqInterruptSpurious_Pre_First; +typedef enum { + BspReqInterruptSpurious_Pre_FirstAgain_Null, + BspReqInterruptSpurious_Pre_FirstAgain_Entry, + BspReqInterruptSpurious_Pre_FirstAgain_NA +} BspReqInterruptSpurious_Pre_FirstAgain; + typedef enum { BspReqInterruptSpurious_Post_Result_FatalError, BspReqInterruptSpurious_Post_Result_Dispatch, @@ -93,6 +99,7 @@ typedef enum { typedef struct { uint8_t Skip : 1; uint8_t Pre_First_NA : 1; + uint8_t Pre_FirstAgain_NA : 1; uint8_t Post_Result : 2; uint8_t Post_FatalSource : 1; uint8_t Post_FatalCode : 1; @@ -153,11 +160,23 @@ typedef struct { */ rtems_interrupt_entry **first; + /** + * @brief This member references an interrupt entry for the first entry of + * the interrupt vector or is NULL. + */ + rtems_interrupt_entry *first_again; + struct { +/** + * @brief This member defines the pre-condition indices for the next + * action. + */ +size_t pci[ 2 ]; + /** * @brief This member defines the pre-condition states for the next action. */ -size_t pcs[ 1 ]; +size_t pcs[ 2 ]; /** * @brief If this member is true, then the test action loop is executed. @@ -191,8 +210,15 @@ static const char * const BspReqInterruptSpurious_PreDesc_First[] = { "NA" }; +static const char * const BspReqInterruptSpurious_PreDesc_FirstAgain[] = { + "Null", + "Entry", + "NA" +}; + static const char * const * const BspReqInterruptSpurious_PreDesc[] = { BspReqInterruptSpurious_PreDesc_First, + BspReqInterruptSpurious_PreDesc_FirstAgain, NULL }; @@ -271,8 +297,9 @@ static void BspReqInterruptSpurious_Pre_First_Prepare( switch ( state ) { case BspReqInterruptSpurious_Pre_First_Null: { /* - * While the pointer to the first interrupt entry of the interrupt vector - * specified by the ``vector`` parameter is equal to NULL. + * While the first loaded value of the pointer to the first interrupt + * entry of the interrupt vector specified by the ``vector`` parameter is + * equal to NULL. */ *ctx->first = NULL; break; @@ -280,9 +307,9 @@ static void BspReqInterruptSpurious_Pre_First_Prepare( case BspReqInterruptSpurious_Pre_First_Entry: { /* - * While the pointer to the first interrupt entry of the interrupt vector - * specified by the ``vector`` parameter references an object of type - * rtems_interrupt_entry. + * While the first loaded value of the pointer to the first interrupt + * entry of the interrupt vector specified by the ``vector`` parameter + * references an object of type rtems_interrupt_entry. */ *ctx->first = >entry; break; @@ -293,6 +320,37 @@ static void BspReqInterruptSpurious_Pre_First_Prepare( } } +static void BspReqInterruptSpurious_Pre_FirstAgain_Prepare( + BspReqInterruptSpurious_Context *ctx, + BspReqInterruptSpurious_Pre_FirstAgain state +) +{ + switch ( state ) { +case BspReqInterruptSpurious_Pre_FirstAgain_Null: { + /* + * While the second loaded value of the pointer to the first interrupt + * entry of the interrupt vector specified by the ``vector`` parameter is + * equal to NULL. + */ + ctx->first_again = NULL; + break; +} + +case BspReqInterruptSpurious_Pre_FirstAgain_Entry: { + /* + * While the second loaded value of the pointer to the first interrupt + * entry of the interrupt vector specified by the ``vector`` parameter + * references an object of type rtems_interrupt_entry. + */ + ctx->first_again = >entry; + break; +} + +case BspReqInterruptSpurious_Pre_FirstAgain_NA: + break; + } +} + static void BspReqInterruptSpurious_Post_Result_Check( BspReqInterruptSpurious_Context*ctx, BspReqInterruptSpurious_Post_Result state @@ -416,39 +474,62 @@ static void BspReqInterruptSpurious_Action( BspReqInterruptSpurious_Context *ctx ) { - rtems_status_code sc; - ctx->interrupt_occurred = false; ctx->entry_counter = 0; ctx->fatal_counter = 0; ctx->fatal_source = RTEMS_FATAL_SOURCE_LAST; ctx->fatal_code = UINT32_MAX; - (void) rtems_interrupt_vector_enable( ctx->test_vector ); + #if defined(RTEMS_SMP) + if ( *ctx->first == NULL && ctx->first_again != NULL ) { +*ctx->first = ctx->first_again; +bsp_interrupt_spurious( ctx->test_vector ); + } else + #endif + { +rtems_status_code sc;
Re: [PATCH v3] irq/arm-gicv3.h: Customize CPU Interface init
On 12/07/2022 08:25, Chris Johns wrote: On 11/7/2022 7:16 pm, Sebastian Huber wrote: Use the existing WRITE_SR() abstraction to access the interrupt group 0 and 1 enable registers. This fixes the build for the AArch32 target. Add BSP options which define the initial values of CPU Interface registers. --- v3: * Fix variant-specific default values. * Add BSP options for ICC_BPR0, ICC_BPR1, ICC_CTRL, ICC_PMR, and ICC_SRE. Looks good and tested on Versal hardware. Thanks for testing the patch. I checked it in. -- 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: [libbsd 00/22] Remove FreeBSD file descriptors and avoid VFS
On 24/06/2022 08:33, Sebastian Huber wrote: This patch set removes the FreeBSD file descriptors. The VFS is no longer used if only the USB, SD/MMC, network, PCI, and NVMe support is used by the application. This change significantly reduce the memory usage of LibBSD for these applications. Using the media01 test case for the arm/lpc32xx BSP as a benchmark, the heap usage dropped from 14.3MiB to 10.2MiB. The "_BSD bufdaemon", "_BSD vnlru", "_BSD syncer", and "_BSD bufspacedaemon-" tasks are no longer present in media01. The code size is reduced by about 8KiB. The data size is reduced by about 30KiB. The throughput with a simple FTP test increased by about 1%. The "Remove FreeBSD file descriptors" change removes more lines than there are added. This change makes it easier to port the NFS support to the master branch since now the changes are more localized. I have a target with only 8MiB of RAM (for code and data). So, this patch set is not just a micro optimization. -- 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: [newlib 00/65] Update FreeBSD baseline
On 07/07/2022 13:58, Sebastian Huber wrote: This patch set updates the header files imported from FreeBSD to the current FreeBSD head: commit 3bf66365129a13933f77d1f4421d5136861cffb4 Author: Brooks Davis Date: Wed Jul 6 14:03:48 2022 +0100 cddl/*: add a WITH(OUT)_DTRACE option Add an option to enable/disable DTrace without disabling ZFS. New architectures such as CHERI may support ZFS before they support DTrace and the old model of WITHOUT_CDDL disabling both wasn't helpful. For compatiblity, the CDDL option remains and WITHOUT_CDDL implies WITHOUT_DTRACE. WITHOUT_DTRACE also implies WITHOUT_CTF. As part of this change, largely convert cddl/*/Makefile to using the more compact SUBDIR.${MK_}+= form rather than using intermediate variables. Reviewed by:markj Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D35718 The patch set and the following patch sets for RTEMS and libbsd are required to be able to update the FreeBSD baseline of libbsd branches. I checked in the updates from FreeBSD for Newlib, RTEMS, and libbsd. This is one prerequisite to update the FreeBSD baseline from about 2019. -- 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 v3] irq/arm-gicv3.h: Customize CPU Interface init
Use the existing WRITE_SR() abstraction to access the interrupt group 0 and 1 enable registers. This fixes the build for the AArch32 target. Add BSP options which define the initial values of CPU Interface registers. --- v3: * Fix variant-specific default values. * Add BSP options for ICC_BPR0, ICC_BPR1, ICC_CTRL, ICC_PMR, and ICC_SRE. bsps/include/dev/irq/arm-gicv3.h | 58 --- spec/build/bsps/aarch64/a53/grp.yml | 2 + spec/build/bsps/aarch64/a53/obj.yml | 1 - spec/build/bsps/aarch64/a72/grp.yml | 2 + spec/build/bsps/aarch64/a72/obj.yml | 1 - spec/build/bsps/aarch64/grp.yml | 1 - spec/build/bsps/aarch64/xilinx-versal/grp.yml | 2 + spec/build/bsps/aarch64/xilinx-versal/obj.yml | 1 - spec/build/bsps/arm/fvp/grp.yml | 2 + spec/build/bsps/arm/fvp/obj.yml | 1 - spec/build/bsps/arm/grp.yml | 1 - spec/build/bsps/dev/irq/objarmgicv3.yml | 31 ++ .../build/bsps/dev/irq/optarmgic-icc-bpr0.yml | 21 +++ .../build/bsps/dev/irq/optarmgic-icc-bpr1.yml | 18 ++ .../build/bsps/dev/irq/optarmgic-icc-ctrl.yml | 18 ++ .../bsps/dev/irq/optarmgic-icc-igrpen0.yml| 21 +++ .../bsps/dev/irq/optarmgic-icc-igrpen1.yml| 18 ++ spec/build/bsps/dev/irq/optarmgic-icc-pmr.yml | 18 ++ spec/build/bsps/dev/irq/optarmgic-icc-sre.yml | 18 ++ 19 files changed, 208 insertions(+), 27 deletions(-) create mode 100644 spec/build/bsps/dev/irq/objarmgicv3.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-bpr0.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-bpr1.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-ctrl.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-igrpen0.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-igrpen1.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-pmr.yml create mode 100644 spec/build/bsps/dev/irq/optarmgic-icc-sre.yml diff --git a/bsps/include/dev/irq/arm-gicv3.h b/bsps/include/dev/irq/arm-gicv3.h index a79368ebdf..a716ffbca5 100644 --- a/bsps/include/dev/irq/arm-gicv3.h +++ b/bsps/include/dev/irq/arm-gicv3.h @@ -116,13 +116,16 @@ extern "C" { #else /* ARM_MULTILIB_ARCH_V4 */ /* AArch64 GICv3 registers are not named in GCC */ -#define ICC_IGRPEN0 "S3_0_C12_C12_6, %0" -#define ICC_IGRPEN1 "S3_0_C12_C12_7, %0" +#define ICC_IGRPEN0_EL1 "S3_0_C12_C12_6, %0" +#define ICC_IGRPEN1_EL1 "S3_0_C12_C12_7, %0" #define ICC_IGRPEN1_EL3 "S3_6_C12_C12_7, %0" +#define ICC_IGRPEN0 ICC_IGRPEN0_EL1 +#define ICC_IGRPEN1 ICC_IGRPEN1_EL1 #define ICC_PMR "S3_0_C4_C6_0, %0" #define ICC_EOIR1 "S3_0_C12_C12_1, %0" #define ICC_SRE "S3_0_C12_C12_5, %0" #define ICC_BPR0"S3_0_C12_C8_3, %0" +#define ICC_BPR1"S3_0_C12_C12_3, %0" #define ICC_CTLR"S3_0_C12_C12_4, %0" #define ICC_IAR1"%0, S3_0_C12_C12_0" #define MPIDR "%0, mpidr_el1" @@ -300,25 +303,27 @@ static void gicv3_init_dist(volatile gic_dist *dist) } } -/* - * A better way to access these registers than special opcodes - */ -#define isb() __asm __volatile("isb" : : : "memory") +static void gicv3_init_cpu_interface(uint32_t cpu_index) +{ + /* Initialize Interrupt Controller System Register Enable Register */ +#ifdef BSP_ARM_GIC_ICC_SRE + WRITE_SR(ICC_SRE, BSP_ARM_GIC_ICC_SRE); +#endif -#define WRITE_SPECIALREG(reg, _val)\ - __asm __volatile("msr " __STRING(reg) ", %0" : : "r"((uint64_t)_val)) + /* Initialize Interrupt Controller Interrupt Priority Mask Register */ +#ifdef BSP_ARM_GIC_ICC_PMR + WRITE_SR(ICC_PMR, BSP_ARM_GIC_ICC_PMR); +#endif -#define gic_icc_write(reg, val)\ -do {\ - WRITE_SPECIALREG(icc_ ##reg ##_el1, val); \ - isb();\ -} while (0) + /* Initialize Interrupt Controller Binary Point Register 0 */ +#ifdef BSP_ARM_GIC_ICC_BPR0 + WRITE_SR(ICC_BPR0, BSP_ARM_GIC_ICC_BPR0); +#endif -static void gicv3_init_cpu_interface(uint32_t cpu_index) -{ - uint32_t sre_value = 0x7; - WRITE_SR(ICC_SRE, sre_value); - WRITE_SR(ICC_PMR, GIC_CPUIF_ICCPMR_PRIORITY(0xff)); + /* Initialize Interrupt Controller Binary Point Register 1 */ +#ifdef BSP_ARM_GIC_ICC_BPR1 + WRITE_SR(ICC_BPR1, BSP_ARM_GIC_ICC_BPR1); +#endif volatile gic_redist *redist = gicv3_get_redist(cpu_index); uint32_t waker = redist->icrwaker; @@ -334,9 +339,20 @@ static void gicv3_init_cpu_interface(uint32_t cpu_index) sgi_ppi->icspiprior[id] = PRIORITY_DEFAULT; } - /* Enable interrupt groups 0 and 1 */ - gic_icc_write(IGRPEN1, 1); - WRITE_SR(ICC_CTLR, 0x0); + /* Initialize Interrupt Controller Interrupt Group Enable 0 Register */ +#ifdef BSP_ARM_GIC_ICC_IGRPEN0 + WRITE_SR(ICC_IGRPEN0, BSP_ARM_GIC_ICC_IGRPEN0); +#endif + + /* Initialize Interrupt Controller Interrupt Group Enable 1 Register */ +#ifdef BSP_ARM_GIC_ICC_IGRPEN1 +
Re: [PATCH] bsps/microblaze: Fix build option definition order
On 07.07.22 21:19, Alex White wrote: The build option definitions were rearranged such that the option definitions used in the linker script were not available. This caused linker errors when building. Sorry for breaking the BSP. The patch looks good. -- 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