Re: [PATCH] first commit

2020-02-14 Thread suyash singh
Hello I am Suyash Singh and this is my first commit. I am from India and
currently in 2nd year of BTech Computer Science Engineering. I am hoping to
participate in RTEMS as a GSOC student and beyond.



On Sat, Feb 15, 2020 at 12:56 PM suyash singh 
wrote:

> ---
>  testsuites/samples/hello/init.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testsuites/samples/hello/init.c
> b/testsuites/samples/hello/init.c
> index 34ded37c55..7f165d17a5 100644
> --- a/testsuites/samples/hello/init.c
> +++ b/testsuites/samples/hello/init.c
> @@ -22,7 +22,7 @@ static rtems_task Init(
>  {
>rtems_print_printer_fprintf_putc(_test_printer);
>TEST_BEGIN();
> -  printf( "Hello World\n" );
> +  printf( "Hello RTEMS. I am Suyash Singh" );
>TEST_END();
>rtems_test_exit( 0 );
>  }
> --
> 2.17.1
>
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH] first commit

2020-02-14 Thread suyash singh
---
 testsuites/samples/hello/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuites/samples/hello/init.c b/testsuites/samples/hello/init.c
index 34ded37c55..7f165d17a5 100644
--- a/testsuites/samples/hello/init.c
+++ b/testsuites/samples/hello/init.c
@@ -22,7 +22,7 @@ static rtems_task Init(
 {
   rtems_print_printer_fprintf_putc(_test_printer);
   TEST_BEGIN();
-  printf( "Hello World\n" );
+  printf( "Hello RTEMS. I am Suyash Singh" );
   TEST_END();
   rtems_test_exit( 0 );
 }
-- 
2.17.1

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


Re: [PATCH 18/18] config: Add

2020-02-14 Thread Gedare Bloom
Hi Sebastian,

This makes sense. Is there any reason for the ordering?

If possible, I think grouping by obsoleted version or alphabetical ordering
would be a good idea.

On Fri, Feb 14, 2020 at 9:03 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Unify handling of obsolete configuration options.  Change license to
> BSD-2-Clause.
>
> Update #3053.
> Update #3875.
> ---
>  cpukit/header-dirs.am|   2 +
>  cpukit/headers.am|   1 +
>  cpukit/include/rtems/confdefs.h  | 156 +---
>  cpukit/include/rtems/confdefs/obsolete.h | 199
> +++
>  4 files changed, 203 insertions(+), 155 deletions(-)
>  create mode 100644 cpukit/include/rtems/confdefs/obsolete.h
>
> diff --git a/cpukit/header-dirs.am b/cpukit/header-dirs.am
> index 7197f1a29f..d90271be9e 100644
> --- a/cpukit/header-dirs.am
> +++ b/cpukit/header-dirs.am
> @@ -50,6 +50,8 @@ include_rtems_bfindir = $(includedir)/rtems/bfin
>  include_rtems_bfin_HEADERS =
>  include_rtems_bsdnetdir = $(includedir)/rtems/bsdnet
>  include_rtems_bsdnet_HEADERS =
> +include_rtems_confdefsdir = $(includedir)/rtems/confdefs
> +include_rtems_confdefs_HEADERS =
>  include_rtems_debuggerdir = $(includedir)/rtems/debugger
>  include_rtems_debugger_HEADERS =
>  include_rtems_m68kdir = $(includedir)/rtems/m68k
> diff --git a/cpukit/headers.am b/cpukit/headers.am
> index 6e1ab4ccd0..f0c8319dcb 100644
> --- a/cpukit/headers.am
> +++ b/cpukit/headers.am
> @@ -183,6 +183,7 @@ include_rtems_HEADERS += include/rtems/userenv.h
>  include_rtems_HEADERS += include/rtems/version.h
>  include_rtems_HEADERS += include/rtems/vmeintr.h
>  include_rtems_HEADERS += include/rtems/watchdogdrv.h
> +include_rtems_confdefs_HEADERS += include/rtems/confdefs/obsolete.h
>  include_rtems_debugger_HEADERS +=
> include/rtems/debugger/rtems-debugger-bsp.h
>  include_rtems_debugger_HEADERS +=
> include/rtems/debugger/rtems-debugger-remote.h
>  include_rtems_debugger_HEADERS +=
> include/rtems/debugger/rtems-debugger-server.h
> diff --git a/cpukit/include/rtems/confdefs.h
> b/cpukit/include/rtems/confdefs.h
> index e0d4a77075..cf58f5ecc2 100644
> --- a/cpukit/include/rtems/confdefs.h
> +++ b/cpukit/include/rtems/confdefs.h
> @@ -50,6 +50,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>
>  #include 
>
> @@ -138,11 +139,6 @@ extern "C" {
>  #endif
>  #endif
>
> -#ifdef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
> -  #warning "CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS has been renamed to
> CONFIGURE_MAXIMUM_FILE_DESCRIPTORS since RTEMS 5.1"
> -  #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS
> CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
> -#endif
> -
>  /**
>   * This macro defines the number of POSIX file descriptors allocated
>   * and managed by libio.  These are the "integer" file descriptors that
> @@ -167,11 +163,6 @@ extern "C" {
>const uint32_t rtems_libio_number_iops =
> RTEMS_ARRAY_SIZE(rtems_libio_iops);
>  #endif
>
> -#ifdef CONFIGURE_SMP_MAXIMUM_PROCESSORS
> -  #warning "CONFIGURE_SMP_MAXIMUM_PROCESSORS has been renamed to
> CONFIGURE_MAXIMUM_PROCESSORS since RTEMS 5.1"
> -  #define CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_SMP_MAXIMUM_PROCESSORS
> -#endif
> -
>  /* Ensure that _CONFIGURE_MAXIMUM_PROCESSORS > 1 only in SMP
> configurations */
>  #if defined(CONFIGURE_MAXIMUM_PROCESSORS) && defined(RTEMS_SMP)
>#define _CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_MAXIMUM_PROCESSORS
> @@ -191,34 +182,10 @@ extern "C" {
>#endif
>  #endif
>
> -#ifdef CONFIGURE_SMP_APPLICATION
> -  #warning "CONFIGURE_SMP_APPLICATION is obsolete since RTEMS 5.1"
> -#endif
> -
>  /*
>   * This sets up the resources for the FIFOs/pipes.
>   */
>
> -/**
> - * This is specified to configure the maximum number of POSIX FIFOs.
> - */
> -#ifdef CONFIGURE_MAXIMUM_FIFOS
> -  #warning "CONFIGURE_MAXIMUM_FIFOS is obsolete since RTEMS 5.1; use
> CONFIGURE_IMFS_ENABLE_MKFIFO instead"
> -  #if CONFIGURE_MAXIMUM_FIFOS > 0
> -#define CONFIGURE_IMFS_ENABLE_MKFIFO
> -  #endif
> -#endif
> -
> -/**
> - * This is specified to configure the maximum number of POSIX named pipes.
> - */
> -#ifdef CONFIGURE_MAXIMUM_PIPES
> -  #warning "CONFIGURE_MAXIMUM_PIPES is obsolete since RTEMS 5.1; use
> CONFIGURE_IMFS_ENABLE_MKFIFO instead"
> -  #if CONFIGURE_MAXIMUM_PIPES > 0
> -#define CONFIGURE_IMFS_ENABLE_MKFIFO
> -  #endif
> -#endif
> -
>  /**
>   *  @defgroup ConfigFilesystems Filesystems and Mount Table Configuration
>   *
> @@ -617,14 +584,6 @@ extern "C" {
>  #endif
>  /**@}*/ /* end of file system group */
>
> -/*
> - *  STACK_CHECKER_ON was still available in 4.9 so give a warning for now.
> - */
> -#if defined(STACK_CHECKER_ON)
> -  #define CONFIGURE_STACK_CHECKER_ENABLED
> -  #warning "STACK_CHECKER_ON deprecated -- use
> CONFIGURE_STACK_CHECKER_ENABLED"
> -#endif
> -
>  /**
>   * This configures the stack checker user extension.
>   */
> @@ -702,21 +661,6 @@ extern "C" {
>   *- CONFIGURE_SCHEDULER_USER_PER_THREAD
>  

[PATCH] libio: Add POSIX user environment to TCB

2020-02-14 Thread Sebastian Huber
The IO library used a POSIX key to store an optional POSIX user
environment pointer.  This pulled in the POSIX keys support in every
application configuration.  Add a user environment pointer to the thread
control block (TCB) instead.  Applications which do not need the POSIX
user environment will just get an overhead of one pointer per thread.
---
 cpukit/include/rtems/confdefs.h| 17 +---
 cpukit/include/rtems/libio_.h  |  4 --
 cpukit/include/rtems/score/interr.h|  2 +-
 cpukit/include/rtems/score/thread.h|  7 
 cpukit/include/rtems/sysinit.h |  1 +
 cpukit/include/rtems/userenv.h |  6 ++-
 cpukit/libcsupport/src/__usrenv.c  | 12 +-
 cpukit/libcsupport/src/libio_init.c| 11 -
 cpukit/libcsupport/src/privateenv.c| 67 --
 cpukit/sapi/src/sysinitverbose.c   | 10 -
 testsuites/psxtests/psxconfig01/init.c |  2 +-
 testsuites/sptests/Makefile.am |  9 
 testsuites/sptests/configure.ac|  1 -
 testsuites/sptests/spfatal27/init.c| 34 ---
 testsuites/sptests/spfatal27/spfatal27.doc | 23 --
 testsuites/sptests/spfatal27/spfatal27.scn |  3 --
 testsuites/sptests/spsysinit01/init.c  | 41 +-
 17 files changed, 121 insertions(+), 129 deletions(-)
 delete mode 100644 testsuites/sptests/spfatal27/init.c
 delete mode 100644 testsuites/sptests/spfatal27/spfatal27.doc
 delete mode 100644 testsuites/sptests/spfatal27/spfatal27.scn

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 9b5549478c..bbbaa9d6d1 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -142,11 +142,6 @@ extern "C" {
   #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 3
 #endif
 
-/*
- * POSIX key count used by the IO library.
- */
-#define _CONFIGURE_LIBIO_POSIX_KEYS 1
-
 #ifdef CONFIGURE_INIT
   rtems_libio_t rtems_libio_iops[CONFIGURE_MAXIMUM_FILE_DESCRIPTORS];
 
@@ -2028,14 +2023,6 @@ struct _reent *__getreent(void)
  (CONFIGURE_MAXIMUM_POSIX_THREADS + CONFIGURE_MAXIMUM_TASKS))
 #endif
 
-/*
- * This macro is calculated to specify the total number of
- * POSIX API keys required by the application and configured
- * system capabilities.
- */
-#define _CONFIGURE_POSIX_KEYS \
-  (CONFIGURE_MAXIMUM_POSIX_KEYS + _CONFIGURE_LIBIO_POSIX_KEYS)
-
 /**
  * This configuration parameter specifies the maximum number of
  * POSIX API threads.
@@ -2505,8 +2492,8 @@ struct _reent *__getreent(void)
   CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS;
   #endif
 
-  #if _CONFIGURE_POSIX_KEYS > 0
-POSIX_KEYS_INFORMATION_DEFINE( _CONFIGURE_POSIX_KEYS );
+  #if CONFIGURE_MAXIMUM_POSIX_KEYS > 0
+POSIX_KEYS_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_POSIX_KEYS );
   #endif
 
   #if CONFIGURE_MAXIMUM_POSIX_MESSAGE_QUEUES > 0
diff --git a/cpukit/include/rtems/libio_.h b/cpukit/include/rtems/libio_.h
index cf80ea8075..2473bb5e5a 100644
--- a/cpukit/include/rtems/libio_.h
+++ b/cpukit/include/rtems/libio_.h
@@ -336,10 +336,6 @@ void rtems_filesystem_location_free( 
rtems_filesystem_location_info_t *loc );
  */
 #include 
 
-void rtems_libio_free_user_env( void *env );
-
-extern pthread_key_t rtems_current_user_env_key;
-
 void rtems_libio_lock( void );
 
 void rtems_libio_unlock( void );
diff --git a/cpukit/include/rtems/score/interr.h 
b/cpukit/include/rtems/score/interr.h
index e57c415eed..2f449deedb 100644
--- a/cpukit/include/rtems/score/interr.h
+++ b/cpukit/include/rtems/score/interr.h
@@ -197,7 +197,7 @@ typedef enum {
   INTERNAL_ERROR_BAD_THREAD_DISPATCH_ENVIRONMENT = 31,
   INTERNAL_ERROR_RTEMS_INIT_TASK_CREATE_FAILED = 32,
   INTERNAL_ERROR_POSIX_INIT_THREAD_CREATE_FAILED = 33,
-  INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34,
+  /* INTERNAL_ERROR_LIBIO_USER_ENV_KEY_CREATE_FAILED = 34, */
   /* INTERNAL_ERROR_LIBIO_SEM_CREATE_FAILED = 35, */
   INTERNAL_ERROR_LIBIO_STDOUT_FD_OPEN_FAILED = 36,
   INTERNAL_ERROR_LIBIO_STDERR_FD_OPEN_FAILED = 37,
diff --git a/cpukit/include/rtems/score/thread.h 
b/cpukit/include/rtems/score/thread.h
index 3e2e0638f8..2e7380f99a 100644
--- a/cpukit/include/rtems/score/thread.h
+++ b/cpukit/include/rtems/score/thread.h
@@ -43,6 +43,8 @@
 #include 
 #endif
 
+struct rtems_user_env_t;
+
 struct _pthread_cleanup_context;
 
 struct Per_CPU_Control;
@@ -858,6 +860,11 @@ struct _Thread_Control {
 
   Thread_Capture_controlCapture;
 
+  /**
+   * @brief Pointer to an optional thread-specific POSIX user environment.
+   */
+  struct rtems_user_env_t *user_environment;
+
   /**
* @brief LIFO list of POSIX cleanup contexts.
*/
diff --git a/cpukit/include/rtems/sysinit.h b/cpukit/include/rtems/sysinit.h
index d181c42780..245da74f2c 100644
--- a/cpukit/include/rtems/sysinit.h
+++ b/cpukit/include/rtems/sysinit.h
@@ -68,6 +68,7 @@ extern "C" {
 #define RTEMS_SYSINIT_POSIX_CLEANUP  001c00
 #define RTEMS_SYSINIT_IDLE_THREADS   

Re: fopen() on /dev/console

2020-02-14 Thread Joel Sherrill
On Fri, Feb 14, 2020 at 10:11 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 14/02/2020 17:02, Joel Sherrill wrote:
>
> > Hi
> >
> > I was porting some code from Linux to RTEMS. It doesn't use stdin/out,
> > error directly but does all debug IO to a configured file. Most of the
> > time
> > when running on Linux, the device is /dev/stderr. For the RTEMS port,
> > I added link(/dev/console, /dev/stderr) to the init task and that worked.
> The locking is done at the FILE object level, if you use multiple FILE
> objects with a single file descriptor you may get mixed output.
>

There are multiple file descriptors. Each thread opens it independently.


> > But the application uses fopen(name, "w") to open the logging file.
> > This works on Linux. On RTEMS, this failed because "w" implies
> > ftruncate() and that returned -1.
> >
> > I got around this by changing the logging helper to use fopen(name, "a").
> >
> > I haven't done a POSIX deep dive and consulted with my POSIX contacts
> > yet for a strict POSIX ruling but I think we probably want the "w" to
> work
> > on RTEMS if it works on Lnux.
> >
> > I can put together a test case but I would like to settle on the accepted
> > behavior first.
>
> This is probably because of our rtems_filesystem_default_ftruncate()
> implementation:
>
> int rtems_filesystem_default_ftruncate(
>rtems_libio_t *iop,
>off_t  length
> )
> {
>rtems_set_errno_and_return_minus_one( EINVAL );
> }
>

I debugged to that call and then realized if I used "a", it wouldn't call
it.


>
> Are there some rules for character devices? What happens on FreeBSD or
> macOS?
>

I haven't looked there. Hopefully someone can answer that.  I'm not going to
be able to produce an example before the close of business today though.

I have reached out to a POSIX contact on what he thinks. But I'm also prone
to do what makes us have the same behavior as the others.

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

Multicast on libbsd and Qemu

2020-02-14 Thread Joel Sherrill
Hi

I am trying to bring up the FACE example application on RTEMS. I am using
the
Zyng BSP on Qemu. I need some configuration advice on multicast both on how
to configure libbsd and qemu. The application has multiple components
running
on the Zynq which communicate via multicast UDP and some of that
traffic goes
to an external program.

When running on Linux, the network configuration commands are:

ifconfig lo multicast
route add -net 224.0.0.0 netmask 240.0.0.0 dev lo

I think those will easily translate to the FreeBSD equivalents but if
someone can
do that without the research I will require, please and thank you.

But the Qemu setup to multicast from the simulated target and have it show
up on the host is the magic I am really missing.

Help is really appreciated.  This would be a very nice thing to be able to
demonstrate.

Thanks.

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

Re: fopen() on /dev/console

2020-02-14 Thread Sebastian Huber

On 14/02/2020 17:02, Joel Sherrill wrote:


Hi

I was porting some code from Linux to RTEMS. It doesn't use stdin/out,
error directly but does all debug IO to a configured file. Most of the 
time

when running on Linux, the device is /dev/stderr. For the RTEMS port,
I added link(/dev/console, /dev/stderr) to the init task and that worked.
The locking is done at the FILE object level, if you use multiple FILE 
objects with a single file descriptor you may get mixed output.

But the application uses fopen(name, "w") to open the logging file.
This works on Linux. On RTEMS, this failed because "w" implies
ftruncate() and that returned -1.

I got around this by changing the logging helper to use fopen(name, "a").

I haven't done a POSIX deep dive and consulted with my POSIX contacts
yet for a strict POSIX ruling but I think we probably want the "w" to work
on RTEMS if it works on Lnux.

I can put together a test case but I would like to settle on the accepted
behavior first.


This is probably because of our rtems_filesystem_default_ftruncate() 
implementation:


int rtems_filesystem_default_ftruncate(
  rtems_libio_t *iop,
  off_t  length
)
{
  rtems_set_errno_and_return_minus_one( EINVAL );
}

Are there some rules for character devices? What happens on FreeBSD or 
macOS?


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

[PATCH 03/18] monitor: Use proper API for all config constants

2020-02-14 Thread Sebastian Huber
---
 cpukit/libmisc/monitor/mon-config.c | 11 ---
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/cpukit/libmisc/monitor/mon-config.c 
b/cpukit/libmisc/monitor/mon-config.c
index 852e780d04..95b7798173 100644
--- a/cpukit/libmisc/monitor/mon-config.c
+++ b/cpukit/libmisc/monitor/mon-config.c
@@ -29,11 +29,9 @@ rtems_monitor_config_canonical(
 const void *config_void
 )
 {
-const rtems_configuration_table *c =
-(const rtems_configuration_table *) config_void;
 rtems_api_configuration_table *r = _RTEMS_API;
 
-canonical_config->work_space_size = c->work_space_size;
+canonical_config->work_space_size = 
rtems_configuration_get_work_space_size();
 canonical_config->maximum_tasks = rtems_configuration_get_maximum_tasks();
 canonical_config->maximum_timers = 
rtems_configuration_get_maximum_timers();
 canonical_config->maximum_semaphores = 
rtems_configuration_get_maximum_semaphores();
@@ -43,8 +41,8 @@ rtems_monitor_config_canonical(
 canonical_config->maximum_ports = rtems_configuration_get_maximum_ports();
 canonical_config->maximum_periods = 
rtems_configuration_get_maximum_periods();
 canonical_config->maximum_extensions = 
rtems_configuration_get_maximum_extensions();
-canonical_config->microseconds_per_tick = c->microseconds_per_tick;
-canonical_config->ticks_per_timeslice = c->ticks_per_timeslice;
+canonical_config->microseconds_per_tick = 
rtems_configuration_get_microseconds_per_tick();
+canonical_config->ticks_per_timeslice = 
rtems_configuration_get_ticks_per_timeslice();
 canonical_config->number_of_initialization_tasks = 
r->number_of_initialization_tasks;
 }
 
@@ -60,7 +58,6 @@ rtems_monitor_config_next(
 rtems_id  *next_id
 )
 {
-const rtems_configuration_table *c = 
 int n = rtems_object_id_get_index(*next_id);
 
 if (n >= 1)
@@ -69,7 +66,7 @@ rtems_monitor_config_next(
 _Objects_Allocator_lock();
 
 *next_id += 1;
-return (const void *) c;
+return (const void *) (uintptr_t) 1;
 
 failed:
 *next_id = RTEMS_OBJECT_ID_FINAL;
-- 
2.16.4

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


[PATCH 15/18] config: Add _Workspace_Is_unified

2020-02-14 Thread Sebastian Huber
Move the unified workspace configuration constant out of the
configuration table.

Provide a default definition of the unified workspace constant.

Update #3875.
---
 cpukit/Makefile.am |  1 +
 cpukit/include/rtems/confdefs.h|  9 
 cpukit/include/rtems/config.h  | 10 +
 cpukit/include/rtems/score/wkspacedata.h   |  8 +++
 cpukit/score/src/wkspaceisunifieddefault.c | 34 ++
 5 files changed, 48 insertions(+), 14 deletions(-)
 create mode 100644 cpukit/score/src/wkspaceisunifieddefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 33cb9e843e..76267c3aeb 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1016,6 +1016,7 @@ librtemscpu_a_SOURCES += 
score/src/debugisthreaddispatchingallowed.c
 librtemscpu_a_SOURCES += score/src/interr.c
 librtemscpu_a_SOURCES += score/src/isr.c
 librtemscpu_a_SOURCES += score/src/wkspace.c
+librtemscpu_a_SOURCES += score/src/wkspaceisunifieddefault.c
 librtemscpu_a_SOURCES += score/src/wkstringduplicate.c
 librtemscpu_a_SOURCES += score/src/ioprintf.c
 librtemscpu_a_SOURCES += score/src/iovprintf.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index ba1545782a..07478eb299 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2660,11 +2660,6 @@ struct _reent *__getreent(void)
* This is the primary Configuration Table for this application.
*/
   const rtems_configuration_table Configuration = {
-#ifdef CONFIGURE_UNIFIED_WORK_AREAS   /* true for unified work areas */
-  true,
-#else
-  false,
-#endif
 #ifdef RTEMS_SMP
   #ifdef _CONFIGURE_SMP_APPLICATION
 true,
@@ -2679,6 +2674,10 @@ struct _reent *__getreent(void)
 
   const uintptr_t _Workspace_Size = CONFIGURE_EXECUTIVE_RAM_SIZE;
 
+  #ifdef CONFIGURE_UNIFIED_WORK_AREAS
+const bool _Workspace_Is_unified = true;
+  #endif
+
   #ifdef CONFIGURE_DIRTY_MEMORY
 RTEMS_SYSINIT_ITEM(
   _Memory_Dirty_free_areas,
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 0b5527c76d..6489e4e4e8 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -83,14 +83,6 @@ typedef Stack_Allocator_free rtems_stack_free_hook;
  * + required number of each object type for each API configured
  */
 typedef struct {
-  /**
-   * @brief Specifies if a unified work area is used or not.
-   *
-   * If this element is @a true, then the RTEMS Workspace and the C Program
-   * Heap use the same heap, otherwise they use separate heaps.
-   */
-  bool   unified_work_area;
-
   #ifdef RTEMS_SMP
 bool smp_enabled;
   #endif
@@ -111,7 +103,7 @@ extern const rtems_configuration_table Configuration;
  */
 
 #define rtems_configuration_get_unified_work_area() \
-(Configuration.unified_work_area)
+(_Workspace_Is_unified)
 
 /**
  * @brief Return if the stack allocator avoids the work space.
diff --git a/cpukit/include/rtems/score/wkspacedata.h 
b/cpukit/include/rtems/score/wkspacedata.h
index 6a5a9bc0b6..26a7e61201 100644
--- a/cpukit/include/rtems/score/wkspacedata.h
+++ b/cpukit/include/rtems/score/wkspacedata.h
@@ -56,6 +56,14 @@ extern "C" {
  */
 extern const uintptr_t _Workspace_Size;
 
+/**
+ * @brief Indicates if the workspace and C program heap are unified.
+ *
+ * This constant is defined by the application configuration via
+ * .
+ */
+extern const bool _Workspace_Is_unified;
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/wkspaceisunifieddefault.c 
b/cpukit/score/src/wkspaceisunifieddefault.c
new file mode 100644
index 00..caf5c129c8
--- /dev/null
+++ b/cpukit/score/src/wkspaceisunifieddefault.c
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 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) 

[PATCH 09/18] config: Remove CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE

2020-02-14 Thread Sebastian Huber
The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and
CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_*
configuration options.  These two options are probably unused, see also:

* https://lists.rtems.org/pipermail/users/2019-April/033129.html

* https://lists.rtems.org/pipermail/users/2019-April/033130.html

Removing them simplifies the configuration. If there is a real user need
which shows up after the removal, we can resurrect them on demand.

Using CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE would have required the
use of the undocumented CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME and
CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE configuration options.

Update #3873.
---
 cpukit/headers.am|  1 -
 cpukit/include/rtems/confdefs.h  | 51 --
 cpukit/include/rtems/config.h|  1 -
 cpukit/include/rtems/posix/config.h  | 60 -
 cpukit/include/rtems/posix/pthread.h | 25 +--
 cpukit/include/rtems/posix/pthreadimpl.h |  1 -
 cpukit/posix/src/pthreadinitthreads.c| 75 +---
 testsuites/psxtests/psxfatal01/init.c| 22 +-
 testsuites/psxtests/psxfatal02/init.c| 40 ++---
 9 files changed, 83 insertions(+), 193 deletions(-)
 delete mode 100644 cpukit/include/rtems/posix/config.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 6f44b833e1..244e435c62 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -189,7 +189,6 @@ include_rtems_debugger_HEADERS += 
include/rtems/debugger/rtems-debugger-server.h
 include_rtems_posix_HEADERS += include/rtems/posix/aio_misc.h
 include_rtems_posix_HEADERS += include/rtems/posix/barrierimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/condimpl.h
-include_rtems_posix_HEADERS += include/rtems/posix/config.h
 include_rtems_posix_HEADERS += include/rtems/posix/key.h
 include_rtems_posix_HEADERS += include/rtems/posix/keyimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/mmanimpl.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index bb00cffee7..0181af356a 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2177,32 +2177,14 @@ struct _reent *__getreent(void)
 #endif
 
 #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
-  #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
-#ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
-  #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
-#endif
-
-#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
-  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
-CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
-#endif
-
-#ifdef CONFIGURE_INIT
-  posix_initialization_threads_table POSIX_Initialization_threads[] = {
-{ CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
-  CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
-  };
-#endif
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
-  POSIX_Initialization_threads
+  #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
+#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
+  #endif
 
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
-  RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
-  #endif /* !CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
-#else /* !CONFIGURE_POSIX_INIT_THREAD_TABLE */
-  #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
-  #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
+  #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+  CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
+  #endif
 #endif /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
 
 /**
@@ -2777,17 +2759,14 @@ struct _reent *__getreent(void)
  *  then we need to install the code that runs that loop.
  */
 #ifdef CONFIGURE_INIT
-  #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
-  defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
-posix_initialization_threads_table * const
-  _Configuration_POSIX_Initialization_threads =
-CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME;
-
-const size_t _Configuration_POSIX_Initialization_thread_count =
-  CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE;
+  #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE)
+const posix_initialization_threads_table _POSIX_Threads_User_thread_table 
= {
+  CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
+  CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+};
 
 RTEMS_SYSINIT_ITEM(
-  _POSIX_Threads_Initialize_user_threads_body,
+  _POSIX_Threads_Initialize_user_thread,
   RTEMS_SYSINIT_POSIX_USER_THREADS,
   RTEMS_SYSINIT_ORDER_MIDDLE
 );
@@ -3012,6 +2991,10 @@ struct _reent *__getreent(void)
   #warning "The CONFIGURE_MAXIMUM_PTYS configuration option is obsolete since 
RTEMS 5.1"
 #endif
 
+#ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
+  #warning "The CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE configuration option 
is obsolete since RTEMS 5.1"
+#endif
+
 #ifdef CONFIGURE_TERMIOS_DISABLED

[PATCH 05/18] config: Simplify initialization task config

2020-02-14 Thread Sebastian Huber
With the removal of the CONFIGURE_HAS_OWN_INIT_TASK_TABLE configuration
option at most one Classic API user initialization task can be
configured.

Provide an RTEMS API configuration table for backward compatibility.

Update #3873.
---
 cpukit/Makefile.am |   2 +
 cpukit/include/rtems/confdefs.h|  59 ---
 cpukit/include/rtems/config.h  |   3 -
 cpukit/include/rtems/rtems/config.h|  13 ++---
 cpukit/include/rtems/rtems/tasksdata.h |  19 +++---
 cpukit/libmisc/monitor/mon-config.c|   4 +-
 cpukit/libmisc/monitor/mon-itask.c |   8 ++-
 cpukit/rtems/src/getapiconfig.c|  46 +++
 cpukit/rtems/src/taskinitdefault.c |  34 +++
 cpukit/rtems/src/taskinitusers.c   | 102 +++--
 10 files changed, 148 insertions(+), 142 deletions(-)
 create mode 100644 cpukit/rtems/src/getapiconfig.c
 create mode 100644 cpukit/rtems/src/taskinitdefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 44a0868cd5..1d3935776b 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -697,6 +697,7 @@ librtemscpu_a_SOURCES += rtems/src/eventreceive.c
 librtemscpu_a_SOURCES += rtems/src/eventseize.c
 librtemscpu_a_SOURCES += rtems/src/eventsend.c
 librtemscpu_a_SOURCES += rtems/src/eventsurrender.c
+librtemscpu_a_SOURCES += rtems/src/getapiconfig.c
 librtemscpu_a_SOURCES += rtems/src/getcurrentprocessor.c
 librtemscpu_a_SOURCES += rtems/src/getprocessorcount.c
 librtemscpu_a_SOURCES += rtems/src/intrbody.c
@@ -789,6 +790,7 @@ librtemscpu_a_SOURCES += rtems/src/taskgetaffinity.c
 librtemscpu_a_SOURCES += rtems/src/taskgetpriority.c
 librtemscpu_a_SOURCES += rtems/src/taskgetscheduler.c
 librtemscpu_a_SOURCES += rtems/src/taskident.c
+librtemscpu_a_SOURCES += rtems/src/taskinitdefault.c
 librtemscpu_a_SOURCES += rtems/src/taskinitusers.c
 librtemscpu_a_SOURCES += rtems/src/taskissuspended.c
 librtemscpu_a_SOURCES += rtems/src/taskiterate.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 266e3f27e8..bb00cffee7 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -103,11 +103,6 @@ extern "C" {
  *used remarkably reliably by most applications.
  */
 
-/**
- * This is the Classic API initialization tasks table.
- */
-extern rtems_initialization_tasks_table Initialization_tasks[];
-
 #if defined(RTEMS_MULTIPROCESSING)
   /**
* This it the distributed multiprocessing configuration table.
@@ -1384,42 +1379,8 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
   #define CONFIGURE_INIT_TASK_ARGUMENTS 0
 #endif
 
-#ifdef CONFIGURE_INIT
-  rtems_initialization_tasks_table Initialization_tasks[] = {
-{ CONFIGURE_INIT_TASK_NAME,
-  CONFIGURE_INIT_TASK_STACK_SIZE,
-  CONFIGURE_INIT_TASK_PRIORITY,
-  CONFIGURE_INIT_TASK_ATTRIBUTES,
-  CONFIGURE_INIT_TASK_ENTRY_POINT,
-  CONFIGURE_INIT_TASK_INITIAL_MODES,
-  CONFIGURE_INIT_TASK_ARGUMENTS
-}
-  };
-#endif
-
-/**
- * This is the name of the Initialization Tasks Table generated.
- */
-#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
-
-/*
- * This is the size of the Initialization Tasks Table generated.
- */
-#define CONFIGURE_INIT_TASK_TABLE_SIZE \
-  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
-
 #else /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
 
-/*
- * This is the name of the Initialization Task when none is configured.
- */
-#define CONFIGURE_INIT_TASK_TABLE  NULL
-
-/*
- * This is the size of the Initialization Task when none is configured.
- */
-#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
-
 /*
  * This is the stack size of the Initialization Task when none is configured.
  */
@@ -2602,14 +2563,6 @@ struct _reent *__getreent(void)
 EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS );
   #endif
 
-  /**
-   * This is the Classic API Configuration Table.
-   */
-  rtems_api_configuration_table Configuration_RTEMS_API = {
-CONFIGURE_INIT_TASK_TABLE_SIZE,
-CONFIGURE_INIT_TASK_TABLE
-  };
-
   #if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
 POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[
   rtems_resource_maximum_per_allocation(
@@ -2801,8 +2754,18 @@ struct _reent *__getreent(void)
  */
 #ifdef CONFIGURE_INIT
   #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
+const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
+  CONFIGURE_INIT_TASK_NAME,
+  CONFIGURE_INIT_TASK_STACK_SIZE,
+  CONFIGURE_INIT_TASK_PRIORITY,
+  CONFIGURE_INIT_TASK_ATTRIBUTES,
+  CONFIGURE_INIT_TASK_ENTRY_POINT,
+  CONFIGURE_INIT_TASK_INITIAL_MODES,
+  CONFIGURE_INIT_TASK_ARGUMENTS
+};
+
 RTEMS_SYSINIT_ITEM(
-  _RTEMS_tasks_Initialize_user_tasks_body,
+  _RTEMS_tasks_Initialize_user_task,
   RTEMS_SYSINIT_CLASSIC_USER_TASKS,
   RTEMS_SYSINIT_ORDER_MIDDLE
 );
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 

[PATCH 10/18] config: Add _Watchdog_Microseconds_per_tick

2020-02-14 Thread Sebastian Huber
Move the microseconds per tick configuration constant out of the
configuration table.

Add WATCHDOG_MICROSECONDS_PER_TICK_DEFAULT and use it to provide a
default definition of the watchdog ticks constants.

Update #3875.
---
 cpukit/Makefile.am |  1 +
 cpukit/include/rtems/confdefs.h| 25 ++
 cpukit/include/rtems/config.h  | 10 ++--
 cpukit/include/rtems/score/watchdogticks.h | 13 ++
 cpukit/score/src/watchdogticksdefault.c| 41 ++
 5 files changed, 71 insertions(+), 19 deletions(-)
 create mode 100644 cpukit/score/src/watchdogticksdefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 1d3935776b..c3bdd284cd 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1001,6 +1001,7 @@ librtemscpu_a_SOURCES += score/src/coretodhookrun.c
 librtemscpu_a_SOURCES += score/src/coretodhookunregister.c
 librtemscpu_a_SOURCES += score/src/watchdogremove.c
 librtemscpu_a_SOURCES += score/src/watchdogtick.c
+librtemscpu_a_SOURCES += score/src/watchdogticksdefault.c
 librtemscpu_a_SOURCES += score/src/watchdogtickssinceboot.c
 librtemscpu_a_SOURCES += score/src/userextaddset.c
 librtemscpu_a_SOURCES += score/src/userext.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 0181af356a..4c2c80b2a9 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1964,10 +1964,8 @@ extern "C" {
 /**@{*/
 
 /** The configures the number of microseconds per clock tick. */
-#ifndef CONFIGURE_MICROSECONDS_PER_TICK
-  #define CONFIGURE_MICROSECONDS_PER_TICK \
-  RTEMS_MILLISECONDS_TO_MICROSECONDS(10)
-#endif
+#if defined(CONFIGURE_MICROSECONDS_PER_TICK) && \
+  CONFIGURE_MICROSECONDS_PER_TICK != WATCHDOG_MICROSECONDS_PER_TICK_DEFAULT
 
 #if 100 % CONFIGURE_MICROSECONDS_PER_TICK != 0
   #warning "The clock ticks per second is not an integer"
@@ -1977,7 +1975,18 @@ extern "C" {
   #error "The CONFIGURE_MICROSECONDS_PER_TICK must be positive"
 #endif
 
-#define _CONFIGURE_TICKS_PER_SECOND (100 / CONFIGURE_MICROSECONDS_PER_TICK)
+#ifdef CONFIGURE_INIT
+  const uint32_t _Watchdog_Microseconds_per_tick =
+CONFIGURE_MICROSECONDS_PER_TICK;
+
+  const uint32_t _Watchdog_Nanoseconds_per_tick =
+(uint32_t) 1000 * CONFIGURE_MICROSECONDS_PER_TICK;
+
+  const uint32_t _Watchdog_Ticks_per_second =
+100 / CONFIGURE_MICROSECONDS_PER_TICK;
+#endif
+
+#endif /* CONFIGURE_MICROSECONDS_PER_TICK */
 
 /** The configures the number of clock ticks per timeslice. */
 #ifndef CONFIGURE_TICKS_PER_TIMESLICE
@@ -2474,11 +2483,6 @@ struct _reent *__getreent(void)
   sizeof( Thread_queue_Configured_heads );
   #endif
 
-  const uint32_t _Watchdog_Nanoseconds_per_tick =
-(uint32_t) 1000 * CONFIGURE_MICROSECONDS_PER_TICK;
-
-  const uint32_t _Watchdog_Ticks_per_second = _CONFIGURE_TICKS_PER_SECOND;
-
   const size_t _Thread_Initial_thread_count =
 rtems_resource_maximum_per_allocation( _CONFIGURE_TASKS ) +
 rtems_resource_maximum_per_allocation( CONFIGURE_MAXIMUM_POSIX_THREADS );
@@ -2644,7 +2648,6 @@ struct _reent *__getreent(void)
*/
   const rtems_configuration_table Configuration = {
 CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
-CONFIGURE_MICROSECONDS_PER_TICK,  /* microseconds per clock tick */
 CONFIGURE_TICKS_PER_TIMESLICE,/* ticks per timeslice quantum */
 CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */
 CONFIGURE_IDLE_TASK_STACK_SIZE,   /* IDLE task stack size */
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index d9f91db741..84917366f3 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -86,12 +86,6 @@ typedef struct {
*/
   uintptr_t  work_space_size;
 
-  /** 
-   * This field specifies the number of microseconds which elapse
-   * between clock ticks.  This is the basis for RTEMS timing.
-   */
-  uint32_t   microseconds_per_tick;
-
   /** 
* This field specifies the number of ticks in each task's timeslice.
*/
@@ -162,9 +156,9 @@ uintptr_t rtems_configuration_get_stack_space_size( void );
 uint32_t rtems_configuration_get_maximum_extensions( void );
 
 #define rtems_configuration_get_microseconds_per_tick() \
-(Configuration.microseconds_per_tick)
+(_Watchdog_Microseconds_per_tick)
 #define rtems_configuration_get_milliseconds_per_tick() \
-(Configuration.microseconds_per_tick / 1000)
+(_Watchdog_Microseconds_per_tick / 1000)
 #define rtems_configuration_get_nanoseconds_per_tick() \
 (_Watchdog_Nanoseconds_per_tick)
 
diff --git a/cpukit/include/rtems/score/watchdogticks.h 
b/cpukit/include/rtems/score/watchdogticks.h
index e7cf3f3ea3..eaeddb5e6b 100644
--- a/cpukit/include/rtems/score/watchdogticks.h
+++ b/cpukit/include/rtems/score/watchdogticks.h
@@ -42,6 +42,11 @@ typedef 

[PATCH 02/18] config: Remove unused configuration constant

2020-02-14 Thread Sebastian Huber
---
 cpukit/include/rtems/confdefs.h |  1 -
 cpukit/include/rtems/config.h   | 10 --
 2 files changed, 11 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index f39172cffb..137a9edb5c 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2723,7 +2723,6 @@ struct _reent *__getreent(void)
*/
   const rtems_configuration_table Configuration = {
 CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
-CONFIGURE_MAXIMUM_USER_EXTENSIONS,/* maximum dynamic extensions */
 CONFIGURE_MICROSECONDS_PER_TICK,  /* microseconds per clock tick */
 CONFIGURE_TICKS_PER_TIMESLICE,/* ticks per timeslice quantum */
 CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 1c9b35da87..51e437f48a 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -87,16 +87,6 @@ typedef struct {
*/
   uintptr_t  work_space_size;
 
-  /**
-   * This field contains the maximum number of POSIX API
-   * key value pairs which are configured for this application.
-   *
-   * @note There can be potentially be a key/value pair for
-   *   every thread to use every key. But normally this
-   *   many are not needed in a system.
-   */
-  uint32_tmaximum_key_value_pairs;
-
   /** 
* This field specifies the number of microseconds which elapse
* between clock ticks.  This is the basis for RTEMS timing.
-- 
2.16.4

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


[PATCH 13/18] config: Add _Thread_Idle_body

2020-02-14 Thread Sebastian Huber
Move the idle thread body configuration constant out of the
configuration table.

Provide a default definition of the idle thread body constant.

Update #3875.
---
 cpukit/Makefile.am  |  1 +
 cpukit/include/rtems/confdefs.h |  7 +++---
 cpukit/include/rtems/config.h   |  8 +--
 cpukit/include/rtems/score/threadidledata.h | 13 +++
 cpukit/score/src/threadcreateidle.c |  3 +--
 cpukit/score/src/threadidledefault.c| 34 +
 6 files changed, 54 insertions(+), 12 deletions(-)
 create mode 100644 cpukit/score/src/threadidledefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 13ddeeab51..33cb9e843e 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -956,6 +956,7 @@ librtemscpu_a_SOURCES += score/src/threaddispatch.c
 librtemscpu_a_SOURCES += score/src/threadget.c
 librtemscpu_a_SOURCES += score/src/threadhandler.c
 librtemscpu_a_SOURCES += score/src/threadinitialize.c
+librtemscpu_a_SOURCES += score/src/threadidledefault.c
 librtemscpu_a_SOURCES += score/src/threadidlestacksizedefault.c
 librtemscpu_a_SOURCES += score/src/threadloadenv.c
 librtemscpu_a_SOURCES += score/src/threadrestart.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 9e166b39f3..1dfc06e158 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1114,10 +1114,12 @@ extern "C" {
 #ifndef CONFIGURE_IDLE_TASK_BODY
   #if defined(BSP_IDLE_TASK_BODY)
 #define CONFIGURE_IDLE_TASK_BODY BSP_IDLE_TASK_BODY
-  #else
-#define CONFIGURE_IDLE_TASK_BODY _CPU_Thread_Idle_body
   #endif
 #endif
+
+#if defined(CONFIGURE_INIT) && defined(CONFIGURE_IDLE_TASK_BODY)
+const Thread_Idle_body _Thread_Idle_body = CONFIGURE_IDLE_TASK_BODY;
+#endif
 /**@}*/ /* end of IDLE thread configuration */
 
 /**
@@ -2659,7 +2661,6 @@ struct _reent *__getreent(void)
*/
   const rtems_configuration_table Configuration = {
 CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
-CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */
 #ifdef CONFIGURE_UNIFIED_WORK_AREAS   /* true for unified work areas */
   true,
 #else
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 62804be41c..017b4ed476 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -87,12 +87,6 @@ typedef struct {
*/
   uintptr_t  work_space_size;
 
-  /** 
-   * This element points to the BSP's optional idle task which may override
-   * the default one provided with RTEMS.
-   */
-  void*(*idle_task)( uintptr_t );
-
   /**
* @brief Specifies if a unified work area is used or not.
*
@@ -155,7 +149,7 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
 (_Watchdog_Ticks_per_timeslice)
 
 #define rtems_configuration_get_idle_task() \
-(Configuration.idle_task)
+(_Thread_Idle_entry)
 
 #define rtems_configuration_get_idle_task_stack_size() \
 (_Thread_Idle_stack_size)
diff --git a/cpukit/include/rtems/score/threadidledata.h 
b/cpukit/include/rtems/score/threadidledata.h
index aa39466f7f..c9dbbe2a0e 100644
--- a/cpukit/include/rtems/score/threadidledata.h
+++ b/cpukit/include/rtems/score/threadidledata.h
@@ -61,6 +61,19 @@ extern "C" {
  */
 extern const size_t _Thread_Idle_stack_size;
 
+/**
+ * @brief The idle thread body type.
+ */
+typedef void *( *Thread_Idle_body )( uintptr_t );
+
+/**
+ * @brief The idle thread body.
+ *
+ * This constant is defined by the application configuration via
+ * .
+ */
+extern const Thread_Idle_body _Thread_Idle_body;
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/threadcreateidle.c 
b/cpukit/score/src/threadcreateidle.c
index 66ed92702e..52c3ad4534 100644
--- a/cpukit/score/src/threadcreateidle.c
+++ b/cpukit/score/src/threadcreateidle.c
@@ -25,7 +25,6 @@
 #include 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -79,7 +78,7 @@ static void _Thread_Create_idle_for_CPU( Per_CPU_Control *cpu 
)
 
   idle->is_idle = true;
   idle->Start.Entry.adaptor = _Thread_Entry_adaptor_idle;
-  idle->Start.Entry.Kinds.Idle.entry = rtems_configuration_get_idle_task();
+  idle->Start.Entry.Kinds.Idle.entry = _Thread_Idle_body;
 
   _Thread_Load_environment( idle );
 
diff --git a/cpukit/score/src/threadidledefault.c 
b/cpukit/score/src/threadidledefault.c
new file mode 100644
index 00..21559656e0
--- /dev/null
+++ b/cpukit/score/src/threadidledefault.c
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 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. 

[PATCH 14/18] config: Add _Workspace_Size

2020-02-14 Thread Sebastian Huber
Move the workspace size configuration constant out of the configuration
table.

Update #3875.
---
 cpukit/headers.am|  1 +
 cpukit/include/rtems/confdefs.h  |  3 +-
 cpukit/include/rtems/config.h|  8 +---
 cpukit/include/rtems/score/wkspacedata.h | 65 
 4 files changed, 70 insertions(+), 7 deletions(-)
 create mode 100644 cpukit/include/rtems/score/wkspacedata.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 351e942cea..6e1ab4ccd0 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -408,6 +408,7 @@ include_rtems_score_HEADERS += 
include/rtems/score/watchdog.h
 include_rtems_score_HEADERS += include/rtems/score/watchdogimpl.h
 include_rtems_score_HEADERS += include/rtems/score/watchdogticks.h
 include_rtems_score_HEADERS += include/rtems/score/wkspace.h
+include_rtems_score_HEADERS += include/rtems/score/wkspacedata.h
 include_rtems_trace_HEADERS += include/rtems/trace/rtems-trace-buffer-vars.h
 include_sys_HEADERS += include/sys/_ffcounter.h
 include_sys_HEADERS += include/sys/cdefs_elf.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 1dfc06e158..ba1545782a 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2660,7 +2660,6 @@ struct _reent *__getreent(void)
* This is the primary Configuration Table for this application.
*/
   const rtems_configuration_table Configuration = {
-CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
 #ifdef CONFIGURE_UNIFIED_WORK_AREAS   /* true for unified work areas */
   true,
 #else
@@ -2678,6 +2677,8 @@ struct _reent *__getreent(void)
 #endif
   };
 
+  const uintptr_t _Workspace_Size = CONFIGURE_EXECUTIVE_RAM_SIZE;
+
   #ifdef CONFIGURE_DIRTY_MEMORY
 RTEMS_SYSINIT_ITEM(
   _Memory_Dirty_free_areas,
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 017b4ed476..0b5527c76d 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -34,6 +34,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #if defined(RTEMS_MULTIPROCESSING)
@@ -82,11 +83,6 @@ typedef Stack_Allocator_free rtems_stack_free_hook;
  * + required number of each object type for each API configured
  */
 typedef struct {
-  /**
-   * This field specifies the size in bytes of the RTEMS Workspace.
-   */
-  uintptr_t  work_space_size;
-
   /**
* @brief Specifies if a unified work area is used or not.
*
@@ -132,7 +128,7 @@ extern const rtems_configuration_table Configuration;
 uintptr_t rtems_configuration_get_stack_space_size( void );
 
 #define rtems_configuration_get_work_space_size() \
-(Configuration.work_space_size + \
+(_Workspace_Size + \
   (rtems_configuration_get_stack_allocator_avoids_work_space() ? \
 0 : rtems_configuration_get_stack_space_size()))
 
diff --git a/cpukit/include/rtems/score/wkspacedata.h 
b/cpukit/include/rtems/score/wkspacedata.h
new file mode 100644
index 00..6a5a9bc0b6
--- /dev/null
+++ b/cpukit/include/rtems/score/wkspacedata.h
@@ -0,0 +1,65 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSScoreWorkspace
+ *
+ * @brief Constants for the idle threads.
+ */
+
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 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_SCORE_WKSPACEDATA_H
+#define _RTEMS_SCORE_WKSPACEDATA_H
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup RTEMSScoreWorkspace
+ *
+ * @{
+ */
+
+/**
+ * @brief The workspace size in bytes.
+ *
+ * This constant is defined by 

[PATCH 04/18] config: Remove CONFIGURE_HAS_OWN_INIT_TASK_TABLE

2020-02-14 Thread Sebastian Huber
The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and
CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_*
configuration options.  These two options are probably unused, see also:

  * https://lists.rtems.org/pipermail/users/2019-April/033129.html

  * https://lists.rtems.org/pipermail/users/2019-April/033130.html

Removing them simplifies the configuration. If there is a real user need
which shows up after the removal, we can resurrect them on demand.

Using CONFIGURE_HAS_OWN_INIT_TASK_TABLE would have required the use of
the undocumented CONFIGURE_INIT_TASK_TABLE and
CONFIGURE_INIT_TASK_TABLE_SIZE configuration options.

Update #3873.
---
 cpukit/include/rtems/confdefs.h | 23 ++-
 testsuites/sptests/sp54/init.c  | 26 --
 testsuites/sptests/spfatal01/init.c | 33 +
 testsuites/sptests/spfatal02/init.c | 20 +---
 testsuites/sptests/spfatal04/init.c | 20 
 testsuites/sptests/spfatal05/init.c | 20 
 testsuites/sptests/spfatal06/init.c | 24 +---
 7 files changed, 29 insertions(+), 137 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 137a9edb5c..266e3f27e8 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1312,13 +1312,8 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
  *
  * Default User Initialization Task Table.  This table guarantees that
  * one user initialization table is defined.
- *
- *  WHEN CONFIGURE_HAS_OWN_INIT_TASK_TABLE is defined, the user is
- *  responsible for defining their own table information and setting the
- *  appropriate variables.
  */
-#if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
-!defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
+#if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
 
 /**
  * When using the default Classic API Initialization Tasks Table, this is
@@ -1414,13 +1409,6 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
   RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
 
 #else /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
-#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
-
-/*
- * The user application is responsible for defining everything
- * when CONFIGURE_HAS_OWN_INIT_TABLE is defined.
- */
-#else /* not using standard or providing own Init Task Table */
 
 /*
  * This is the name of the Initialization Task when none is configured.
@@ -1437,8 +1425,6 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
  */
 #define CONFIGURE_INIT_TASK_STACK_SIZE 0
 
-#endif/* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
-
 #endif
 /**@}*/  /* end of Classic API Initialization Tasks Table */
 
@@ -2814,8 +2800,7 @@ struct _reent *__getreent(void)
  *  then we need to install the code that runs that loop.
  */
 #ifdef CONFIGURE_INIT
-  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
-  defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
+  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
 RTEMS_SYSINIT_ITEM(
   _RTEMS_tasks_Initialize_user_tasks_body,
   RTEMS_SYSINIT_CLASSIC_USER_TASKS,
@@ -3008,6 +2993,10 @@ struct _reent *__getreent(void)
   #warning "The CONFIGURE_HAS_OWN_FILESYSTEM_TABLE configuration option is 
obsolete since RTEMS 5.1"
 #endif
 
+#ifdef CONFIGURE_HAS_OWN_INIT_TABLE
+  #warning "The CONFIGURE_HAS_OWN_INIT_TABLE configuration option is obsolete 
since RTEMS 5.1"
+#endif
+
 #ifdef CONFIGURE_HAS_OWN_MOUNT_TABLE
   #warning "The CONFIGURE_HAS_OWN_MOUNT_TABLE configuration option is obsolete 
since RTEMS 5.1"
 #endif
diff --git a/testsuites/sptests/sp54/init.c b/testsuites/sptests/sp54/init.c
index 07001e1e5e..71437fac8e 100644
--- a/testsuites/sptests/sp54/init.c
+++ b/testsuites/sptests/sp54/init.c
@@ -24,9 +24,10 @@ const char rtems_test_name[] = "SP 54";
 
 static void *Init( uintptr_t ignored )
 {
-  rtems_status_codestatus;
-  rtems_task_priority  pri;
-  rtems_id id;
+  rtems_status_codestatus;
+  rtems_task_priority  pri;
+  rtems_id id;
+  const rtems_api_configuration_table *config;
 
   /*
*  It is possible that since this thread prints and there is no idle
@@ -52,6 +53,10 @@ static void *Init( uintptr_t ignored )
 
   rtems_test_assert( rtems_configuration_get_do_zero_of_workspace() );
 
+  config = rtems_configuration_get_rtems_api_configuration();
+  rtems_test_assert( config->number_of_initialization_tasks == 0 );
+  rtems_test_assert( config->User_initialization_tasks_table == NULL );
+
   TEST_END();
   rtems_test_exit(0);
 }
@@ -68,21 +73,6 @@ static void *Init( uintptr_t ignored )
 #define CONFIGURE_IDLE_TASK_BODY Init
 #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
 
-/*
- *  Another odd case to hit.  Since we use the Init task is Idle task
- *  configuration, we can dummy up the initialization task configuration
- *  to have a non-NULL pointer and 0 tasks.
- */
-
-#define 

[PATCH 06/18] rtems: Simplify _RTEMS_tasks_Initialize_user_task()

2020-02-14 Thread Sebastian Huber
Due to the system initialization order, the _Thread_Global_constructor
must be 0 in this function.
---
 cpukit/rtems/src/taskinitusers.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c
index 0645de324a..3f913b8484 100644
--- a/cpukit/rtems/src/taskinitusers.c
+++ b/cpukit/rtems/src/taskinitusers.c
@@ -56,7 +56,6 @@ void _RTEMS_tasks_Initialize_user_task( void )
   _Assert( rtems_is_status_successful( return_value ) );
   (void) return_value;
 
-  if ( _Thread_Global_constructor == 0 ) {
-_Thread_Global_constructor = id;
-  }
+  _Assert( _Thread_Global_constructor == 0 );
+  _Thread_Global_constructor = id;
 }
-- 
2.16.4

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


fopen() on /dev/console

2020-02-14 Thread Joel Sherrill
Hi

I was porting some code from Linux to RTEMS. It doesn't use stdin/out,
error directly but does all debug IO to a configured file. Most of the time
when running on Linux, the device is /dev/stderr. For the RTEMS port,
I added link(/dev/console, /dev/stderr) to the init task and that worked.
But the application uses fopen(name, "w") to open the logging file.
This works on Linux. On RTEMS, this failed because "w" implies
ftruncate() and that returned -1.

I got around this by changing the logging helper to use fopen(name, "a").

I haven't done a POSIX deep dive and consulted with my POSIX contacts
yet for a strict POSIX ruling but I think we probably want the "w" to work
on RTEMS if it works on Lnux.

I can put together a test case but I would like to settle on the accepted
behavior first.

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

[PATCH 16/18] config: Add _SMP_Processor_configure_maximum

2020-02-14 Thread Sebastian Huber
Move the processor maximum configuration constant out of the
configuration table.

Update #3875.
---
 cpukit/include/rtems/confdefs.h  | 12 +++-
 cpukit/include/rtems/config.h| 14 +++---
 cpukit/include/rtems/score/smp.h | 13 +
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 07478eb299..bcf3ab552a 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2662,16 +2662,18 @@ struct _reent *__getreent(void)
   const rtems_configuration_table Configuration = {
 #ifdef RTEMS_SMP
   #ifdef _CONFIGURE_SMP_APPLICATION
-true,
+true
   #else
-false,
+false
   #endif
 #endif
-#ifdef RTEMS_SMP
-  _CONFIGURE_MAXIMUM_PROCESSORS,
-#endif
   };
 
+  #ifdef RTEMS_SMP
+const uint32_t _SMP_Processor_configured_maximum =
+  _CONFIGURE_MAXIMUM_PROCESSORS;
+  #endif
+
   const uintptr_t _Workspace_Size = CONFIGURE_EXECUTIVE_RAM_SIZE;
 
   #ifdef CONFIGURE_UNIFIED_WORK_AREAS
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 6489e4e4e8..5550397623 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -30,6 +30,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -86,10 +87,6 @@ typedef struct {
   #ifdef RTEMS_SMP
 bool smp_enabled;
   #endif
-
-  #ifdef RTEMS_SMP
-uint32_t maximum_processors;
-  #endif
 } rtems_configuration_table;
 
 /**
@@ -204,13 +201,8 @@ uint32_t rtems_configuration_get_maximum_extensions( void 
);
  *
  * @return The configured maximum count of processors.
  */
-#ifdef RTEMS_SMP
-  #define rtems_configuration_get_maximum_processors() \
-(Configuration.maximum_processors)
-#else
-  #define rtems_configuration_get_maximum_processors() \
-1
-#endif
+#define rtems_configuration_get_maximum_processors() \
+(_SMP_Processor_configured_maximum)
 
 #ifdef __cplusplus
 }
diff --git a/cpukit/include/rtems/score/smp.h b/cpukit/include/rtems/score/smp.h
index 4d6b24ae48..2722fbdcee 100644
--- a/cpukit/include/rtems/score/smp.h
+++ b/cpukit/include/rtems/score/smp.h
@@ -36,6 +36,19 @@ extern "C" {
  * @{
  */
 
+/**
+ * @brief The configured processor maximum.
+ *
+ * In SMP configurations, this constant is defined by the application
+ * configuration via , otherwise it is a compile-time
+ * constant with the value one.
+ */
+#if defined(RTEMS_SMP)
+  extern const uint32_t _SMP_Processor_configured_maximum;
+#else
+  #define _SMP_Processor_configured_maximum 1
+#endif
+
 #if defined( RTEMS_SMP )
   extern uint32_t _SMP_Processor_maximum;
 
-- 
2.16.4

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


[PATCH 18/18] config: Add

2020-02-14 Thread Sebastian Huber
Unify handling of obsolete configuration options.  Change license to
BSD-2-Clause.

Update #3053.
Update #3875.
---
 cpukit/header-dirs.am|   2 +
 cpukit/headers.am|   1 +
 cpukit/include/rtems/confdefs.h  | 156 +---
 cpukit/include/rtems/confdefs/obsolete.h | 199 +++
 4 files changed, 203 insertions(+), 155 deletions(-)
 create mode 100644 cpukit/include/rtems/confdefs/obsolete.h

diff --git a/cpukit/header-dirs.am b/cpukit/header-dirs.am
index 7197f1a29f..d90271be9e 100644
--- a/cpukit/header-dirs.am
+++ b/cpukit/header-dirs.am
@@ -50,6 +50,8 @@ include_rtems_bfindir = $(includedir)/rtems/bfin
 include_rtems_bfin_HEADERS =
 include_rtems_bsdnetdir = $(includedir)/rtems/bsdnet
 include_rtems_bsdnet_HEADERS =
+include_rtems_confdefsdir = $(includedir)/rtems/confdefs
+include_rtems_confdefs_HEADERS =
 include_rtems_debuggerdir = $(includedir)/rtems/debugger
 include_rtems_debugger_HEADERS =
 include_rtems_m68kdir = $(includedir)/rtems/m68k
diff --git a/cpukit/headers.am b/cpukit/headers.am
index 6e1ab4ccd0..f0c8319dcb 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -183,6 +183,7 @@ include_rtems_HEADERS += include/rtems/userenv.h
 include_rtems_HEADERS += include/rtems/version.h
 include_rtems_HEADERS += include/rtems/vmeintr.h
 include_rtems_HEADERS += include/rtems/watchdogdrv.h
+include_rtems_confdefs_HEADERS += include/rtems/confdefs/obsolete.h
 include_rtems_debugger_HEADERS += include/rtems/debugger/rtems-debugger-bsp.h
 include_rtems_debugger_HEADERS += 
include/rtems/debugger/rtems-debugger-remote.h
 include_rtems_debugger_HEADERS += 
include/rtems/debugger/rtems-debugger-server.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index e0d4a77075..cf58f5ecc2 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -50,6 +50,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -138,11 +139,6 @@ extern "C" {
 #endif
 #endif
 
-#ifdef CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
-  #warning "CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS has been renamed to 
CONFIGURE_MAXIMUM_FILE_DESCRIPTORS since RTEMS 5.1"
-  #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS 
CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS
-#endif
-
 /**
  * This macro defines the number of POSIX file descriptors allocated
  * and managed by libio.  These are the "integer" file descriptors that
@@ -167,11 +163,6 @@ extern "C" {
   const uint32_t rtems_libio_number_iops = RTEMS_ARRAY_SIZE(rtems_libio_iops);
 #endif
 
-#ifdef CONFIGURE_SMP_MAXIMUM_PROCESSORS
-  #warning "CONFIGURE_SMP_MAXIMUM_PROCESSORS has been renamed to 
CONFIGURE_MAXIMUM_PROCESSORS since RTEMS 5.1"
-  #define CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_SMP_MAXIMUM_PROCESSORS
-#endif
-
 /* Ensure that _CONFIGURE_MAXIMUM_PROCESSORS > 1 only in SMP configurations */
 #if defined(CONFIGURE_MAXIMUM_PROCESSORS) && defined(RTEMS_SMP)
   #define _CONFIGURE_MAXIMUM_PROCESSORS CONFIGURE_MAXIMUM_PROCESSORS
@@ -191,34 +182,10 @@ extern "C" {
   #endif
 #endif
 
-#ifdef CONFIGURE_SMP_APPLICATION
-  #warning "CONFIGURE_SMP_APPLICATION is obsolete since RTEMS 5.1"
-#endif
-
 /*
  * This sets up the resources for the FIFOs/pipes.
  */
 
-/**
- * This is specified to configure the maximum number of POSIX FIFOs.
- */
-#ifdef CONFIGURE_MAXIMUM_FIFOS
-  #warning "CONFIGURE_MAXIMUM_FIFOS is obsolete since RTEMS 5.1; use 
CONFIGURE_IMFS_ENABLE_MKFIFO instead"
-  #if CONFIGURE_MAXIMUM_FIFOS > 0
-#define CONFIGURE_IMFS_ENABLE_MKFIFO
-  #endif
-#endif
-
-/**
- * This is specified to configure the maximum number of POSIX named pipes.
- */
-#ifdef CONFIGURE_MAXIMUM_PIPES
-  #warning "CONFIGURE_MAXIMUM_PIPES is obsolete since RTEMS 5.1; use 
CONFIGURE_IMFS_ENABLE_MKFIFO instead"
-  #if CONFIGURE_MAXIMUM_PIPES > 0
-#define CONFIGURE_IMFS_ENABLE_MKFIFO
-  #endif
-#endif
-
 /**
  *  @defgroup ConfigFilesystems Filesystems and Mount Table Configuration
  *
@@ -617,14 +584,6 @@ extern "C" {
 #endif
 /**@}*/ /* end of file system group */
 
-/*
- *  STACK_CHECKER_ON was still available in 4.9 so give a warning for now.
- */
-#if defined(STACK_CHECKER_ON)
-  #define CONFIGURE_STACK_CHECKER_ENABLED
-  #warning "STACK_CHECKER_ON deprecated -- use CONFIGURE_STACK_CHECKER_ENABLED"
-#endif
-
 /**
  * This configures the stack checker user extension.
  */
@@ -702,21 +661,6 @@ extern "C" {
  *- CONFIGURE_SCHEDULER_USER_PER_THREAD
  */
 
-#ifdef CONFIGURE_SCHEDULER_CONTEXT
-  #warning "CONFIGURE_SCHEDULER_CONTEXT has been renamed to 
CONFIGURE_SCHEDULER since RTEMS 5.1"
-  #define CONFIGURE_SCHEDULER CONFIGURE_SCHEDULER_CONTEXT
-#endif
-
-#ifdef CONFIGURE_SCHEDULER_CONTROLS
-  #warning "CONFIGURE_SCHEDULER_CONTROLS has been renamed to 
CONFIGURE_SCHEDULER_TABLE_ENTRIES since RTEMS 5.1"
-  #define CONFIGURE_SCHEDULER_TABLE_ENTRIES CONFIGURE_SCHEDULER_CONTROLS
-#endif
-
-#ifdef CONFIGURE_SMP_SCHEDULER_ASSIGNMENTS
-  #warning 

[PATCH 07/18] config: Bring back RTEMS 4.11 configuration table

2020-02-14 Thread Sebastian Huber
This improves API backward compatibility of RTEMS 5.1 to previous
versions.
---
 cpukit/include/rtems/rtems/config.h   | 61 +++
 cpukit/rtems/src/getapiconfig.c   | 18 +++
 testsuites/sptests/spsysinit01/init.c | 21 
 3 files changed, 100 insertions(+)

diff --git a/cpukit/include/rtems/rtems/config.h 
b/cpukit/include/rtems/rtems/config.h
index a5078f6bb6..bd6b38a532 100644
--- a/cpukit/include/rtems/rtems/config.h
+++ b/cpukit/include/rtems/rtems/config.h
@@ -44,6 +44,67 @@ extern "C" {
  * + required number of each object type
  */
 typedef struct {
+  /**
+   * This field contains the maximum number of Classic API
+   * Tasks which are configured for this application.
+   */
+  uint32_tmaximum_tasks;
+
+  /**
+   * This field indicates whether Classic API notepads are
+   * enabled or disabled.
+   */
+  boolnotepads_enabled;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Timers which are configured for this application.
+   */
+  uint32_tmaximum_timers;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Semaphores which are configured for this application.
+   */
+  uint32_tmaximum_semaphores;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Message Queues which are configured for this application.
+   */
+  uint32_tmaximum_message_queues;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Partitions which are configured for this application.
+   */
+  uint32_tmaximum_partitions;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Regions which are configured for this application.
+   */
+  uint32_tmaximum_regions;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Dual Ported Memory Areas which are configured for this
+   * application.
+   */
+  uint32_tmaximum_ports;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Rate Monotonic Periods which are configured for this
+   * application.
+   */
+  uint32_tmaximum_periods;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Barriers which are configured for this application.
+   */
+  uint32_tmaximum_barriers;
 
   /**
* This field contains the number of Classic API Initialization
diff --git a/cpukit/rtems/src/getapiconfig.c b/cpukit/rtems/src/getapiconfig.c
index b69629504b..13b035a10d 100644
--- a/cpukit/rtems/src/getapiconfig.c
+++ b/cpukit/rtems/src/getapiconfig.c
@@ -37,6 +37,24 @@ static rtems_api_configuration_table config;
 const rtems_api_configuration_table *
 rtems_configuration_get_rtems_api_configuration( void )
 {
+  /*
+   * Always initialize the configuration table and do not bother with
+   * synchronization issues.  This function is not performance critical.  The
+   * configuration values are all constants.
+   */
+
+  config.notepads_enabled = false;
+  config.maximum_tasks = rtems_configuration_get_maximum_tasks();
+  config.maximum_timers = rtems_configuration_get_maximum_timers();
+  config.maximum_semaphores = rtems_configuration_get_maximum_semaphores();
+  config.maximum_message_queues =
+rtems_configuration_get_maximum_message_queues();
+  config.maximum_partitions = rtems_configuration_get_maximum_partitions();
+  config.maximum_regions = rtems_configuration_get_maximum_regions();
+  config.maximum_ports = rtems_configuration_get_maximum_ports();
+  config.maximum_periods = rtems_configuration_get_maximum_periods();
+  config.maximum_barriers = rtems_configuration_get_maximum_barriers();
+
   if ( _RTEMS_tasks_User_task_table.entry_point != NULL ) {
 config.number_of_initialization_tasks = 1;
 config.User_initialization_tasks_table = &_RTEMS_tasks_User_task_table;
diff --git a/testsuites/sptests/spsysinit01/init.c 
b/testsuites/sptests/spsysinit01/init.c
index 49b5a69a60..224eac468f 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -905,6 +905,26 @@ static void do_posix_timer_create(void)
 #endif /* RTEMS_POSIX_API */
 }
 
+static void check_config(void)
+{
+  const rtems_api_configuration_table *config;
+
+  config = rtems_configuration_get_rtems_api_configuration();
+
+  rtems_test_assert(!config->notepads_enabled);
+  rtems_test_assert(config->maximum_tasks == 2);
+  rtems_test_assert(config->maximum_timers == 1);
+  rtems_test_assert(config->maximum_semaphores == 1);
+  rtems_test_assert(config->maximum_message_queues == 1);
+  rtems_test_assert(config->maximum_partitions == 1);
+  rtems_test_assert(config->maximum_regions == 1);
+  rtems_test_assert(config->maximum_ports == 1);
+  rtems_test_assert(config->maximum_periods == 1);
+  rtems_test_assert(config->maximum_barriers == 1);
+  

[PATCH 01/18] Remove rtems_configuration_get_posix_api_configuration()

2020-02-14 Thread Sebastian Huber
The corresponding data structure not longer exists. This function was
not tested and documented.

Close #3871.
---
 cpukit/include/rtems/config.h | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index c1d735f587..1c9b35da87 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -261,9 +261,6 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
 #define rtems_configuration_get_rtems_api_configuration() \
 (_RTEMS_API)
 
-#define rtems_configuration_get_posix_api_configuration() \
-(_POSIX_API)
-
 #ifdef __cplusplus
 }
 #endif
-- 
2.16.4

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


[PATCH 08/18] posix: Remove

2020-02-14 Thread Sebastian Huber
This file contained duplicate prototypes for standard POSIX functions
declared in .
---
 cpukit/headers.am   |  1 -
 cpukit/include/rtems/posix/ptimer.h | 88 -
 cpukit/posix/src/timersettime.c |  1 -
 3 files changed, 90 deletions(-)
 delete mode 100644 cpukit/include/rtems/posix/ptimer.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index aa2db5771a..6f44b833e1 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -203,7 +203,6 @@ include_rtems_posix_HEADERS += 
include/rtems/posix/psignalimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/pthread.h
 include_rtems_posix_HEADERS += include/rtems/posix/pthreadattrimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/pthreadimpl.h
-include_rtems_posix_HEADERS += include/rtems/posix/ptimer.h
 include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/semaphore.h
 include_rtems_posix_HEADERS += include/rtems/posix/semaphoreimpl.h
diff --git a/cpukit/include/rtems/posix/ptimer.h 
b/cpukit/include/rtems/posix/ptimer.h
deleted file mode 100644
index f6de4ccb57..00
--- a/cpukit/include/rtems/posix/ptimer.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- * 
- * @brief POSIX Timers Private Support
- *
- * This include file contains all the private support information for
- * POSIX timers.
- */
-
-/*
- *  Initial Implementation:
- *COPYRIGHT (c) 1998.  Alfonso Escalera Piña
- *Largely rewritten by Joel Sherrill (1999).
- *
- *  COPYRIGHT (c) 1999-2013.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_POSIX_PTIMER_H
-#define _RTEMS_POSIX_PTIMER_H
-
-/**
- * @defgroup POSIX_PRIV_TIMERS POSIX Timers
- *
- * @ingroup POSIXAPI
- */
-/**@{**/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include 
-
-/**
- *  @brief Create a Per-Process Timer
- */
-int timer_create(
-  clockid_tclock_id,
-  struct sigevent *evp,
-  timer_t *timerid
-);
-
-/**
- *  @brief Delete a Per-Process Timer
- */
-int timer_delete(
-  timer_t timerid
-);
-
-/**
- *  @brief Set a Per-Process Timer
- */
-int timer_settime(
-  timer_t  timerid,
-  int  flags,
-  const struct itimerspec *value,
-  struct itimerspec   *ovalue
-);
-
-/**
- *  @brief Set a Per-Process Timer
- */
-int timer_gettime(
-  timer_ttimerid,
-  struct itimerspec *value
-);
-
-/**
- * @brief Get overrun count for a Per-Process Timer
- * 
- * The expiration of a timer must increase by one a counter.
- * After the signal handler associated to the timer finishes
- * its execution, _POSIX_Timer_TSR will have to set this counter to 0.
- */
-int timer_getoverrun(
-  timer_t   timerid
-);
-
-#ifdef __cplusplus
-}
-#endif
-/** @} */
-
-#endif /* _RTEMS_POSIX_PTIMER_H */
diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c
index 9212e49740..eb89029e29 100644
--- a/cpukit/posix/src/timersettime.c
+++ b/cpukit/posix/src/timersettime.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
-- 
2.16.4

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

[PATCH 00/18] Start with splitting up confdefs.h

2020-02-14 Thread Sebastian Huber
This is the first round of patches to split up confdefs.h.  See also:

https://devel.rtems.org/ticket/3875

Sebastian Huber (18):
  Remove rtems_configuration_get_posix_api_configuration()
  config: Remove unused configuration constant
  monitor: Use proper API for all config constants
  config: Remove CONFIGURE_HAS_OWN_INIT_TASK_TABLE
  config: Simplify initialization task config
  rtems: Simplify _RTEMS_tasks_Initialize_user_task()
  config: Bring back RTEMS 4.11 configuration table
  posix: Remove 
  config: Remove CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
  config: Add _Watchdog_Microseconds_per_tick
  config: Add _Watchdog_Ticks_per_timeslice
  config: Add _Thread_Idle_stack_size
  config: Add _Thread_Idle_body
  config: Add _Workspace_Size
  config: Add _Workspace_Is_unified
  config: Add _SMP_Processor_configure_maximum
  config: Add _SMP_Is_enabled
  config: Add 

 cpukit/Makefile.am|   7 +
 cpukit/header-dirs.am |   2 +
 cpukit/headers.am |   5 +-
 cpukit/include/rtems/confdefs.h   | 355 ++
 cpukit/include/rtems/confdefs/obsolete.h  | 199 +++
 cpukit/include/rtems/config.h | 115 +
 cpukit/include/rtems/posix/config.h   |  60 -
 cpukit/include/rtems/posix/pthread.h  |  25 +-
 cpukit/include/rtems/posix/pthreadimpl.h  |   1 -
 cpukit/include/rtems/posix/ptimer.h   |  88 ---
 cpukit/include/rtems/rtems/config.h   |  74 +-
 cpukit/include/rtems/rtems/tasksdata.h|  19 +-
 cpukit/include/rtems/score/smp.h  |  26 ++
 cpukit/include/rtems/score/threadidledata.h   |  83 ++
 cpukit/include/rtems/score/watchdogticks.h|  26 ++
 cpukit/include/rtems/score/wkspacedata.h  |  73 ++
 cpukit/libmisc/monitor/mon-config.c   |  15 +-
 cpukit/libmisc/monitor/mon-itask.c|   8 +-
 cpukit/posix/src/pthreadinitthreads.c |  75 +++---
 cpukit/posix/src/timersettime.c   |   1 -
 cpukit/rtems/src/getapiconfig.c   |  64 +
 cpukit/rtems/src/taskinitdefault.c|  34 +++
 cpukit/rtems/src/taskinitusers.c  | 103 +++-
 cpukit/score/src/threadcreateidle.c   |   6 +-
 cpukit/score/src/threadidledefault.c  |  34 +++
 cpukit/score/src/threadidlestacksizedefault.c |  34 +++
 cpukit/score/src/watchdogticksdefault.c   |  41 +++
 cpukit/score/src/watchdogtimeslicedefault.c   |  35 +++
 cpukit/score/src/wkspaceisunifieddefault.c|  34 +++
 testsuites/psxtests/psxfatal01/init.c |  22 +-
 testsuites/psxtests/psxfatal02/init.c |  40 +--
 testsuites/sptests/sp54/init.c|  26 +-
 testsuites/sptests/spfatal01/init.c   |  33 +--
 testsuites/sptests/spfatal02/init.c   |  20 +-
 testsuites/sptests/spfatal04/init.c   |  20 --
 testsuites/sptests/spfatal05/init.c   |  20 --
 testsuites/sptests/spfatal06/init.c   |  24 +-
 testsuites/sptests/spsysinit01/init.c |  21 ++
 38 files changed, 1014 insertions(+), 854 deletions(-)
 create mode 100644 cpukit/include/rtems/confdefs/obsolete.h
 delete mode 100644 cpukit/include/rtems/posix/config.h
 delete mode 100644 cpukit/include/rtems/posix/ptimer.h
 create mode 100644 cpukit/include/rtems/score/threadidledata.h
 create mode 100644 cpukit/include/rtems/score/wkspacedata.h
 create mode 100644 cpukit/rtems/src/getapiconfig.c
 create mode 100644 cpukit/rtems/src/taskinitdefault.c
 create mode 100644 cpukit/score/src/threadidledefault.c
 create mode 100644 cpukit/score/src/threadidlestacksizedefault.c
 create mode 100644 cpukit/score/src/watchdogticksdefault.c
 create mode 100644 cpukit/score/src/watchdogtimeslicedefault.c
 create mode 100644 cpukit/score/src/wkspaceisunifieddefault.c

-- 
2.16.4

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


[PATCH 17/18] config: Add _SMP_Is_enabled

2020-02-14 Thread Sebastian Huber
Move the is SMP enabled configuration constant out of the
configuration table.

Since this was the last configuration constant in
rtems_configuration_table, remove this type.

Update #3875.
---
 cpukit/include/rtems/confdefs.h  | 14 --
 cpukit/include/rtems/config.h| 31 ++-
 cpukit/include/rtems/score/smp.h | 13 +
 3 files changed, 19 insertions(+), 39 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index bcf3ab552a..e0d4a77075 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2656,20 +2656,14 @@ struct _reent *__getreent(void)
 #error "CONFIGURE_TASK_STACK_ALLOCATOR and 
CONFIGURE_TASK_STACK_DEALLOCATOR must be both defined or both undefined"
   #endif
 
-  /**
-   * This is the primary Configuration Table for this application.
-   */
-  const rtems_configuration_table Configuration = {
-#ifdef RTEMS_SMP
+  #ifdef RTEMS_SMP
+const bool _SMP_Is_enabled =
   #ifdef _CONFIGURE_SMP_APPLICATION
-true
+true;
   #else
-false
+false;
   #endif
-#endif
-  };
 
-  #ifdef RTEMS_SMP
 const uint32_t _SMP_Processor_configured_maximum =
   _CONFIGURE_MAXIMUM_PROCESSORS;
   #endif
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 5550397623..4811d0e704 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -72,28 +72,6 @@ typedef Stack_Allocator_allocate rtems_stack_allocate_hook;
  */
 typedef Stack_Allocator_free rtems_stack_free_hook;
 
-/*
- *  The following records define the Configuration Table.  The
- *  information contained in this table is required in all
- *  RTEMS systems, whether single or multiprocessor.  This
- *  table primarily defines the following:
- *
- * + location and size of the RTEMS Workspace
- * + microseconds per clock tick
- * + clock ticks per task timeslice
- * + required number of each object type for each API configured
- */
-typedef struct {
-  #ifdef RTEMS_SMP
-bool smp_enabled;
-  #endif
-} rtems_configuration_table;
-
-/**
- * This is the configuration table generated by confdefs.h.
- */
-extern const rtems_configuration_table Configuration;
-
 /*
  *  Some handy macros to avoid dependencies on either the BSP
  *  or the exact format of the configuration table.
@@ -182,13 +160,8 @@ uint32_t rtems_configuration_get_maximum_extensions( void 
);
  * @retval true SMP mode of operation is enabled.
  * @retval false Otherwise.
  */
-#ifdef RTEMS_SMP
-  #define rtems_configuration_is_smp_enabled() \
-(Configuration.smp_enabled)
-#else
-  #define rtems_configuration_is_smp_enabled() \
-false
-#endif
+#define rtems_configuration_is_smp_enabled() \
+  (_SMP_Is_enabled)
 
 /**
  * @brief Returns the configured maximum count of processors.
diff --git a/cpukit/include/rtems/score/smp.h b/cpukit/include/rtems/score/smp.h
index 2722fbdcee..36cfd981ab 100644
--- a/cpukit/include/rtems/score/smp.h
+++ b/cpukit/include/rtems/score/smp.h
@@ -36,6 +36,19 @@ extern "C" {
  * @{
  */
 
+/**
+ * @brief Indicates if SMP is enabled.
+ *
+ * In SMP configurations, this constant is defined by the application
+ * configuration via , otherwise it is a compile-time
+ * constant with the value false.
+ */
+#if defined(RTEMS_SMP)
+  extern const bool _SMP_Is_enabled;
+#else
+  #define _SMP_Is_enabled false
+#endif
+
 /**
  * @brief The configured processor maximum.
  *
-- 
2.16.4

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


[PATCH 12/18] config: Add _Thread_Idle_stack_size

2020-02-14 Thread Sebastian Huber
Move the idle thread stack size configuration constant out of the
configuration table.

Add THREAD_IDLE_STACK_SIZE_DEFAULT and use it to provide a default
definition of the idle thread stack size constant.

Update #3875.
---
 cpukit/Makefile.am|  1 +
 cpukit/headers.am |  1 +
 cpukit/include/rtems/confdefs.h   |  6 ++-
 cpukit/include/rtems/config.h | 10 +---
 cpukit/include/rtems/score/threadidledata.h   | 70 +++
 cpukit/score/src/threadcreateidle.c   |  3 +-
 cpukit/score/src/threadidlestacksizedefault.c | 34 +
 7 files changed, 115 insertions(+), 10 deletions(-)
 create mode 100644 cpukit/include/rtems/score/threadidledata.h
 create mode 100644 cpukit/score/src/threadidlestacksizedefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 4a793bf1f9..13ddeeab51 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -956,6 +956,7 @@ librtemscpu_a_SOURCES += score/src/threaddispatch.c
 librtemscpu_a_SOURCES += score/src/threadget.c
 librtemscpu_a_SOURCES += score/src/threadhandler.c
 librtemscpu_a_SOURCES += score/src/threadinitialize.c
+librtemscpu_a_SOURCES += score/src/threadidlestacksizedefault.c
 librtemscpu_a_SOURCES += score/src/threadloadenv.c
 librtemscpu_a_SOURCES += score/src/threadrestart.c
 librtemscpu_a_SOURCES += score/src/threadsetstate.c
diff --git a/cpukit/headers.am b/cpukit/headers.am
index 244e435c62..351e942cea 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -389,6 +389,7 @@ include_rtems_score_HEADERS += include/rtems/score/status.h
 include_rtems_score_HEADERS += include/rtems/score/sysstate.h
 include_rtems_score_HEADERS += include/rtems/score/thread.h
 include_rtems_score_HEADERS += include/rtems/score/threaddispatch.h
+include_rtems_score_HEADERS += include/rtems/score/threadidledata.h
 include_rtems_score_HEADERS += include/rtems/score/threadimpl.h
 include_rtems_score_HEADERS += include/rtems/score/threadmp.h
 include_rtems_score_HEADERS += include/rtems/score/threadq.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 6542c2a26d..9e166b39f3 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1161,6 +1161,11 @@ extern "C" {
   #error "CONFIGURE_IDLE_TASK_STACK_SIZE less than 
CONFIGURE_MINIMUM_TASK_STACK_SIZE"
 #endif
 
+#if defined(CONFIGURE_INIT) && \
+  CONFIGURE_IDLE_TASK_STACK_SIZE != THREAD_IDLE_STACK_SIZE_DEFAULT
+  const size_t _Thread_Idle_stack_size = CONFIGURE_IDLE_TASK_STACK_SIZE;
+#endif
+
 /*
  * Interrupt stack configuration.
  *
@@ -2655,7 +2660,6 @@ struct _reent *__getreent(void)
   const rtems_configuration_table Configuration = {
 CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
 CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */
-CONFIGURE_IDLE_TASK_STACK_SIZE,   /* IDLE task stack size */
 #ifdef CONFIGURE_UNIFIED_WORK_AREAS   /* true for unified work areas */
   true,
 #else
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 31a667a1d6..62804be41c 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -92,13 +93,6 @@ typedef struct {
*/
   void*(*idle_task)( uintptr_t );
 
-  /** 
-   * This field specifies the size of the IDLE task's stack.  If less than or
-   * equal to the minimum stack size, then the IDLE task will have the minimum
-   * stack size.
-   */
-  uint32_t   idle_task_stack_size;
-
   /**
* @brief Specifies if a unified work area is used or not.
*
@@ -164,7 +158,7 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
 (Configuration.idle_task)
 
 #define rtems_configuration_get_idle_task_stack_size() \
-(Configuration.idle_task_stack_size)
+(_Thread_Idle_stack_size)
 
 #define rtems_configuration_get_interrupt_stack_size() \
 ((size_t) _ISR_Stack_size)
diff --git a/cpukit/include/rtems/score/threadidledata.h 
b/cpukit/include/rtems/score/threadidledata.h
new file mode 100644
index 00..aa39466f7f
--- /dev/null
+++ b/cpukit/include/rtems/score/threadidledata.h
@@ -0,0 +1,70 @@
+/**
+ * @file
+ *
+ * @ingroup RTEMSScoreThread
+ *
+ * @brief Constants for the idle threads.
+ */
+
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 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 

[PATCH 11/18] config: Add _Watchdog_Ticks_per_timeslice

2020-02-14 Thread Sebastian Huber
Move the ticks per timeslice configuration constant out of the
configuration table.

Add WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT and use it to provide a default
definition of the watchdog ticks per timeslice constant.

Update #3875.
---
 cpukit/Makefile.am  |  1 +
 cpukit/include/rtems/confdefs.h | 11 ++---
 cpukit/include/rtems/config.h   |  7 +-
 cpukit/include/rtems/score/watchdogticks.h  | 13 +++
 cpukit/score/src/watchdogtimeslicedefault.c | 35 +
 5 files changed, 58 insertions(+), 9 deletions(-)
 create mode 100644 cpukit/score/src/watchdogtimeslicedefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index c3bdd284cd..4a793bf1f9 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -1003,6 +1003,7 @@ librtemscpu_a_SOURCES += score/src/watchdogremove.c
 librtemscpu_a_SOURCES += score/src/watchdogtick.c
 librtemscpu_a_SOURCES += score/src/watchdogticksdefault.c
 librtemscpu_a_SOURCES += score/src/watchdogtickssinceboot.c
+librtemscpu_a_SOURCES += score/src/watchdogtimeslicedefault.c
 librtemscpu_a_SOURCES += score/src/userextaddset.c
 librtemscpu_a_SOURCES += score/src/userext.c
 librtemscpu_a_SOURCES += score/src/userextremoveset.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 4c2c80b2a9..6542c2a26d 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1989,10 +1989,16 @@ extern "C" {
 #endif /* CONFIGURE_MICROSECONDS_PER_TICK */
 
 /** The configures the number of clock ticks per timeslice. */
-#ifndef CONFIGURE_TICKS_PER_TIMESLICE
-  #define CONFIGURE_TICKS_PER_TIMESLICE50
+#if defined(CONFIGURE_TICKS_PER_TIMESLICE) && \
+  CONFIGURE_TICKS_PER_TIMESLICE != WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT
+
+#ifdef CONFIGURE_INIT
+  const uint32_t _Watchdog_Ticks_per_timeslice =
+CONFIGURE_TICKS_PER_TIMESLICE;
 #endif
 
+#endif /* CONFIGURE_TICKS_PER_TIMESLICE */
+
 /**@}*/ /* end of General Configuration */
 
 /*
@@ -2648,7 +2654,6 @@ struct _reent *__getreent(void)
*/
   const rtems_configuration_table Configuration = {
 CONFIGURE_EXECUTIVE_RAM_SIZE, /* required RTEMS workspace */
-CONFIGURE_TICKS_PER_TIMESLICE,/* ticks per timeslice quantum */
 CONFIGURE_IDLE_TASK_BODY, /* user's IDLE task */
 CONFIGURE_IDLE_TASK_STACK_SIZE,   /* IDLE task stack size */
 #ifdef CONFIGURE_UNIFIED_WORK_AREAS   /* true for unified work areas */
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 84917366f3..31a667a1d6 100644
--- a/cpukit/include/rtems/config.h
+++ b/cpukit/include/rtems/config.h
@@ -86,11 +86,6 @@ typedef struct {
*/
   uintptr_t  work_space_size;
 
-  /** 
-   * This field specifies the number of ticks in each task's timeslice.
-   */
-  uint32_t   ticks_per_timeslice;
-
   /** 
* This element points to the BSP's optional idle task which may override
* the default one provided with RTEMS.
@@ -163,7 +158,7 @@ uint32_t rtems_configuration_get_maximum_extensions( void );
 (_Watchdog_Nanoseconds_per_tick)
 
 #define rtems_configuration_get_ticks_per_timeslice() \
-(Configuration.ticks_per_timeslice)
+(_Watchdog_Ticks_per_timeslice)
 
 #define rtems_configuration_get_idle_task() \
 (Configuration.idle_task)
diff --git a/cpukit/include/rtems/score/watchdogticks.h 
b/cpukit/include/rtems/score/watchdogticks.h
index eaeddb5e6b..11007c9310 100644
--- a/cpukit/include/rtems/score/watchdogticks.h
+++ b/cpukit/include/rtems/score/watchdogticks.h
@@ -47,6 +47,11 @@ typedef uint32_t   Watchdog_Interval;
  */
 #define WATCHDOG_MICROSECONDS_PER_TICK_DEFAULT 1
 
+/**
+ * @brief Default value for the watchdog ticks per timeslice.
+ */
+#define WATCHDOG_TICKS_PER_TIMESLICE_DEFAULT 50
+
 /**
  * @brief The watchdog ticks counter.
  *
@@ -78,6 +83,14 @@ extern const uint32_t _Watchdog_Nanoseconds_per_tick;
  */
 extern const uint32_t _Watchdog_Ticks_per_second;
 
+/**
+ * @brief The watchdog ticks per timeslice.
+ *
+ * This constant is defined by the application configuration via
+ * .
+ */
+extern const uint32_t _Watchdog_Ticks_per_timeslice;
+
 /** @} */
 
 #ifdef __cplusplus
diff --git a/cpukit/score/src/watchdogtimeslicedefault.c 
b/cpukit/score/src/watchdogtimeslicedefault.c
new file mode 100644
index 00..369cf5b0ae
--- /dev/null
+++ b/cpukit/score/src/watchdogtimeslicedefault.c
@@ -0,0 +1,35 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 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 

Re: Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Joel Sherrill
On Fri, Feb 14, 2020 at 9:42 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 14/02/2020 16:31, Joel Sherrill wrote:
>
>
>
> On Fri, Feb 14, 2020 at 9:04 AM Sebastian Huber <
> sebastian.hu...@embedded-brains.de> wrote:
>
>> On 14/02/2020 15:42, Joel Sherrill wrote:
>>
>> > I guess it is time to kill it.
>>
>> I already have a smoking gun in my hands. I think it would be possible
>> to make it working again with some effort. However, it is quite easy to
>> add scheduler test scenarios in the RTEMS test suite itself, for example:
>>
>>
>> https://git.rtems.org/rtems/tree/testsuites/smptests/smpschededf02/init.c#n108
>
>
> The simulator allowed you to instance any number of cores in a system and
> reduce the testing to just the scheduling events -- no interrupts, no
> hardware,
> no device drivers, and native debug environment.
>
> You can easily construct a system with 2, 4, 8, 32, or 64 nodes with it.
> It is
> more flexible and really much simpler to debug with when developing a
> scheduler.
>
> Ok, this is difficult with real hardware. If there is a need, we can make
> it work again.
>

Yeah. This is why I wrote it. A 10 line script translated into 100s of
lines of test code
and was more painful to debug.

But we aren't writing schedulers like we were a few years ago.

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

Re: Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Sebastian Huber

On 14/02/2020 16:31, Joel Sherrill wrote:




On Fri, Feb 14, 2020 at 9:04 AM Sebastian Huber 
> wrote:


On 14/02/2020 15:42, Joel Sherrill wrote:

> I guess it is time to kill it.

I already have a smoking gun in my hands. I think it would be
possible
to make it working again with some effort. However, it is quite
easy to
add scheduler test scenarios in the RTEMS test suite itself, for
example:


https://git.rtems.org/rtems/tree/testsuites/smptests/smpschededf02/init.c#n108


The simulator allowed you to instance any number of cores in a system and
reduce the testing to just the scheduling events -- no interrupts, no 
hardware,

no device drivers, and native debug environment.

You can easily construct a system with 2, 4, 8, 32, or 64 nodes with 
it. It is

more flexible and really much simpler to debug with when developing a
scheduler.
Ok, this is difficult with real hardware. If there is a need, we can 
make it work again.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: rtems-examples hello no output devfs

2020-02-14 Thread Sebastian Huber

On 14/02/2020 16:29, Joel Sherrill wrote:




On Fri, Feb 14, 2020 at 9:16 AM Sebastian Huber 
> wrote:


On 14/02/2020 15:45, Joel Sherrill wrote:


On Fri, Feb 14, 2020 at 7:08 AM Sebastian Huber
mailto:sebastian.hu...@embedded-brains.de>> wrote:

On 14/02/2020 13:57, Joel Sherrill wrote:

> Hi
>
> I haven't investigated or checked on other bsps but the
xilinx qemu
> bsp has no output with the hello world in examples. It uses
the devfs.
> Changing it to the default filesystem results in it working.
>
> I am suspicious of something with all the termios and new
console
> changes breaking it.
The devfs works only with legacy IO drivers. The Termios
drivers depend
on IMFS. I would like to remove the devfs in the future. The
IMFS is
highly configurable, there is no need for an additional
in-memory file
system.


Do not remove it. Please fix it.


The IMFS should be improved, so that we can remove the devfs. We
already have a bunch of configuration options to customize it:


https://docs.rtems.org/branches/master/c-user/configuring_a_system.html#file-system-configuration-parameters


You should look at the requirements for the older ESA RTEMS versions. 
They

had very specific requirements which ended up with the filesystem code
largerly removed AFAIK.


You can get rid of the file system with the 
CONFIGURE_APPLICATION_DISABLE_FILESYSTEM configuration option.




And you did break existing code in the public repository. If we need 
more tests
to ensure it works, then so be it. It is a feature in the current code 
base and it

just broke.

Until the IMFS can be proved to be configurable to meet the 
requirements that
resulted in the filesystem code being removed/minimized in the old 
ESA  versions
and other folks who needed the simplest possible infrastructure for 
devices so

our normal frameworks would work, it needs to stay and work.
If you want a minimal setup, then why do you want to use the POSIX 
open/read/write API to access devices? The POSIX functions pull in errno 
for example which pulls in the re-entrancy support which pulls in a hell 
of dependencies. Why do you want to use a console driver with Termios in 
a minimal setup?


You can have a goal which you may or may nor achieve but you can't 
leave a

trail of code that is broken just because you don't like it.
To fix this break, I suggest to map CONFIGURE_FILESYSTEM_DEVFS to a 
suitable IMFS configuration similar to 
CONFIGURE_USE_MINIIMFS_AS_BASE_FILESYSTEM.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Joel Sherrill
On Fri, Feb 14, 2020 at 9:04 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 14/02/2020 15:42, Joel Sherrill wrote:
>
> > I guess it is time to kill it.
>
> I already have a smoking gun in my hands. I think it would be possible
> to make it working again with some effort. However, it is quite easy to
> add scheduler test scenarios in the RTEMS test suite itself, for example:
>
>
> https://git.rtems.org/rtems/tree/testsuites/smptests/smpschededf02/init.c#n108


The simulator allowed you to instance any number of cores in a system and
reduce the testing to just the scheduling events -- no interrupts, no
hardware,
no device drivers, and native debug environment.

You can easily construct a system with 2, 4, 8, 32, or 64 nodes with it. It
is
more flexible and really much simpler to debug with when developing a
scheduler.

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

Re: rtems-examples hello no output devfs

2020-02-14 Thread Joel Sherrill
On Fri, Feb 14, 2020 at 9:16 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 14/02/2020 15:45, Joel Sherrill wrote:
>
> On Fri, Feb 14, 2020 at 7:08 AM Sebastian Huber <
> sebastian.hu...@embedded-brains.de> wrote:
>
>> On 14/02/2020 13:57, Joel Sherrill wrote:
>>
>> > Hi
>> >
>> > I haven't investigated or checked on other bsps but the xilinx qemu
>> > bsp has no output with the hello world in examples. It uses the devfs.
>> > Changing it to the default filesystem results in it working.
>> >
>> > I am suspicious of something with all the termios and new console
>> > changes breaking it.
>> The devfs works only with legacy IO drivers. The Termios drivers depend
>> on IMFS. I would like to remove the devfs in the future. The IMFS is
>> highly configurable, there is no need for an additional in-memory file
>> system.
>>
>
> Do not remove it. Please fix it.
>
> The IMFS should be improved, so that we can remove the devfs. We already
> have a bunch of configuration options to customize it:
>
>
> https://docs.rtems.org/branches/master/c-user/configuring_a_system.html#file-system-configuration-parameters
>

You should look at the requirements for the older ESA RTEMS versions. They
had very specific requirements which ended up with the filesystem code
largerly removed AFAIK.

And you did break existing code in the public repository. If we need more
tests
to ensure it works, then so be it. It is a feature in the current code base
and it
just broke.

Until the IMFS can be proved to be configurable to meet the requirements
that
resulted in the filesystem code being removed/minimized in the old ESA
versions
and other folks who needed the simplest possible infrastructure for devices
so
our normal frameworks would work, it needs to stay and work.

You can have a goal which you may or may nor achieve but you can't leave a
trail of code that is broken just because you don't like it.

>
>
> This filesystem is needed because some applications want no filesystem but
> you require one for device nodes. Even the IMFS is subject to mallocs which
> are undesired in the applications that this was supporting.
>
> Termios uses malloc(), so I don't think this filesystem makes sense for
> console drivers. I changed the clock driver to use a simple system
> initialization handler. Some time ago I refactored the IMFS mount operation
> to use statically allocated data:
>
>
> https://git.rtems.org/rtems/commit/?id=a9df9169882c564af6714bbf121c278092d3c51c
>
> With a bit of work the IMFS_make_generic_node() can be changed to not
> allocate memory and instead use memory provided by the caller. I spend a
> considerable amount of time to make it possible that some time in the
> future we can have applications with purely statically allocated resources.
>

OK. But that's maybe in the indefinite future and you broke something today.

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

Re: rtems-examples hello no output devfs

2020-02-14 Thread Sebastian Huber

On 14/02/2020 15:45, Joel Sherrill wrote:

On Fri, Feb 14, 2020 at 7:08 AM Sebastian Huber 
> wrote:


On 14/02/2020 13:57, Joel Sherrill wrote:

> Hi
>
> I haven't investigated or checked on other bsps but the xilinx qemu
> bsp has no output with the hello world in examples. It uses the
devfs.
> Changing it to the default filesystem results in it working.
>
> I am suspicious of something with all the termios and new console
> changes breaking it.
The devfs works only with legacy IO drivers. The Termios drivers
depend
on IMFS. I would like to remove the devfs in the future. The IMFS is
highly configurable, there is no need for an additional in-memory
file
system.


Do not remove it. Please fix it.


The IMFS should be improved, so that we can remove the devfs. We already 
have a bunch of configuration options to customize it:


https://docs.rtems.org/branches/master/c-user/configuring_a_system.html#file-system-configuration-parameters



This filesystem is needed because some applications want no filesystem but
you require one for device nodes. Even the IMFS is subject to mallocs 
which

are undesired in the applications that this was supporting.


Termios uses malloc(), so I don't think this filesystem makes sense for 
console drivers. I changed the clock driver to use a simple system 
initialization handler. Some time ago I refactored the IMFS mount 
operation to use statically allocated data:


https://git.rtems.org/rtems/commit/?id=a9df9169882c564af6714bbf121c278092d3c51c

With a bit of work the IMFS_make_generic_node() can be changed to not 
allocate memory and instead use memory provided by the caller. I spend a 
considerable amount of time to make it possible that some time in the 
future we can have applications with purely statically allocated resources.


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

Re: Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Sebastian Huber

On 14/02/2020 15:42, Joel Sherrill wrote:


I guess it is time to kill it.


I already have a smoking gun in my hands. I think it would be possible 
to make it working again with some effort. However, it is quite easy to 
add scheduler test scenarios in the RTEMS test suite itself, for example:


https://git.rtems.org/rtems/tree/testsuites/smptests/smpschededf02/init.c#n108

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


Re: rtems-examples hello no output devfs

2020-02-14 Thread Joel Sherrill
On Fri, Feb 14, 2020 at 7:08 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 14/02/2020 13:57, Joel Sherrill wrote:
>
> > Hi
> >
> > I haven't investigated or checked on other bsps but the xilinx qemu
> > bsp has no output with the hello world in examples. It uses the devfs.
> > Changing it to the default filesystem results in it working.
> >
> > I am suspicious of something with all the termios and new console
> > changes breaking it.
> The devfs works only with legacy IO drivers. The Termios drivers depend
> on IMFS. I would like to remove the devfs in the future. The IMFS is
> highly configurable, there is no need for an additional in-memory file
> system.
>

Do not remove it. Please fix it.

This filesystem is needed because some applications want no filesystem but
you require one for device nodes. Even the IMFS is subject to mallocs which
are undesired in the applications that this was supporting.

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

Re: Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Joel Sherrill
I guess it is time to kill it.

On Fri, Feb 14, 2020 at 8:36 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> On 14/02/2020 15:31, Sebastian Huber wrote:
>
> > The problem with this define is that it cannot within RTEMS.
> The problem with this define is that it cannot be tested within RTEMS.
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Sebastian Huber

On 14/02/2020 15:31, Sebastian Huber wrote:


The problem with this define is that it cannot within RTEMS.

The problem with this define is that it cannot be tested within RTEMS.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Remove support for RTEMS_SCHEDSIM?

2020-02-14 Thread Sebastian Huber

Hello,

there is a RTEMS_SCHEDSIM define which is used in a couple of files:

./cpukit/include/rtems/confdefs.h:#ifdef RTEMS_SCHEDSIM
./cpukit/include/rtems/confdefs.h:#ifndef RTEMS_SCHEDSIM
./cpukit/include/rtems/confdefs.h:#ifndef RTEMS_SCHEDSIM
./cpukit/include/rtems/confdefs.h:#ifndef RTEMS_SCHEDSIM
./cpukit/include/rtems/confdefs.h:    #if !defined(RTEMS_SCHEDSIM) \
./cpukit/include/rtems/confdefs.h:#ifndef RTEMS_SCHEDSIM
./cpukit/include/rtems/confdefs.h:#if !defined(RTEMS_SCHEDSIM)
./cpukit/include/rtems/confdefs.h:#endif   /* !defined(RTEMS_SCHEDSIM) */
./cpukit/include/rtems/score/basedefs.h:#if defined(RTEMS_SCHEDSIM)
./cpukit/include/rtems/score/basedefs.h:#if defined(RTEMS_DEBUG) && 
!defined(RTEMS_SCHEDSIM)
./cpukit/include/rtems/score/basedefs.h:#if defined(__GNUC__) && 
!defined(RTEMS_SCHEDSIM)

./cpukit/include/rtems/score/assert.h:  #if !defined( RTEMS_SCHEDSIM )

This define is related to the scheduler simulator:

https://git.rtems.org/rtems-schedsim/tree/schedsim

The last update was five years ago. I made a quick review and it is 
probably horribly out of synchronization. If someone is interested in 
the scheduler simulator, I think it should be resurrected via the new 
build system. The  and  
should be provided by the scheduler simulator. With the split up of 
confdefs.h I think the RTEMS_SCHEDSIM handling in this file will be 
obsolete.


The problem with this define is that it cannot within RTEMS.

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

Re: rtems-examples hello no output devfs

2020-02-14 Thread Sebastian Huber

On 14/02/2020 13:57, Joel Sherrill wrote:


Hi

I haven't investigated or checked on other bsps but the xilinx qemu 
bsp has no output with the hello world in examples. It uses the devfs. 
Changing it to the default filesystem results in it working.


I am suspicious of something with all the termios and new console 
changes breaking it.
The devfs works only with legacy IO drivers. The Termios drivers depend 
on IMFS. I would like to remove the devfs in the future. The IMFS is 
highly configurable, there is no need for an additional in-memory file 
system.

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


rtems-examples hello no output devfs

2020-02-14 Thread Joel Sherrill
Hi

I haven't investigated or checked on other bsps but the xilinx qemu bsp has
no output with the hello world in examples. It uses the devfs. Changing it
to the default filesystem results in it working.

I am suspicious of something with all the termios and new console changes
breaking it.

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

[PATCH] config: Remove CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE

2020-02-14 Thread Sebastian Huber
The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and
CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_*
configuration options.  These two options are probably unused, see also:

* https://lists.rtems.org/pipermail/users/2019-April/033129.html

* https://lists.rtems.org/pipermail/users/2019-April/033130.html

Removing them simplifies the configuration. If there is a real user need
which shows up after the removal, we can resurrect them on demand.

Using CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE would have required the
use of the undocumented CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME and
CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE configuration options.

Update #3873.
---
 cpukit/headers.am|  1 -
 cpukit/include/rtems/confdefs.h  | 51 --
 cpukit/include/rtems/config.h|  1 -
 cpukit/include/rtems/posix/config.h  | 60 -
 cpukit/include/rtems/posix/pthread.h | 25 +--
 cpukit/include/rtems/posix/pthreadimpl.h |  1 -
 cpukit/posix/src/pthreadinitthreads.c| 75 +---
 testsuites/psxtests/psxfatal01/init.c| 22 +-
 testsuites/psxtests/psxfatal02/init.c| 40 ++---
 9 files changed, 83 insertions(+), 193 deletions(-)
 delete mode 100644 cpukit/include/rtems/posix/config.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index 6f44b833e1..244e435c62 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -189,7 +189,6 @@ include_rtems_debugger_HEADERS += 
include/rtems/debugger/rtems-debugger-server.h
 include_rtems_posix_HEADERS += include/rtems/posix/aio_misc.h
 include_rtems_posix_HEADERS += include/rtems/posix/barrierimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/condimpl.h
-include_rtems_posix_HEADERS += include/rtems/posix/config.h
 include_rtems_posix_HEADERS += include/rtems/posix/key.h
 include_rtems_posix_HEADERS += include/rtems/posix/keyimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/mmanimpl.h
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index bb00cffee7..0181af356a 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -2177,32 +2177,14 @@ struct _reent *__getreent(void)
 #endif
 
 #ifdef CONFIGURE_POSIX_INIT_THREAD_TABLE
-  #ifndef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
-#ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
-  #define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
-#endif
-
-#ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
-  #define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
-CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
-#endif
-
-#ifdef CONFIGURE_INIT
-  posix_initialization_threads_table POSIX_Initialization_threads[] = {
-{ CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
-  CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE }
-  };
-#endif
-
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME \
-  POSIX_Initialization_threads
+  #ifndef CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT
+#define CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT   POSIX_Init
+  #endif
 
-#define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE \
-  RTEMS_ARRAY_SIZE(CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME)
-  #endif /* !CONFIGURE_POSIX_HAS_OWN_INIT_TASK_TABLE */
-#else /* !CONFIGURE_POSIX_INIT_THREAD_TABLE */
-  #define CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME NULL
-  #define CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE 0
+  #ifndef CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+#define CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE \
+  CONFIGURE_MINIMUM_POSIX_THREAD_STACK_SIZE
+  #endif
 #endif /* CONFIGURE_POSIX_INIT_THREAD_TABLE */
 
 /**
@@ -2777,17 +2759,14 @@ struct _reent *__getreent(void)
  *  then we need to install the code that runs that loop.
  */
 #ifdef CONFIGURE_INIT
-  #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE) || \
-  defined(CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE)
-posix_initialization_threads_table * const
-  _Configuration_POSIX_Initialization_threads =
-CONFIGURE_POSIX_INIT_THREAD_TABLE_NAME;
-
-const size_t _Configuration_POSIX_Initialization_thread_count =
-  CONFIGURE_POSIX_INIT_THREAD_TABLE_SIZE;
+  #if defined(CONFIGURE_POSIX_INIT_THREAD_TABLE)
+const posix_initialization_threads_table _POSIX_Threads_User_thread_table 
= {
+  CONFIGURE_POSIX_INIT_THREAD_ENTRY_POINT,
+  CONFIGURE_POSIX_INIT_THREAD_STACK_SIZE
+};
 
 RTEMS_SYSINIT_ITEM(
-  _POSIX_Threads_Initialize_user_threads_body,
+  _POSIX_Threads_Initialize_user_thread,
   RTEMS_SYSINIT_POSIX_USER_THREADS,
   RTEMS_SYSINIT_ORDER_MIDDLE
 );
@@ -3012,6 +2991,10 @@ struct _reent *__getreent(void)
   #warning "The CONFIGURE_MAXIMUM_PTYS configuration option is obsolete since 
RTEMS 5.1"
 #endif
 
+#ifdef CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE
+  #warning "The CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE configuration option 
is obsolete since RTEMS 5.1"
+#endif
+
 #ifdef CONFIGURE_TERMIOS_DISABLED

[PATCH] posix: Remove

2020-02-14 Thread Sebastian Huber
This file contained duplicate prototypes for standard POSIX functions
declared in .
---
 cpukit/headers.am   |  1 -
 cpukit/include/rtems/posix/ptimer.h | 88 -
 cpukit/posix/src/timersettime.c |  1 -
 3 files changed, 90 deletions(-)
 delete mode 100644 cpukit/include/rtems/posix/ptimer.h

diff --git a/cpukit/headers.am b/cpukit/headers.am
index aa2db5771a..6f44b833e1 100644
--- a/cpukit/headers.am
+++ b/cpukit/headers.am
@@ -203,7 +203,6 @@ include_rtems_posix_HEADERS += 
include/rtems/posix/psignalimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/pthread.h
 include_rtems_posix_HEADERS += include/rtems/posix/pthreadattrimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/pthreadimpl.h
-include_rtems_posix_HEADERS += include/rtems/posix/ptimer.h
 include_rtems_posix_HEADERS += include/rtems/posix/rwlockimpl.h
 include_rtems_posix_HEADERS += include/rtems/posix/semaphore.h
 include_rtems_posix_HEADERS += include/rtems/posix/semaphoreimpl.h
diff --git a/cpukit/include/rtems/posix/ptimer.h 
b/cpukit/include/rtems/posix/ptimer.h
deleted file mode 100644
index f6de4ccb57..00
--- a/cpukit/include/rtems/posix/ptimer.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * @file
- * 
- * @brief POSIX Timers Private Support
- *
- * This include file contains all the private support information for
- * POSIX timers.
- */
-
-/*
- *  Initial Implementation:
- *COPYRIGHT (c) 1998.  Alfonso Escalera Piña
- *Largely rewritten by Joel Sherrill (1999).
- *
- *  COPYRIGHT (c) 1999-2013.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
- */
-
-#ifndef _RTEMS_POSIX_PTIMER_H
-#define _RTEMS_POSIX_PTIMER_H
-
-/**
- * @defgroup POSIX_PRIV_TIMERS POSIX Timers
- *
- * @ingroup POSIXAPI
- */
-/**@{**/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include 
-
-/**
- *  @brief Create a Per-Process Timer
- */
-int timer_create(
-  clockid_tclock_id,
-  struct sigevent *evp,
-  timer_t *timerid
-);
-
-/**
- *  @brief Delete a Per-Process Timer
- */
-int timer_delete(
-  timer_t timerid
-);
-
-/**
- *  @brief Set a Per-Process Timer
- */
-int timer_settime(
-  timer_t  timerid,
-  int  flags,
-  const struct itimerspec *value,
-  struct itimerspec   *ovalue
-);
-
-/**
- *  @brief Set a Per-Process Timer
- */
-int timer_gettime(
-  timer_ttimerid,
-  struct itimerspec *value
-);
-
-/**
- * @brief Get overrun count for a Per-Process Timer
- * 
- * The expiration of a timer must increase by one a counter.
- * After the signal handler associated to the timer finishes
- * its execution, _POSIX_Timer_TSR will have to set this counter to 0.
- */
-int timer_getoverrun(
-  timer_t   timerid
-);
-
-#ifdef __cplusplus
-}
-#endif
-/** @} */
-
-#endif /* _RTEMS_POSIX_PTIMER_H */
diff --git a/cpukit/posix/src/timersettime.c b/cpukit/posix/src/timersettime.c
index 9212e49740..eb89029e29 100644
--- a/cpukit/posix/src/timersettime.c
+++ b/cpukit/posix/src/timersettime.c
@@ -23,7 +23,6 @@
 #include 
 #include 
 
-#include 
 #include 
 #include 
 #include 
-- 
2.16.4

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

Re: AW: Description of rtems-libbsd testsuite applications

2020-02-14 Thread Sebastian Huber

On 14/02/2020 11:30, jan.som...@dlr.de wrote:


Thanks for the suggestions.
I have to figure out what some of the tests do anyway and writing it down 
somewhere will also prevent future-me to do it again.
If I have some notes, is it ok to prepare a README.md inside the individual 
test's directory or do you prefer a single README inside the testsuite 
directory with a section per test?


I would start with a new test suite section in

https://github.com/RTEMS/rtems-libbsd/blob/master/README.md

with sub-sections for each documented test. Some tests belong together, 
e.g. foobarserver and foobarclient.


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


AW: Description of rtems-libbsd testsuite applications

2020-02-14 Thread Jan.Sommer
Thanks for the suggestions.
I have to figure out what some of the tests do anyway and writing it down 
somewhere will also prevent future-me to do it again.
If I have some notes, is it ok to prepare a README.md inside the individual 
test's directory or do you prefer a single README inside the testsuite 
directory with a section per test?


> -Ursprüngliche Nachricht-
> Von: Sebastian Huber [mailto:sebastian.hu...@embedded-brains.de]
> Gesendet: Freitag, 14. Februar 2020 09:59
> An: Sommer, Jan; RTEMS
> Betreff: Re: Description of rtems-libbsd testsuite applications
> 
> Hello Jan,
> 
> On 14/02/2020 09:46, jan.som...@dlr.de wrote:
> > is there already somewhere a file which gives some short description what
> the different test applications in the testsuite directory (are supposed to) 
> do?
> > If not, would you accept patches with some short descriptions and maybe an
> example output?
> 
> there is no such documentation available. Thanks for your offer to fix
> this. If you have time, it would be nice to use the rtems_test_begin()
> and rtems_test_end() functions to print the begin/end messages. Using
> the test state RTEMS_TEST_STATE_USER_INPUT for tests which need user
> input or a network should allow test runs by the RTEMS Tester.
> 
> With respect to the description, maybe the first step would be to add it
> to the top of the files?
> 
> Using the new test framework would be nice:
> 
> https://docs.rtems.org/branches/master/eng/test-framework.html#the-rtems-
> test-framework
> 
> However, this is a labor intensive and boring task.

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

Re: [PATCH] tester: Add qemu_opts_serial

2020-02-14 Thread Chris Johns

On 2020-02-14 17:03, Sebastian Huber wrote:

On 14/02/2020 04:00, Chris Johns wrote:



I must be must be mising what has changed. I cannot see the "wrong 
options that have changed?


I removed the serial/monitor settings from qemu_opts_base and moved them 
to the new qemu_opts_serial. The realview_pbx_a9_qemu doesn't work with 
the serial settings.


Thanks.


-%define qemu_opts_no_net -net none


Why move? 


The definitions are now ordered from general to specific, e.g. 
qemu_opts_base is the first.


Sure. I viewed serial as more general than networking.

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


Re: [PATCH] testsuite/newlib: Check newlib does not touch an assigned std FILE pointer

2020-02-14 Thread Chris Johns



On 2020-02-14 17:11, Sebastian Huber wrote:


On 14/02/2020 04:41, chr...@rtems.org wrote:

From: Chris Johns 

Update #3870
---
  testsuites/libtests/newlib01/init.c | 16 +++-
  1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/testsuites/libtests/newlib01/init.c 
b/testsuites/libtests/newlib01/init.c

index 74e648799e..1bff052363 100644
--- a/testsuites/libtests/newlib01/init.c
+++ b/testsuites/libtests/newlib01/init.c
@@ -23,6 +23,8 @@
  #include 
  #include 
+#include 
+

Not needed?

  #include "tmacros.h"
  const char rtems_test_name[] = "NEWLIB 1";
@@ -63,12 +65,24 @@ static void wait(void)
  static void worker_task(rtems_task_argument arg)
  {
    test_context *ctx = _instance;
+  struct _reent *reent = __getreent();


I think you should include  and use

struct _reent *reent = _REENT;



Thanks. I was looking at the path the code took with the debugger but 
now you point this out it is how newlib accesses the pointer.



+  FILE *output;
    char buf[1] = { 'x' };
    size_t n;
-  stdout = fopen(_path[0], "r+");
+  rtems_test_assert(reent->__sdidinit == 0);
+
+  output = stdout = fopen(_path[0], "r+");
    rtems_test_assert(stdout != NULL);
+  /*
+   * Check newlib's __sinit does not touch our assigned file pointer.
+   */
+  rtems_test_assert(reent->__sdidinit == 0);
+  fflush(stdout);

fflush() should return 0 here.


I will add this and send v2.

Thanks for the review.

Chris


+  rtems_test_assert(reent->__sdidinit != 0);
+  rtems_test_assert(stdout == output);
+
    n = fwrite([0], sizeof(buf), 1, stdout);
    rtems_test_assert(n == 1);

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

[PATCH 1/4] config: Remove CONFIGURE_HAS_OWN_INIT_TASK_TABLE

2020-02-14 Thread Sebastian Huber
The CONFIGURE_HAS_OWN_INIT_TASK_TABLE and
CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE are the last *_HAS_OWN_*
configuration options.  These two options are probably unused, see also:

  * https://lists.rtems.org/pipermail/users/2019-April/033129.html

  * https://lists.rtems.org/pipermail/users/2019-April/033130.html

Removing them simplifies the configuration. If there is a real user need
which shows up after the removal, we can resurrect them on demand.

Using CONFIGURE_HAS_OWN_INIT_TASK_TABLE would have required the use of
the undocumented CONFIGURE_INIT_TASK_TABLE and
CONFIGURE_INIT_TASK_TABLE_SIZE configuration options.

Update #3873.
---
 cpukit/include/rtems/confdefs.h | 19 ++-
 testsuites/sptests/sp54/init.c  | 26 --
 testsuites/sptests/spfatal01/init.c | 33 +
 testsuites/sptests/spfatal02/init.c | 20 +---
 testsuites/sptests/spfatal04/init.c | 20 
 testsuites/sptests/spfatal05/init.c | 20 
 testsuites/sptests/spfatal06/init.c | 24 +---
 7 files changed, 25 insertions(+), 137 deletions(-)

diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index c7031cba19..355b434fdf 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -1312,13 +1312,8 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
  *
  * Default User Initialization Task Table.  This table guarantees that
  * one user initialization table is defined.
- *
- *  WHEN CONFIGURE_HAS_OWN_INIT_TASK_TABLE is defined, the user is
- *  responsible for defining their own table information and setting the
- *  appropriate variables.
  */
-#if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) && \
-!defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
+#if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
 
 /**
  * When using the default Classic API Initialization Tasks Table, this is
@@ -1414,13 +1409,6 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
   RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
 
 #else /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
-#ifdef CONFIGURE_HAS_OWN_INIT_TASK_TABLE
-
-/*
- * The user application is responsible for defining everything
- * when CONFIGURE_HAS_OWN_INIT_TABLE is defined.
- */
-#else /* not using standard or providing own Init Task Table */
 
 /*
  * This is the name of the Initialization Task when none is configured.
@@ -1437,8 +1425,6 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
  */
 #define CONFIGURE_INIT_TASK_STACK_SIZE 0
 
-#endif/* CONFIGURE_HAS_OWN_INIT_TASK_TABLE */
-
 #endif
 /**@}*/  /* end of Classic API Initialization Tasks Table */
 
@@ -2816,8 +2802,7 @@ struct _reent *__getreent(void)
  *  then we need to install the code that runs that loop.
  */
 #ifdef CONFIGURE_INIT
-  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE) || \
-  defined(CONFIGURE_HAS_OWN_INIT_TASK_TABLE)
+  #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
 RTEMS_SYSINIT_ITEM(
   _RTEMS_tasks_Initialize_user_tasks_body,
   RTEMS_SYSINIT_CLASSIC_USER_TASKS,
diff --git a/testsuites/sptests/sp54/init.c b/testsuites/sptests/sp54/init.c
index 07001e1e5e..71437fac8e 100644
--- a/testsuites/sptests/sp54/init.c
+++ b/testsuites/sptests/sp54/init.c
@@ -24,9 +24,10 @@ const char rtems_test_name[] = "SP 54";
 
 static void *Init( uintptr_t ignored )
 {
-  rtems_status_codestatus;
-  rtems_task_priority  pri;
-  rtems_id id;
+  rtems_status_codestatus;
+  rtems_task_priority  pri;
+  rtems_id id;
+  const rtems_api_configuration_table *config;
 
   /*
*  It is possible that since this thread prints and there is no idle
@@ -52,6 +53,10 @@ static void *Init( uintptr_t ignored )
 
   rtems_test_assert( rtems_configuration_get_do_zero_of_workspace() );
 
+  config = rtems_configuration_get_rtems_api_configuration();
+  rtems_test_assert( config->number_of_initialization_tasks == 0 );
+  rtems_test_assert( config->User_initialization_tasks_table == NULL );
+
   TEST_END();
   rtems_test_exit(0);
 }
@@ -68,21 +73,6 @@ static void *Init( uintptr_t ignored )
 #define CONFIGURE_IDLE_TASK_BODY Init
 #define CONFIGURE_IDLE_TASK_INITIALIZES_APPLICATION
 
-/*
- *  Another odd case to hit.  Since we use the Init task is Idle task
- *  configuration, we can dummy up the initialization task configuration
- *  to have a non-NULL pointer and 0 tasks.
- */
-
-#define CONFIGURE_HAS_OWN_INIT_TASK_TABLE 1
-
-rtems_initialization_tasks_table Initialization_tasks[1] =
-  { { 0, }};
-
-#define CONFIGURE_INIT_TASK_TABLE  Initialization_tasks
-#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
-#define CONFIGURE_INIT_TASK_STACK_SIZE 0
-
 #define CONFIGURE_DIRTY_MEMORY
 
 /*
diff --git a/testsuites/sptests/spfatal01/init.c 
b/testsuites/sptests/spfatal01/init.c
index 95067e74c6..4f0c008855 100644
--- 

[PATCH 2/4] config: Simplify initialization task config

2020-02-14 Thread Sebastian Huber
With the removal of the CONFIGURE_HAS_OWN_INIT_TASK_TABLE configuration
option at most one Classic API user initialization task can be
configured.

Provide an RTEMS API configuration table for backward compatibility.

Update #3873.
---
 cpukit/Makefile.am |   2 +
 cpukit/include/rtems/confdefs.h|  59 ---
 cpukit/include/rtems/config.h  |   3 -
 cpukit/include/rtems/rtems/config.h|  13 ++---
 cpukit/include/rtems/rtems/tasksdata.h |  19 +++
 cpukit/libmisc/monitor/mon-config.c|   4 +-
 cpukit/libmisc/monitor/mon-itask.c |   8 ++-
 cpukit/rtems/src/getapiconfig.c|  46 +++
 cpukit/rtems/src/taskinitdefault.c |  34 +++
 cpukit/rtems/src/taskinitusers.c   | 101 +++--
 10 files changed, 147 insertions(+), 142 deletions(-)
 create mode 100644 cpukit/rtems/src/getapiconfig.c
 create mode 100644 cpukit/rtems/src/taskinitdefault.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 44a0868cd5..1d3935776b 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -697,6 +697,7 @@ librtemscpu_a_SOURCES += rtems/src/eventreceive.c
 librtemscpu_a_SOURCES += rtems/src/eventseize.c
 librtemscpu_a_SOURCES += rtems/src/eventsend.c
 librtemscpu_a_SOURCES += rtems/src/eventsurrender.c
+librtemscpu_a_SOURCES += rtems/src/getapiconfig.c
 librtemscpu_a_SOURCES += rtems/src/getcurrentprocessor.c
 librtemscpu_a_SOURCES += rtems/src/getprocessorcount.c
 librtemscpu_a_SOURCES += rtems/src/intrbody.c
@@ -789,6 +790,7 @@ librtemscpu_a_SOURCES += rtems/src/taskgetaffinity.c
 librtemscpu_a_SOURCES += rtems/src/taskgetpriority.c
 librtemscpu_a_SOURCES += rtems/src/taskgetscheduler.c
 librtemscpu_a_SOURCES += rtems/src/taskident.c
+librtemscpu_a_SOURCES += rtems/src/taskinitdefault.c
 librtemscpu_a_SOURCES += rtems/src/taskinitusers.c
 librtemscpu_a_SOURCES += rtems/src/taskissuspended.c
 librtemscpu_a_SOURCES += rtems/src/taskiterate.c
diff --git a/cpukit/include/rtems/confdefs.h b/cpukit/include/rtems/confdefs.h
index 355b434fdf..d73087d1df 100644
--- a/cpukit/include/rtems/confdefs.h
+++ b/cpukit/include/rtems/confdefs.h
@@ -103,11 +103,6 @@ extern "C" {
  *used remarkably reliably by most applications.
  */
 
-/**
- * This is the Classic API initialization tasks table.
- */
-extern rtems_initialization_tasks_table Initialization_tasks[];
-
 #if defined(RTEMS_MULTIPROCESSING)
   /**
* This it the distributed multiprocessing configuration table.
@@ -1384,42 +1379,8 @@ extern rtems_initialization_tasks_table 
Initialization_tasks[];
   #define CONFIGURE_INIT_TASK_ARGUMENTS 0
 #endif
 
-#ifdef CONFIGURE_INIT
-  rtems_initialization_tasks_table Initialization_tasks[] = {
-{ CONFIGURE_INIT_TASK_NAME,
-  CONFIGURE_INIT_TASK_STACK_SIZE,
-  CONFIGURE_INIT_TASK_PRIORITY,
-  CONFIGURE_INIT_TASK_ATTRIBUTES,
-  CONFIGURE_INIT_TASK_ENTRY_POINT,
-  CONFIGURE_INIT_TASK_INITIAL_MODES,
-  CONFIGURE_INIT_TASK_ARGUMENTS
-}
-  };
-#endif
-
-/**
- * This is the name of the Initialization Tasks Table generated.
- */
-#define CONFIGURE_INIT_TASK_TABLE Initialization_tasks
-
-/*
- * This is the size of the Initialization Tasks Table generated.
- */
-#define CONFIGURE_INIT_TASK_TABLE_SIZE \
-  RTEMS_ARRAY_SIZE(CONFIGURE_INIT_TASK_TABLE)
-
 #else /* CONFIGURE_RTEMS_INIT_TASKS_TABLE */
 
-/*
- * This is the name of the Initialization Task when none is configured.
- */
-#define CONFIGURE_INIT_TASK_TABLE  NULL
-
-/*
- * This is the size of the Initialization Task when none is configured.
- */
-#define CONFIGURE_INIT_TASK_TABLE_SIZE 0
-
 /*
  * This is the stack size of the Initialization Task when none is configured.
  */
@@ -2605,14 +2566,6 @@ struct _reent *__getreent(void)
 EXTENSION_INFORMATION_DEFINE( CONFIGURE_MAXIMUM_USER_EXTENSIONS );
   #endif
 
-  /**
-   * This is the Classic API Configuration Table.
-   */
-  rtems_api_configuration_table Configuration_RTEMS_API = {
-CONFIGURE_INIT_TASK_TABLE_SIZE,
-CONFIGURE_INIT_TASK_TABLE
-  };
-
   #if CONFIGURE_MAXIMUM_POSIX_KEY_VALUE_PAIRS > 0
 POSIX_Keys_Key_value_pair _POSIX_Keys_Key_value_pairs[
   rtems_resource_maximum_per_allocation(
@@ -2803,8 +2756,18 @@ struct _reent *__getreent(void)
  */
 #ifdef CONFIGURE_INIT
   #if defined(CONFIGURE_RTEMS_INIT_TASKS_TABLE)
+const rtems_initialization_tasks_table _RTEMS_tasks_User_task_table = {
+  CONFIGURE_INIT_TASK_NAME,
+  CONFIGURE_INIT_TASK_STACK_SIZE,
+  CONFIGURE_INIT_TASK_PRIORITY,
+  CONFIGURE_INIT_TASK_ATTRIBUTES,
+  CONFIGURE_INIT_TASK_ENTRY_POINT,
+  CONFIGURE_INIT_TASK_INITIAL_MODES,
+  CONFIGURE_INIT_TASK_ARGUMENTS
+};
+
 RTEMS_SYSINIT_ITEM(
-  _RTEMS_tasks_Initialize_user_tasks_body,
+  _RTEMS_tasks_Initialize_user_task,
   RTEMS_SYSINIT_CLASSIC_USER_TASKS,
   RTEMS_SYSINIT_ORDER_MIDDLE
 );
diff --git a/cpukit/include/rtems/config.h b/cpukit/include/rtems/config.h
index 

[PATCH 4/4] config: Bring back RTEMS 4.11 configuration table

2020-02-14 Thread Sebastian Huber
This improves API backward compatibility of RTEMS 5.1 to previous
versions.
---
 cpukit/include/rtems/rtems/config.h   | 61 +++
 cpukit/rtems/src/getapiconfig.c   | 18 +++
 testsuites/sptests/spsysinit01/init.c | 21 
 3 files changed, 100 insertions(+)

diff --git a/cpukit/include/rtems/rtems/config.h 
b/cpukit/include/rtems/rtems/config.h
index a5078f6bb6..bd6b38a532 100644
--- a/cpukit/include/rtems/rtems/config.h
+++ b/cpukit/include/rtems/rtems/config.h
@@ -44,6 +44,67 @@ extern "C" {
  * + required number of each object type
  */
 typedef struct {
+  /**
+   * This field contains the maximum number of Classic API
+   * Tasks which are configured for this application.
+   */
+  uint32_tmaximum_tasks;
+
+  /**
+   * This field indicates whether Classic API notepads are
+   * enabled or disabled.
+   */
+  boolnotepads_enabled;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Timers which are configured for this application.
+   */
+  uint32_tmaximum_timers;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Semaphores which are configured for this application.
+   */
+  uint32_tmaximum_semaphores;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Message Queues which are configured for this application.
+   */
+  uint32_tmaximum_message_queues;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Partitions which are configured for this application.
+   */
+  uint32_tmaximum_partitions;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Regions which are configured for this application.
+   */
+  uint32_tmaximum_regions;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Dual Ported Memory Areas which are configured for this
+   * application.
+   */
+  uint32_tmaximum_ports;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Rate Monotonic Periods which are configured for this
+   * application.
+   */
+  uint32_tmaximum_periods;
+
+  /**
+   * This field contains the maximum number of Classic API
+   * Barriers which are configured for this application.
+   */
+  uint32_tmaximum_barriers;
 
   /**
* This field contains the number of Classic API Initialization
diff --git a/cpukit/rtems/src/getapiconfig.c b/cpukit/rtems/src/getapiconfig.c
index b69629504b..13b035a10d 100644
--- a/cpukit/rtems/src/getapiconfig.c
+++ b/cpukit/rtems/src/getapiconfig.c
@@ -37,6 +37,24 @@ static rtems_api_configuration_table config;
 const rtems_api_configuration_table *
 rtems_configuration_get_rtems_api_configuration( void )
 {
+  /*
+   * Always initialize the configuration table and do not bother with
+   * synchronization issues.  This function is not performance critical.  The
+   * configuration values are all constants.
+   */
+
+  config.notepads_enabled = false;
+  config.maximum_tasks = rtems_configuration_get_maximum_tasks();
+  config.maximum_timers = rtems_configuration_get_maximum_timers();
+  config.maximum_semaphores = rtems_configuration_get_maximum_semaphores();
+  config.maximum_message_queues =
+rtems_configuration_get_maximum_message_queues();
+  config.maximum_partitions = rtems_configuration_get_maximum_partitions();
+  config.maximum_regions = rtems_configuration_get_maximum_regions();
+  config.maximum_ports = rtems_configuration_get_maximum_ports();
+  config.maximum_periods = rtems_configuration_get_maximum_periods();
+  config.maximum_barriers = rtems_configuration_get_maximum_barriers();
+
   if ( _RTEMS_tasks_User_task_table.entry_point != NULL ) {
 config.number_of_initialization_tasks = 1;
 config.User_initialization_tasks_table = &_RTEMS_tasks_User_task_table;
diff --git a/testsuites/sptests/spsysinit01/init.c 
b/testsuites/sptests/spsysinit01/init.c
index 49b5a69a60..224eac468f 100644
--- a/testsuites/sptests/spsysinit01/init.c
+++ b/testsuites/sptests/spsysinit01/init.c
@@ -905,6 +905,26 @@ static void do_posix_timer_create(void)
 #endif /* RTEMS_POSIX_API */
 }
 
+static void check_config(void)
+{
+  const rtems_api_configuration_table *config;
+
+  config = rtems_configuration_get_rtems_api_configuration();
+
+  rtems_test_assert(!config->notepads_enabled);
+  rtems_test_assert(config->maximum_tasks == 2);
+  rtems_test_assert(config->maximum_timers == 1);
+  rtems_test_assert(config->maximum_semaphores == 1);
+  rtems_test_assert(config->maximum_message_queues == 1);
+  rtems_test_assert(config->maximum_partitions == 1);
+  rtems_test_assert(config->maximum_regions == 1);
+  rtems_test_assert(config->maximum_ports == 1);
+  rtems_test_assert(config->maximum_periods == 1);
+  rtems_test_assert(config->maximum_barriers == 1);
+  

[PATCH 3/4] rtems: Simplify _RTEMS_tasks_Initialize_user_task()

2020-02-14 Thread Sebastian Huber
Due to the system initialization order, the _Thread_Global_constructor
must be 0 in this function.
---
 cpukit/rtems/src/taskinitusers.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/cpukit/rtems/src/taskinitusers.c b/cpukit/rtems/src/taskinitusers.c
index a4f948afc9..1f902864e2 100644
--- a/cpukit/rtems/src/taskinitusers.c
+++ b/cpukit/rtems/src/taskinitusers.c
@@ -55,7 +55,6 @@ void _RTEMS_tasks_Initialize_user_task( void )
   _Assert( rtems_is_status_successful( return_value ) );
   (void) return_value;
 
-  if ( _Thread_Global_constructor == 0 ) {
-_Thread_Global_constructor = id;
-  }
+  _Assert( _Thread_Global_constructor == 0 );
+  _Thread_Global_constructor = id;
 }
-- 
2.16.4

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


Re: Description of rtems-libbsd testsuite applications

2020-02-14 Thread Sebastian Huber

Hello Jan,

On 14/02/2020 09:46, jan.som...@dlr.de wrote:

is there already somewhere a file which gives some short description what the 
different test applications in the testsuite directory (are supposed to) do?
If not, would you accept patches with some short descriptions and maybe an 
example output?


there is no such documentation available. Thanks for your offer to fix 
this. If you have time, it would be nice to use the rtems_test_begin() 
and rtems_test_end() functions to print the begin/end messages. Using 
the test state RTEMS_TEST_STATE_USER_INPUT for tests which need user 
input or a network should allow test runs by the RTEMS Tester.


With respect to the description, maybe the first step would be to add it 
to the top of the files?


Using the new test framework would be nice:

https://docs.rtems.org/branches/master/eng/test-framework.html#the-rtems-test-framework

However, this is a labor intensive and boring task.

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


Re: Description of rtems-libbsd testsuite applications

2020-02-14 Thread Christian Mauderer
Hello Jan,

On 14/02/2020 09:46, jan.som...@dlr.de wrote:
> Hello,
> 
> is there already somewhere a file which gives some short description what the 
> different test applications in the testsuite directory (are supposed to) do?

None that I know of.

> If not, would you accept patches with some short descriptions and maybe an 
> example output?

Documentation patches are always welcome.

Best regards

Christian

> 
> Cheers,
> 
>Jan
> 
> Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR)
> German Aerospace Center
> Simulation and Software Technology | Software for Space Systems and 
> Interactive Visualization | Lilienthalplatz 7 | 38108 Braunschweig | Germany
> 
> Jan Sommer
> Telephone +49 531 295-2494 | Telefax 0531 295-2767 | jan.som...@dlr.de
> DLR.de/SC
> 
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
> 

-- 

embedded brains GmbH
Herr Christian Mauderer
Dornierstr. 4
D-82178 Puchheim
Germany
email: christian.maude...@embedded-brains.de
Phone: +49-89-18 94 741 - 18
Fax:   +49-89-18 94 741 - 08
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Description of rtems-libbsd testsuite applications

2020-02-14 Thread Jan.Sommer
Hello,

is there already somewhere a file which gives some short description what the 
different test applications in the testsuite directory (are supposed to) do?
If not, would you accept patches with some short descriptions and maybe an 
example output?

Cheers,

   Jan

Deutsches Zentrum für Luft- und Raumfahrt e. V. (DLR)
German Aerospace Center
Simulation and Software Technology | Software for Space Systems and Interactive 
Visualization | Lilienthalplatz 7 | 38108 Braunschweig | Germany

Jan Sommer
Telephone +49 531 295-2494 | Telefax 0531 295-2767 | jan.som...@dlr.de
DLR.de/SC

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