Re: [PATCHES v2] Add more i.MX6UL/ULL support

2020-04-14 Thread Sebastian Huber

Hello Christian,

the patch set looks good (except maybe "[PATCH rtems-libbsd v2 09/14] 
bus-dma, imx: Don't sync nocache area.").


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


Re: [PATCH rtems-libbsd v2 09/14] bus-dma, imx: Don't sync nocache area.

2020-04-14 Thread Sebastian Huber

Is this patch still necessary?

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


Re: Open Tickets for RTEMS 5?

2020-04-14 Thread Sebastian Huber

On 14/04/2020 22:03, Joel Sherrill wrote:


There are still 15 tickets open:


https://devel.rtems.org/query?status=assigned=accepted=reopened=status=5.1

Please let me know if you need some help from my side.


We should whether to push 3944 (qoriq_e500 bset failure) and 3946 
(capture-support coverity issue) to 6.1.


The #3944 should be fixed. Linking against the libbsd without the linker 
garbage collection enabled is not supported in general.


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

Re: [PATCH v2] Test for clock_nanosleep with CLOCK_MONOTONIC option.

2020-04-14 Thread Sebastian Huber

Hello Utkarsh Rai,

do we really need a new test program for this test case? I would prefer 
add it to an existing test program or add a generic POSIX test program 
using the RTEMS Test Framework.


On 14/04/2020 19:17, Utkarsh Rai wrote:

This test checks for a simple 1 ns delay with clock_nanosleep with
CLOCK_MONOTONIC.
---
  testsuites/psxtests/Makefile.am   |  9 +++
  testsuites/psxtests/configure.ac  |  1 +
  .../psxtests/psxclocknanosleep01/init.c   | 81 +++
  .../psxclocknanosleep01.doc   | 10 +++
  .../psxclocknanosleep01.scn   |  3 +
  5 files changed, 104 insertions(+)
  create mode 100644 testsuites/psxtests/psxclocknanosleep01/init.c
  create mode 100644 
testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc
  create mode 100644 
testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 1f9e4233ec..e3918ae7a5 100755
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -321,6 +321,15 @@ psxclockrealtime01_CPPFLAGS = $(AM_CPPFLAGS) \
$(TEST_FLAGS_psxclockrealtime01) $(support_includes)
  endif
  
+if TEST_psxclocknanosleep01

+psx_tests += psxclocknanosleep01
+psx_screens += psxclocknanosleep01/psxclocknanosleep01.scn
+psx_docs += psxclocknanosleep01/psxclocknanosleep01.doc
+psxclocknanosleep01_SOURCES = psxclocknanosleep01/init.c
+psxclocknanosleep01_CPPFLAGS = $(AM_CPPFLAGS) \
+   $(TEST_FLAGS_psxclocknanosleep01) $(support_includes)
+endif
+
  if TEST_psxconcurrency01
  psx_tests += psxconcurrency01
  psx_screens += psxconcurrency01/psxconcurrency01.scn
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 139787cccb..9bfe8e2c0b 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -75,6 +75,7 @@ RTEMS_TEST_CHECK([psxcleanup01])
  RTEMS_TEST_CHECK([psxcleanup02])
  RTEMS_TEST_CHECK([psxclock])
  RTEMS_TEST_CHECK([psxclock01])
+RTEMS_TEST_CHECK([psxclocknanosleep01])
  RTEMS_TEST_CHECK([psxclockrealtime01])
  RTEMS_TEST_CHECK([psxconcurrency01])
  RTEMS_TEST_CHECK([psxcond01])
diff --git a/testsuites/psxtests/psxclocknanosleep01/init.c 
b/testsuites/psxtests/psxclocknanosleep01/init.c
new file mode 100644
index 00..21b738627d
--- /dev/null
+++ b/testsuites/psxtests/psxclocknanosleep01/init.c
@@ -0,0 +1,81 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 Utkarsh Rai
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*Forward declaration to avoid compiler warning*/
+void clock_sleep(void);
Please use a static function instead. Most of these forward declarations 
are just lazy warning fixes and bad examples.

+
+rtems_task Init(rtems_task_argument ignored);
+
+const char rtems_test_name[] = "PSXCLOCKNANOSLEEP 01";
+
+void clock_sleep(void)
+{
+  struct timespec delay_time;
+  intstatus;
+
+  delay_time.tv_sec = 0;
+  delay_time.tv_nsec = 1;
+
+  status=clock_nanosleep( CLOCK_MONOTONIC, 0, _time, (struct timespec* 
)NULL );

In C code this cast is superfluous, in C++ code using NULL is out dated.

+  rtems_test_assert( status == 0 );
+}
+
+rtems_task Init(rtems_task_argument ignored)
+{
+
+  struct timespec init_time;
+  struct timespec end_time;
+  intstatus;
+
+  TEST_BEGIN();
+
+  status = clock_gettime( CLOCK_MONOTONIC, _time );
+  rtems_test_assert( status == 0 );
+
+  clock_sleep();
+
+  status = clock_gettime( CLOCK_MONOTONIC, _time );
+  rtems_test_assert( status == 0 );
+
+  rtems_test_assert( (end_time.tv_sec-init_time.tv_sec) == 0 );


Is end_time.tv_sec - 

Re: Open Tickets for RTEMS 5?

2020-04-14 Thread Joel Sherrill
On Tue, Apr 14, 2020, 10:30 AM Sebastian Huber <
sebastian.hu...@embedded-brains.de> wrote:

> Hello,
>
> I am done with my tickets for RTEMS 5.


Awesome!

There are still 15 tickets open:
>
>
> https://devel.rtems.org/query?status=assigned=accepted=reopened=status=5.1
>
> Please let me know if you need some help from my side.


We should whether to push 3944 (qoriq_e500 bset failure) and 3946
(capture-support coverity issue) to 6.1.

Chris needs to triage the rest. I offered to push one out and he told me he
had a fix pending.

#3817 may be OK now that I deleted GCC from the FreeBSD test machine but
my experience on FreeBSD 12 isn't good.

I still have a number of build failures on the FreeBSD 12 test machine and
no idea how to resolve them. I removed GCC from the machine and started a
build sweep yesterday. I have posted a couple of failures today and you can
see the set on the build@ list archives. It would be nice to see better
results and I'm no FreeBSD expert. It would be nice to have help
triaging/fixing/pushing these to the future.

I will start with
> tests on hardware once the release branch is made.
>

I have posted lots of results on simulators. There are already 1065 emails
to build@
and were over 1500 last month. Things look good on simulators at least and
that's
all we have ever had in the past. I have tested on more simulators than any
previous
release ever was. If we cut the release today, it would be better tested
than any
previous one.

--joel

>
> ___
> 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

[PATCH v1] test for timer_create,Ticket #3889

2020-04-14 Thread Eshan dhawan
This will create a timer using timer_create() method and passing 
CLOCK_MONOTONIC. But it will fail as there is no support for
CLOCK_MONOTONIC in psxtimercreate.c.
---
 testsuites/psxtests/psxtimer02/psxtimer.c | 8 ++--
 testsuites/psxtests/psxtimer02/psxtimer02.scn | 3 ++-
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/testsuites/psxtests/psxtimer02/psxtimer.c 
b/testsuites/psxtests/psxtimer02/psxtimer.c
index 9f79d33c42..18acda2913 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer.c
+++ b/testsuites/psxtests/psxtimer02/psxtimer.c
@@ -62,9 +62,9 @@ void *POSIX_Init (
   status = timer_create( CLOCK_REALTIME, , NULL );
   fatal_posix_service_status_errno( status, EINVAL, "bad timer id" );
 
-  puts( "timer_create - OK" );
+  puts( "timer_create (CLOCK_REALTIME)- OK" );
   status = timer_create( CLOCK_REALTIME, NULL,  );
-  posix_service_failed( status, "timer_create OK" );
+  posix_service_failed( status, "timer_create (CLOCK_REALTIME)" );
 
   puts( "timer_create - too many - EAGAIN" );
   status = timer_create( CLOCK_REALTIME, NULL,  );
@@ -127,6 +127,10 @@ void *POSIX_Init (
   status = timer_delete( timer );
   fatal_posix_service_status_errno( status, EINVAL, "bad id" );
 
+  puts( "timer_create (CLOCK_MONOTONIC)- OK" );
+  status = timer_create(CLOCK_MONOTONIC, NULL, );
+  posix_service_failed( status, "timer_create (CLOCK_MONOTONIC)" );
+
   TEST_END();
   rtems_test_exit (0);
 }
diff --git a/testsuites/psxtests/psxtimer02/psxtimer02.scn 
b/testsuites/psxtests/psxtimer02/psxtimer02.scn
index e78425a32e..7429bcf291 100644
--- a/testsuites/psxtests/psxtimer02/psxtimer02.scn
+++ b/testsuites/psxtests/psxtimer02/psxtimer02.scn
@@ -1,7 +1,7 @@
 *** POSIX Timers Test 02 ***
 timer_create - bad clock id - EINVAL
 timer_create - bad timer id pointer - EINVAL
-timer_create - OK
+timer_create (CLOCK_REALTIME) - OK
 timer_create - too many - EAGAIN
 timer_delete - bad id - EINVAL
 timer_getoverrun - bad id - EINVAL
@@ -13,4 +13,5 @@ timer_settime - bad itimer value - negative nanosecond - 
EINVAL
 timer_settime - bad clock value - EINVAL
 timer_delete - OK
 timer_delete - bad id - EINVAL
+timer_create (CLOCK_MONOTONIC) - OK
 *** END OF POSIX Timers Test 02 ***
-- 
2.17.1

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


[PATCH v2] Test for clock_nanosleep with CLOCK_MONOTONIC option.

2020-04-14 Thread Utkarsh Rai
This test checks for a simple 1 ns delay with clock_nanosleep with
CLOCK_MONOTONIC.
---
 testsuites/psxtests/Makefile.am   |  9 +++
 testsuites/psxtests/configure.ac  |  1 +
 .../psxtests/psxclocknanosleep01/init.c   | 81 +++
 .../psxclocknanosleep01.doc   | 10 +++
 .../psxclocknanosleep01.scn   |  3 +
 5 files changed, 104 insertions(+)
 create mode 100644 testsuites/psxtests/psxclocknanosleep01/init.c
 create mode 100644 
testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc
 create mode 100644 
testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 1f9e4233ec..e3918ae7a5 100755
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -321,6 +321,15 @@ psxclockrealtime01_CPPFLAGS = $(AM_CPPFLAGS) \
$(TEST_FLAGS_psxclockrealtime01) $(support_includes)
 endif
 
+if TEST_psxclocknanosleep01
+psx_tests += psxclocknanosleep01
+psx_screens += psxclocknanosleep01/psxclocknanosleep01.scn
+psx_docs += psxclocknanosleep01/psxclocknanosleep01.doc
+psxclocknanosleep01_SOURCES = psxclocknanosleep01/init.c
+psxclocknanosleep01_CPPFLAGS = $(AM_CPPFLAGS) \
+   $(TEST_FLAGS_psxclocknanosleep01) $(support_includes)
+endif
+
 if TEST_psxconcurrency01
 psx_tests += psxconcurrency01
 psx_screens += psxconcurrency01/psxconcurrency01.scn
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 139787cccb..9bfe8e2c0b 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -75,6 +75,7 @@ RTEMS_TEST_CHECK([psxcleanup01])
 RTEMS_TEST_CHECK([psxcleanup02])
 RTEMS_TEST_CHECK([psxclock])
 RTEMS_TEST_CHECK([psxclock01])
+RTEMS_TEST_CHECK([psxclocknanosleep01])
 RTEMS_TEST_CHECK([psxclockrealtime01])
 RTEMS_TEST_CHECK([psxconcurrency01])
 RTEMS_TEST_CHECK([psxcond01])
diff --git a/testsuites/psxtests/psxclocknanosleep01/init.c 
b/testsuites/psxtests/psxclocknanosleep01/init.c
new file mode 100644
index 00..21b738627d
--- /dev/null
+++ b/testsuites/psxtests/psxclocknanosleep01/init.c
@@ -0,0 +1,81 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 Utkarsh Rai
+ *
+ * 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.
+ */
+
+#include 
+#include 
+#include 
+#include 
+
+/*Forward declaration to avoid compiler warning*/
+void clock_sleep(void);
+
+rtems_task Init(rtems_task_argument ignored);
+
+const char rtems_test_name[] = "PSXCLOCKNANOSLEEP 01";
+
+void clock_sleep(void)
+{
+  struct timespec delay_time;
+  intstatus;
+
+  delay_time.tv_sec = 0;
+  delay_time.tv_nsec = 1;
+
+  status=clock_nanosleep( CLOCK_MONOTONIC, 0, _time, (struct timespec* 
)NULL );
+  rtems_test_assert( status == 0 );
+}
+
+rtems_task Init(rtems_task_argument ignored)
+{
+
+  struct timespec init_time;
+  struct timespec end_time;
+  intstatus;
+
+  TEST_BEGIN();
+
+  status = clock_gettime( CLOCK_MONOTONIC, _time );
+  rtems_test_assert( status == 0 );
+
+  clock_sleep();
+
+  status = clock_gettime( CLOCK_MONOTONIC, _time );
+  rtems_test_assert( status == 0 );
+
+  rtems_test_assert( (end_time.tv_sec-init_time.tv_sec) == 0 );
+  rtems_test_assert( (end_time.tv_nsec-init_time.tv_nsec) >=1 );
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MAXIMUM_TASKS  1
+#define CONFIGURE_INIT
+#include 
\ No newline at end of file
diff --git a/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc 
b/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc
new file mode 100644
index 

Open Tickets for RTEMS 5?

2020-04-14 Thread Sebastian Huber

Hello,

I am done with my tickets for RTEMS 5. There are still 15 tickets open:

https://devel.rtems.org/query?status=assigned=accepted=reopened=status=5.1

Please let me know if you need some help from my side. I will start with 
tests on hardware once the release branch is made.


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


[PATCH 2/3] c-user: Add removed directive rtems_clock_get()

2020-04-14 Thread Sebastian Huber
Be in line with Task Manager chapter.

Update #2693.
---
 c-user/clock_manager.rst | 128 +++
 1 file changed, 107 insertions(+), 21 deletions(-)

diff --git a/c-user/clock_manager.rst b/c-user/clock_manager.rst
index 905d327..9ece420 100644
--- a/c-user/clock_manager.rst
+++ b/c-user/clock_manager.rst
@@ -184,20 +184,28 @@ RTEMS provides multiple directives which can be used by 
an application to obtain
 Calendar time operations will return an error code if invoked before the date
 and time have been set.
 
-.. index:: rtems_clock_get
+.. _ClockManagerAdviceClockGet:
+
+Transition Advice for the Removed rtems_clock_get()
+---
+
+The method :ref:`rtems_clock_get` took an untyped pointer with an options
+argument to indicate the time information desired. This has been replaced with
+a set of typed directives:
+
+* :ref:`rtems_clock_get_seconds_since_epoch`
 
-Transition Advice for the Obsolete rtems_clock_get
---
+* :ref:`rtems_clock_get_ticks_per_second`
 
-The method ``rtems_clock_get`` took an untyped pointer with an
-options argument to indicate the time information desired. This has
-been replaced with a set of typed directives whose name is of the form
-``rtems_clock_get_INFORMATION`` where INFORMATION indicates the type of
-information and possibly the format.  These methods directly correspond to
-what were previously referred to ask "clock options." These strongly typed
-were available for multiple releases in parallel with ``rtems_clock_get``
-until that method was removed.
+* :ref:`rtems_clock_get_ticks_since_boot`
 
+* :ref:`rtems_clock_get_tod`
+
+* :ref:`rtems_clock_get_tod_timeval`
+
+These methods directly correspond to what were previously referred to ask
+*clock options*.  These strongly typed were available for multiple releases in
+parallel with :c:func:`rtems_clock_get` until that method was removed.
 
 Directives
 ==
@@ -260,11 +268,11 @@ NOTES:
 
\clearpage
 
-.. _rtems_clock_get_tod:
-
 .. index:: obtain the time of day
 .. index:: rtems_clock_get_tod
 
+.. _rtems_clock_get_tod:
+
 CLOCK_GET_TOD - Get date and time in TOD format
 ---
 
@@ -304,11 +312,11 @@ NOTES:
 
\clearpage
 
-.. _rtems_clock_get_tod_timeval:
-
 .. index:: obtain the time of day
 .. index:: rtems_clock_get_tod_timeval
 
+.. _rtems_clock_get_tod_timeval:
+
 CLOCK_GET_TOD_TIMEVAL - Get date and time in timeval format
 ---
 
@@ -348,11 +356,11 @@ NOTES:
 
\clearpage
 
-.. _rtems_clock_get_seconds_since_epoch:
-
 .. index:: obtain seconds since epoch
 .. index:: rtems_clock_get_seconds_since_epoch
 
+.. _rtems_clock_get_seconds_since_epoch:
+
 CLOCK_GET_SECONDS_SINCE_EPOCH - Get seconds since epoch
 ---
 
@@ -392,11 +400,11 @@ NOTES:
 
\clearpage
 
-.. _rtems_clock_get_ticks_per_second:
-
 .. index:: obtain seconds since epoch
 .. index:: rtems_clock_get_ticks_per_second
 
+.. _rtems_clock_get_ticks_per_second:
+
 CLOCK_GET_TICKS_PER_SECOND - Get ticks per second
 -
 
@@ -422,12 +430,12 @@ NOTES:
 
\clearpage
 
-.. _rtems_clock_get_ticks_since_boot:
-
 .. index:: obtain ticks since boot
 .. index:: get current ticks counter value
 .. index:: rtems_clock_get_ticks_since_boot
 
+.. _rtems_clock_get_ticks_since_boot:
+
 CLOCK_GET_TICKS_SINCE_BOOT - Get current ticks counter value
 
 
@@ -666,3 +674,81 @@ DESCRIPTION:
 
 NOTES:
 This directive may be called from an ISR.
+
+Removed Directives
+==
+
+.. raw:: latex
+
+   \clearpage
+
+.. _rtems_clock_get:
+
+CLOCK_GET - Get date and time information
+-
+.. index:: obtain the time of day
+.. index:: rtems_clock_get
+
+.. warning::
+
+This directive was removed in RTEMS 5.1.  See also
+:ref:`ClockManagerAdviceClockGet`.
+
+CALLING SEQUENCE:
+.. code-block:: c
+
+rtems_status_code rtems_clock_get(
+   rtems_clock_get_options  option,
+   void*time_buffer
+);
+
+DIRECTIVE STATUS CODES:
+.. list-table::
+  :class: rtems-table
+
+  * - ``RTEMS_SUCCESSFUL``
+- current time obtained successfully
+  * - ``RTEMS_NOT_DEFINED``
+- system date and time is not set
+  * - ``RTEMS_INVALID_ADDRESS``
+- ``time_buffer`` is NULL
+
+DESCRIPTION:
+This directive obtains the system date and time.  If the caller is
+attempting to obtain the date and time (i.e.  option is set to either
+``RTEMS_CLOCK_GET_SECONDS_SINCE_EPOCH``, ``RTEMS_CLOCK_GET_TOD``, or
+``RTEMS_CLOCK_GET_TIME_VALUE``) and the date and time has not been set with
+a previous call to ``rtems_clock_set``, then the 

[PATCH 1/3] user: Update migration guide

2020-04-14 Thread Sebastian Huber
Update #3895.
---
 user/migration/v4_11-to-v5.rst | 54 --
 1 file changed, 42 insertions(+), 12 deletions(-)

diff --git a/user/migration/v4_11-to-v5.rst b/user/migration/v4_11-to-v5.rst
index 4329771..2917951 100644
--- a/user/migration/v4_11-to-v5.rst
+++ b/user/migration/v4_11-to-v5.rst
@@ -1,6 +1,7 @@
 .. SPDX-License-Identifier: CC-BY-SA-4.0
 
 .. Copyright (C) 2020 Chris Johns
+.. Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
 
 .. _Migration_4_11_to_5:
 
@@ -10,33 +11,62 @@ RTEMS 4.11 to RTEMS 5
 This section provides helpful information when migrating from RTEMS 4.11 to
 RTEMS 5.
 
-Configuration
--
+Application Configuration Options
+-
+
+The evaluation of application configuration options in 
+was reworked during the RTEMS 5 development cycle.  All options which let the
+user define data structures were removed, this includes
+
+* ``CONFIGURE_HAS_OWN_CONFIGURATION_TABLE``,
+
+* ``CONFIGURE_HAS_OWN_BDBUF_TABLE``,
+
+* ``CONFIGURE_HAS_OWN_DEVICE_DRIVER_TABLE``,
+
+* ``CONFIGURE_HAS_OWN_FILESYSTEM_TABLE``,
+
+* ``CONFIGURE_HAS_OWN_INIT_TABLE``,
 
-A number of configurations macros have moved as a result of internal changes in
-RTEMS. Some of these will produce a warning indicating the new configuration
-setings you need to define. If you need to run an application on RTEMS 4.11 and
-RTEMS 5 the following code exmaple shows how to conditionally define the
-settings. The example is:
+* ``CONFIGURE_HAS_OWN_MOUNT_TABLE``,
+
+* ``CONFIGURE_HAS_OWN_MULTIPROCESSING_TABLE``, and
+
+* ``CONFIGURE_POSIX_HAS_OWN_INIT_THREAD_TABLE``.
+
+The configuration of SMP schedulers changed.  Please read the corresponding
+chapter in the RTEMS Classic API Guide.
+
+A number of configurations options have moved or are obsolete as a result of
+internal changes in RTEMS.  Some of these will produce a warning indicating the
+new configuration setings you need to define. If you need to run an application
+on RTEMS 4.11 and RTEMS 5 the following code exmaple shows how to conditionally
+define the settings. The example is:
 
 .. code-block:: c
 
 #include 
 
 #if __RTEMS_MAJOR__ < 5
- #define CONFIGURE_MAXIMUM_FIFOS 10
- #define CONFIGURE_MAXIMUM_PIPES 10
+  #define CONFIGURE_MAXIMUM_FIFOS 10
+  #define CONFIGURE_MAXIMUM_PIPES 10
 #else
- #define CONFIGURE_IMFS_ENABLE_MKFIFO
+  #define CONFIGURE_IMFS_ENABLE_MKFIFO
 #endif
 
 #define MAX_FILE_DESCRIPTORS 200
 #if __RTEMS_MAJOR__ < 5
- #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS MAX_FILE_DESCRIPTORS
+  #define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS MAX_FILE_DESCRIPTORS
 #else
- #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS   MAX_FILE_DESCRIPTORS
+  #define CONFIGURE_MAXIMUM_FILE_DESCRIPTORS   MAX_FILE_DESCRIPTORS
 #endif
 
+Clock Manager
+-
+
+The directive :c:func:`rtems_clock_get` was removed.  See the RTEMS Classic API
+Guide for alternatives.
+
 Networking
 --
 
-- 
2.16.4

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


[PATCH 3/3] c-user: Split deprecated/removed directives chapter

2020-04-14 Thread Sebastian Huber
---
 c-user/task_manager.rst | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/c-user/task_manager.rst b/c-user/task_manager.rst
index aca3699..c3919f4 100644
--- a/c-user/task_manager.rst
+++ b/c-user/task_manager.rst
@@ -600,7 +600,7 @@ against the current system configuration.
 .. index:: rtems_task_get_note
 .. index:: rtems_task_set_note
 
-Transition Advice for Obsolete Notepads
+Transition Advice for Removed Notepads
 ---
 
 Task notepads and the associated directives :ref:`rtems_task_get_note` and
@@ -618,7 +618,7 @@ also possible that thread-local storage (TLS) is an option 
for some use cases.
 .. index:: rtems_task_variable_get
 .. index:: rtems_task_variable_delete
 
-Transition Advice for Obsolete Task Variables
+Transition Advice for Removed Task Variables
 -
 
 Task notepads and the associated directives :ref:`rtems_task_variable_add`,
@@ -1757,8 +1757,8 @@ NOTES:
 visitor, however, take care that no deadlocks via the object allocator lock
 can occur.
 
-Deprecated and Removed Directives
-=
+Deprecated Directives
+=
 
 .. raw:: latex
 
@@ -1800,6 +1800,9 @@ NOTES:
 control block may be in an inconsistent state or may change due to
 interrupts or activity on other processors.
 
+Removed Directives
+==
+
 .. raw:: latex
 
\clearpage
-- 
2.16.4

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


qemu4 bset on FreeBSD 12

2020-04-14 Thread Joel Sherrill
Hi

This one failed because pixman can't be built (again no gcc on this
machine):

Any ideas? Does this work for anyone?

+ cd rtems-tools-ca7b290f94a19238ed068aad229854cf67dee9b5
+ ./waf distclean configure '--prefix=/home/joel/rtems-cron-5/tools/5'
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x0008009e2000 (most recent call first):
Abort trap (core dumped)
shell cmd failed: /bin/sh -ex
 /usr/home/joel/rtems-cron-5/rtems-source-builder/
rtems/build/rtems-tools-ca7b290f94a19238ed068aad229854cf67dee9b5-1/do-build
error: building rtems-tools-ca7b290f94a19238ed068aad229854cf67dee9b5-1
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

BSP Bset failures on FreeBSD 12

2020-04-14 Thread Joel Sherrill
Hi

I uninstalled gcc from the FreeBSD 12 test machine and I guess things are a
bit better. But I see this in the bset failures:

+ cd rtems-tools-ca7b290f94a19238ed068aad229854cf67dee9b5
+ ./waf distclean configure '--prefix=/home/joel/rtems-cron-5/tools/5'
Fatal Python error: Py_Initialize: can't initialize sys standard streams
OSError: [Errno 9] Bad file descriptor

Current thread 0x0008009e2000 (most recent call first):
Abort trap (core dumped)
shell cmd failed: /bin/sh -ex
 /usr/home/joel/rtems-cron-5/rtems-source-builder/
rtems/build/rtems-tools-ca7b290f94a19238ed068aad229854cf67dee9b5-1/do-build
error: building rtems-tools-ca7b290f94a19238ed068aad229854cf67dee9b5-1

Any suggestions?

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

[PATCH rtems-docs v2] user/imx: Add i.MX6UL/ULL.

2020-04-14 Thread Christian Mauderer
Update #3869
---
 user/bsps/arm/imx.rst | 47 ---
 1 file changed, 44 insertions(+), 3 deletions(-)

diff --git a/user/bsps/arm/imx.rst b/user/bsps/arm/imx.rst
index bc93ae3..ee98f0b 100644
--- a/user/bsps/arm/imx.rst
+++ b/user/bsps/arm/imx.rst
@@ -7,9 +7,10 @@ imx (NXP i.MX)
 ==
 
 This BSP offers only one variant, the `imx7`.  This variant supports the i.MX
-7Dual processor.  The basic hardware initialization is not performed by the
-BSP.  A boot loader with device tree support must be used to start the BSP,
-e.g. U-Boot.
+7Dual processor and the i.MX 6UL/ULL processor family (with slightly different
+clock settings).  The basic hardware initialization is not performed by the 
BSP.
+A boot loader with device tree support must be used to start the BSP, e.g.
+U-Boot or barebox.
 
 Build Configuration Options
 ---
@@ -40,9 +41,30 @@ The following options are available at the configure command 
line.
 ``IMX_CCM_UART_HZ``
The UART clock frequency in Hz (default is 2400).
 
+``IMX_CCM_ECSPI_HZ``
+   The ECSPI clock frequency in Hz (default is 6750).
+
 ``IMX_CCM_AHB_HZ``
The AHB clock frequency in Hz (default is 13500).
 
+``IMX_CCM_SDHCI_HZ``
+   The SDHCI clock frequency in Hz (default is 196363000).
+
+Clock settings for different boards
+---
+
+The default clock settings are targeted for an i.MX 7Dual evaluation board 
using
+U-Boot. Some other boards with different boot loaders need different settings:
+
+ * Phytec phyCORE-i.MX 6ULL (system on module) with MCIMX6Y2CVM08AB and a
+   barebox bootloader (version ``2019.01.0-bsp-yocto-i.mx6ul-pd19.1.0``):
+
+   * IMX_CCM_IPG_HZ=6600
+   * IMX_CCM_UART_HZ=8000
+   * IMX_CCM_AHB_HZ=6600
+   * IMX_CCM_SDHCI_HZ=19800
+   * IMX_CCM_ECSPI_HZ=6000
+
 Boot via U-Boot
 ---
 
@@ -65,6 +87,14 @@ The ``loadfdt`` command may be not defined in your U-Boot 
environment.  Just
 replace it with the appropriate commands to load the device tree at
 ``${fdt_addr}``.
 
+Boot via barebox
+
+
+The same command like for U-Boot can be used to generate an application image.
+In a default configuration barebox expects an fdt image called `oftree` and a
+kernel image called `zImage` in the root folder of the bootable medium (e.g. an
+SD card).
+
 Clock Driver
 
 
@@ -133,6 +163,17 @@ system controls:
 A value of zero for the time or count disables the interrupt coalescing in the
 corresponding direction.
 
+On the Phytec phyCORE-i.MX 6ULL modules the PHY needs an initialization for the
+clock. A special PHY driver handles that (``ksz8091rnb``). Add it to your 
libbsd
+config like that:
+
+.. code-block:: c
+
+#define RTEMS_BSD_CONFIG_BSP_CONFIG
+#define RTEMS_BSD_CONFIG_INIT
+SYSINIT_DRIVER_REFERENCE(ksz8091rnb, miibus);
+#include 
+
 MMC/SDCard Driver
 -
 
-- 
2.16.4

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


[PATCH rtems-libbsd v2 01/14] usb_busdma: Add USB_NEED_BUSDMA_COHERENT_ALLOC

2020-04-14 Thread Christian Mauderer
From: Sebastian Huber 

Some BSPs have a cache-coherent memory area, however, it should not be
used for the USB controller.
---
 freebsd/sys/dev/usb/usb_busdma.c   | 4 
 rtemsbsd/include/rtems/bsd/local/opt_usb.h | 5 +
 2 files changed, 9 insertions(+)

diff --git a/freebsd/sys/dev/usb/usb_busdma.c b/freebsd/sys/dev/usb/usb_busdma.c
index 9a70c687..dc52fe15 100644
--- a/freebsd/sys/dev/usb/usb_busdma.c
+++ b/freebsd/sys/dev/usb/usb_busdma.c
@@ -584,7 +584,11 @@ usb_pc_alloc_mem(struct usb_page_cache *pc, struct 
usb_page *pg,
}
/* allocate memory */
if (bus_dmamem_alloc(
+#if !defined(__rtems__) || USB_NEED_BUSDMA_COHERENT_ALLOC
utag->tag, , (BUS_DMA_WAITOK | BUS_DMA_COHERENT), )) {
+#else /* __rtems__ */
+   utag->tag, , BUS_DMA_WAITOK, )) {
+#endif /* __rtems__ */
goto error;
}
/* setup page cache */
diff --git a/rtemsbsd/include/rtems/bsd/local/opt_usb.h 
b/rtemsbsd/include/rtems/bsd/local/opt_usb.h
index 809a969f..9f654863 100644
--- a/rtemsbsd/include/rtems/bsd/local/opt_usb.h
+++ b/rtemsbsd/include/rtems/bsd/local/opt_usb.h
@@ -1,4 +1,5 @@
 #include 
+#include 
 
 #define USB_HAVE_CONDVAR 1
 
@@ -6,6 +7,10 @@
 
 #define USB_HAVE_BUSDMA 1
 
+#if !defined(LIBBSP_ARM_IMX_BSP_H) && !defined(LIBBSP_ARM_STM32H7_BSP_H)
+#define USB_NEED_BUSDMA_COHERENT_ALLOC 1
+#endif
+
 #define USB_HAVE_COMPAT_LINUX 0
 
 #define USB_HAVE_USER_IO 0
-- 
2.16.4

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


[PATCH rtems-libbsd v2 05/14] imx gpio port

2020-04-14 Thread Christian Mauderer
From: Sebastian Huber 

Update #3869.
---
 freebsd/sys/arm/freescale/imx/imx_gpio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/freebsd/sys/arm/freescale/imx/imx_gpio.c 
b/freebsd/sys/arm/freescale/imx/imx_gpio.c
index f5b476d7..7dd49e3f 100644
--- a/freebsd/sys/arm/freescale/imx/imx_gpio.c
+++ b/freebsd/sys/arm/freescale/imx/imx_gpio.c
@@ -125,6 +125,7 @@ struct imx51_gpio_softc {
 
 static struct ofw_compat_data compat_data[] = {
 #ifdef __rtems__
+   {"fsl,imx35-gpio",  1},
{"fsl,imx7d-gpio",  1},
 #endif /* __rtems__ */
{"fsl,imx6q-gpio",  1},
-- 
2.16.4

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


[PATCH rtems-libbsd v2 11/14] ehci_imx: Port to RTEMS

2020-04-14 Thread Christian Mauderer
Update #3869.
---
 freebsd/sys/arm/freescale/imx/imx6_usbphy.c | 11 +++
 freebsd/sys/dev/usb/controller/ehci_imx.c   | 12 
 2 files changed, 23 insertions(+)

diff --git a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c 
b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
index 8f47507b..ad545601 100644
--- a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
+++ b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
@@ -91,6 +91,17 @@ usbphy_detach(device_t dev)
return (0);
 }
 
+#ifdef __rtems__
+#define BUS_SPACE_PHYSADDR(res, offs) \
+   ((u_int)(rman_get_start(res)+(offs)))
+
+void
+imx6_anatop_write_4(bus_size_t offset, uint32_t value)
+{
+
+   bus_space_write_4(0, 0x20c8000, offset, value);
+}
+#endif /* __rtems__ */
 static int
 usbphy_attach(device_t dev)
 {
diff --git a/freebsd/sys/dev/usb/controller/ehci_imx.c 
b/freebsd/sys/dev/usb/controller/ehci_imx.c
index a872fb62..d158df1d 100644
--- a/freebsd/sys/dev/usb/controller/ehci_imx.c
+++ b/freebsd/sys/dev/usb/controller/ehci_imx.c
@@ -303,6 +303,16 @@ imx_ehci_probe(device_t dev)
return (ENXIO);
 
if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) {
+#ifdef __rtems__
+   char dr_mode[24];
+
+   if (OF_getprop(ofw_bus_get_node(dev), "dr_mode",
+   _mode, sizeof(dr_mode)) > 0 &&
+   strcasecmp(dr_mode, "host") != 0) {
+   return (ENXIO);
+   }
+#endif /* __rtems__ */
+
device_set_desc(dev, "Freescale i.MX integrated USB 
controller");
return (BUS_PROBE_DEFAULT);
}
@@ -437,8 +447,10 @@ imx_ehci_attach(device_t dev)
goto out;
}
 
+#ifndef __rtems__
/* Turn on clocks. */
imx_ccm_usb_enable(dev);
+#endif /* __rtems__ */
 
/* Disable overcurrent detection, if configured to do so. */
if (OF_hasprop(ofw_bus_get_node(sc->dev), "disable-over-current"))
-- 
2.16.4

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


[PATCH rtems-libbsd v2 04/14] imx6_ccm: Add and build module.

2020-04-14 Thread Christian Mauderer
Update #3869.
---
 buildset/default.ini |  1 +
 libbsd.py| 23 +++
 rtemsbsd/include/bsp/nexus-devices.h |  2 ++
 3 files changed, 26 insertions(+)

diff --git a/buildset/default.ini b/buildset/default.ini
index 43ea82a3..ac8c9c48 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -40,6 +40,7 @@ dhcpcd = on
 dpaa = on
 evdev = on
 fdt = on
+imx = on
 in_cksum = on
 mdnsresponder = on
 mmc = on
diff --git a/libbsd.py b/libbsd.py
index d791efe4..e0690601 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5010,6 +5010,28 @@ class dpaa(builder.Module):
 mm.generator['source']()
 )
 
+class imx(builder.Module):
+def __init__(self, manager):
+super(imx, self).__init__(manager, type(self).__name__)
+
+def generate(self):
+mm = self.manager
+self.addKernelSpaceHeaderFiles(
+[
+'sys/arm/freescale/imx/imx6_anatopreg.h',
+'sys/arm/freescale/imx/imx6_anatopvar.h',
+'sys/arm/freescale/imx/imx6_ccmreg.h',
+'sys/arm/freescale/imx/imx6_machdep.h',
+'sys/arm/freescale/imx/imx_machdep.h',
+]
+)
+self.addKernelSpaceSourceFiles(
+[
+'sys/arm/freescale/imx/imx6_ccm.c',
+],
+mm.generator['source']()
+)
+
 #
 # Tests
 #
@@ -5166,6 +5188,7 @@ def load(mm):
 mm.addModule(dev_nic_broadcomm(mm))
 
 mm.addModule(nvme(mm))
+mm.addModule(imx(mm))
 
 # Add in_chksum
 mm.addModule(in_cksum(mm))
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index a916c664..92665409 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -127,6 +127,8 @@ RTEMS_BSD_DRIVER_MMC;
 RTEMS_BSD_DEFINE_NEXUS_DEVICE(ofwbus, 0, 0, NULL);
 SYSINIT_DRIVER_REFERENCE(simplebus, ofwbus);
 
+SYSINIT_DRIVER_REFERENCE(ccm, simplebus);
+
 SYSINIT_DRIVER_REFERENCE(ffec, simplebus);
 SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 
-- 
2.16.4

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


[PATCH rtems-libbsd v2 09/14] bus-dma, imx: Don't sync nocache area.

2020-04-14 Thread Christian Mauderer
This area doesn't support all cache operations.

Update #3869.
---
 rtemsbsd/rtems/rtems-kernel-bus-dma.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/rtemsbsd/rtems/rtems-kernel-bus-dma.c 
b/rtemsbsd/rtems/rtems-kernel-bus-dma.c
index 8c15e92b..8674bef1 100644
--- a/rtemsbsd/rtems/rtems-kernel-bus-dma.c
+++ b/rtemsbsd/rtems/rtems-kernel-bus-dma.c
@@ -48,6 +48,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
@@ -396,6 +398,11 @@ bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_t map, 
bus_dmasync_op_t op)
uintptr_t size = map->buffer_size;
uintptr_t begin = (uintptr_t) map->buffer_begin;
uintptr_t end = begin + size;
+#if defined(LIBBSP_ARM_IMX_BSP_H)
+   if (begin >= bsp_section_nocache_begin && end <= 
bsp_section_nocachenoload_end) {
+   return;
+   }
+#endif
 
if ((op & BUS_DMASYNC_PREWRITE) != 0 && (op & BUS_DMASYNC_PREREAD) == 
0) {
rtems_cache_flush_multiple_data_lines((void *) begin, size);
-- 
2.16.4

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


[PATCH rtems-libbsd v2 08/14] Add support for i.mx cache.

2020-04-14 Thread Christian Mauderer
Update #3869.
---
 rtemsbsd/include/machine/rtems-bsd-cache.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtemsbsd/include/machine/rtems-bsd-cache.h 
b/rtemsbsd/include/machine/rtems-bsd-cache.h
index bd496f9d..73b55e25 100755
--- a/rtemsbsd/include/machine/rtems-bsd-cache.h
+++ b/rtemsbsd/include/machine/rtems-bsd-cache.h
@@ -45,7 +45,7 @@
 #if defined(LIBBSP_ARM_LPC24XX_BSP_H) || (defined(LIBBSP_ARM_LPC32XX_BSP_H) && 
defined(LPC32XX_DISABLE_MMU))
   /* No cache */
 #elif defined(LIBBSP_ARM_ALTERA_CYCLONE_V_BSP_H) || \
-  defined(LIBBSP_ARM_XILINX_ZYNQ_BSP_H) || (defined(LIBBSP_ARM_LPC32XX_BSP_H) 
&& !defined(LPC32XX_DISABLE_MMU))
+  defined(LIBBSP_ARM_XILINX_ZYNQ_BSP_H) || (defined(LIBBSP_ARM_LPC32XX_BSP_H) 
&& !defined(LPC32XX_DISABLE_MMU)) || defined(LIBBSP_ARM_IMX_BSP_H)
   /* With cache, no coherency support in hardware */
   #define CPU_DATA_CACHE_ALIGNMENT 32
 #elif defined(__GEN83xx_BSP_h)
-- 
2.16.4

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


[PATCH rtems-libbsd v2 03/14] imx6_ccm: Port to RTEMS

2020-04-14 Thread Christian Mauderer
From: Sebastian Huber 

Update #3869.
---
 freebsd/sys/arm/freescale/imx/imx6_ccm.c | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/freebsd/sys/arm/freescale/imx/imx6_ccm.c 
b/freebsd/sys/arm/freescale/imx/imx6_ccm.c
index 2993f1d6..cef79933 100644
--- a/freebsd/sys/arm/freescale/imx/imx6_ccm.c
+++ b/freebsd/sys/arm/freescale/imx/imx6_ccm.c
@@ -92,6 +92,7 @@ WR4(struct ccm_softc *sc, bus_size_t off, uint32_t val)
 static void
 ccm_init_gates(struct ccm_softc *sc)
 {
+#ifndef __rtems__
uint32_t reg;
 
/* ahpbdma, aipstz 1 & 2 buses */
@@ -129,6 +130,7 @@ ccm_init_gates(struct ccm_softc *sc)
reg = CCGR6_USBOH3 | CCGR6_USDHC1 | CCGR6_USDHC2 |
CCGR6_USDHC3 | CCGR6_USDHC4;
WR4(sc, CCM_CCGR6, reg);
+#endif /* __rtems__ */
 }
 
 static int
@@ -204,7 +206,12 @@ ccm_probe(device_t dev)
if (!ofw_bus_status_okay(dev))
return (ENXIO);
 
+#ifndef __rtems__
 if (ofw_bus_is_compatible(dev, "fsl,imx6q-ccm") == 0)
+#else /* __rtems__ */
+if (ofw_bus_is_compatible(dev, "fsl,imx6q-ccm") == 0 &&
+   ofw_bus_is_compatible(dev, "fsl,imx6ul-ccm") == 0)
+#endif /* __rtems__ */
return (ENXIO);
 
device_set_desc(dev, "Freescale i.MX6 Clock Control Module");
-- 
2.16.4

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


[PATCH rtems-libbsd v2 06/14] regulator: Import from FreeBSD.

2020-04-14 Thread Christian Mauderer
Update #3869.
---
 freebsd/sys/dev/extres/regulator/regulator.c   | 1321 
 freebsd/sys/dev/extres/regulator/regulator.h   |  156 +++
 freebsd/sys/dev/extres/regulator/regulator_bus.c   |   89 ++
 freebsd/sys/dev/extres/regulator/regulator_fixed.c |  502 
 freebsd/sys/dev/extres/regulator/regulator_fixed.h |   44 +
 freebsd/sys/dev/gpio/gpioregulator.c   |  350 ++
 6 files changed, 2462 insertions(+)
 create mode 100644 freebsd/sys/dev/extres/regulator/regulator.c
 create mode 100644 freebsd/sys/dev/extres/regulator/regulator.h
 create mode 100644 freebsd/sys/dev/extres/regulator/regulator_bus.c
 create mode 100644 freebsd/sys/dev/extres/regulator/regulator_fixed.c
 create mode 100644 freebsd/sys/dev/extres/regulator/regulator_fixed.h
 create mode 100644 freebsd/sys/dev/gpio/gpioregulator.c

diff --git a/freebsd/sys/dev/extres/regulator/regulator.c 
b/freebsd/sys/dev/extres/regulator/regulator.c
new file mode 100644
index ..4ad6e94a
--- /dev/null
+++ b/freebsd/sys/dev/extres/regulator/regulator.c
@@ -0,0 +1,1321 @@
+#include 
+
+/*-
+ * Copyright 2016 Michal Meloun 
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef FDT
+#include 
+#include 
+#include 
+#endif
+#include 
+
+#include 
+
+SYSCTL_NODE(_hw, OID_AUTO, regulator, CTLFLAG_RD, NULL, "Regulators");
+
+MALLOC_DEFINE(M_REGULATOR, "regulator", "Regulator framework");
+
+#defineDIV_ROUND_UP(n,d) howmany(n, d)
+
+/* Forward declarations. */
+struct regulator;
+struct regnode;
+
+typedef TAILQ_HEAD(regnode_list, regnode) regnode_list_t;
+typedef TAILQ_HEAD(regulator_list, regulator) regulator_list_t;
+
+/* Default regulator methods. */
+static int regnode_method_init(struct regnode *regnode);
+static int regnode_method_enable(struct regnode *regnode, bool enable,
+int *udelay);
+static int regnode_method_status(struct regnode *regnode, int *status);
+static int regnode_method_set_voltage(struct regnode *regnode, int min_uvolt,
+int max_uvolt, int *udelay);
+static int regnode_method_get_voltage(struct regnode *regnode, int *uvolt);
+static void regulator_constraint(void *dummy);
+static void regulator_shutdown(void *dummy);
+
+/*
+ * Regulator controller methods.
+ */
+static regnode_method_t regnode_methods[] = {
+   REGNODEMETHOD(regnode_init, regnode_method_init),
+   REGNODEMETHOD(regnode_enable,   regnode_method_enable),
+   REGNODEMETHOD(regnode_status,   regnode_method_status),
+   REGNODEMETHOD(regnode_set_voltage,  regnode_method_set_voltage),
+   REGNODEMETHOD(regnode_get_voltage,  regnode_method_get_voltage),
+   REGNODEMETHOD(regnode_check_voltage,regnode_method_check_voltage),
+
+   REGNODEMETHOD_END
+};
+DEFINE_CLASS_0(regnode, regnode_class, regnode_methods, 0);
+
+/*
+ * Regulator node - basic element for modelling SOC and bard power supply
+ * chains. Its contains producer data.
+ */
+struct regnode {
+   KOBJ_FIELDS;
+
+   TAILQ_ENTRY(regnode)reglist_link;   /* Global list entry */
+   regulator_list_tconsumers_list; /* Consumers list */
+
+   /* Cache for already resolved names */
+   struct regnode  *parent;/* Resolved parent */
+
+   /* Details of this device. */
+   const char  *name;  /* Globally unique name */
+   const char  *parent_name;   /* Parent name */
+
+   device_tpdev;   /* Producer device_t */
+  

[PATCH rtems-libbsd v2 10/14] ehci_imx: Import from FreeBSD

2020-04-14 Thread Christian Mauderer
From: Sebastian Huber 

Update #3869.
---
 freebsd/sys/arm/freescale/imx/imx6_usbphy.c | 212 
 freebsd/sys/dev/usb/controller/ehci_imx.c   | 516 
 2 files changed, 728 insertions(+)
 create mode 100644 freebsd/sys/arm/freescale/imx/imx6_usbphy.c
 create mode 100644 freebsd/sys/dev/usb/controller/ehci_imx.c

diff --git a/freebsd/sys/arm/freescale/imx/imx6_usbphy.c 
b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
new file mode 100644
index ..8f47507b
--- /dev/null
+++ b/freebsd/sys/arm/freescale/imx/imx6_usbphy.c
@@ -0,0 +1,212 @@
+#include 
+
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2013 Ian Lepore 
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+/*
+ * USBPHY driver for Freescale i.MX6 family of SoCs.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+/*
+ * Hardware register defines.
+ */
+#definePWD_REG 0x
+#defineCTRL_STATUS_REG 0x0030
+#defineCTRL_SET_REG0x0034
+#defineCTRL_CLR_REG0x0038
+#defineCTRL_TOGGLE_REG 0x003c
+#define  CTRL_SFTRST (1U << 31)
+#define  CTRL_CLKGATE(1 << 30)
+#define  CTRL_ENUTMILEVEL3   (1 << 15)
+#define  CTRL_ENUTMILEVEL2   (1 << 14)
+
+struct usbphy_softc {
+   device_tdev;
+   struct resource *mem_res;
+   u_int   phy_num;
+};
+
+static struct ofw_compat_data compat_data[] = {
+   {"fsl,imx6q-usbphy",true},
+   {"fsl,imx6ul-usbphy",   true},
+   {NULL,  false}
+};
+
+static int
+usbphy_detach(device_t dev)
+{
+   struct usbphy_softc *sc;
+
+   sc = device_get_softc(dev);
+
+   if (sc->mem_res != NULL)
+   bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res);
+
+   return (0);
+}
+
+static int
+usbphy_attach(device_t dev)
+{
+   struct usbphy_softc *sc;
+   int err, regoff, rid;
+
+   sc = device_get_softc(dev);
+   err = 0;
+
+   /* Allocate bus_space resources. */
+   rid = 0;
+   sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, ,
+   RF_ACTIVE);
+   if (sc->mem_res == NULL) {
+   device_printf(dev, "Cannot allocate memory resources\n");
+   err = ENXIO;
+   goto out;
+   }
+
+   /*
+* XXX Totally lame way to get the unit number (but not quite as lame as
+* adding an ad-hoc property to the fdt data).  This works as long as
+* this driver is used for imx6 only.
+*/
+   const uint32_t PWD_PHY1_REG_PHYSADDR = 0x020c9000;
+   if (BUS_SPACE_PHYSADDR(sc->mem_res, 0) == PWD_PHY1_REG_PHYSADDR) {
+   sc->phy_num = 0;
+   regoff = 0;
+   } else {
+   sc->phy_num = 1;
+   regoff = 0x60;
+   }
+
+   /*
+* Based on a note in the u-boot source code, disable charger detection
+* to avoid degrading the differential signaling on the DP line.  Note
+* that this disables (by design) both charger detection and contact
+* detection, because of the screwball mix of active-high and active-low
+* bits in this register.
+*/
+   imx6_anatop_write_4(IMX6_ANALOG_USB1_CHRG_DETECT + regoff, 
+   IMX6_ANALOG_USB_CHRG_DETECT_N_ENABLE | 
+   IMX6_ANALOG_USB_CHRG_DETECT_N_CHK_CHRG);
+
+   

[PATCH rtems-libbsd v2 07/14] regulator: Add to build.

2020-04-14 Thread Christian Mauderer
Update #3869.
---
 Makefile.todo |  26 ++
 buildset/default.ini  |   1 +
 libbsd.py |  30 +++
 rtemsbsd/include/bsp/nexus-devices.h  |   3 +
 rtemsbsd/include/rtems/bsd/local/regdev_if.h  |  36 
 rtemsbsd/include/rtems/bsd/local/regnode_if.h | 121 ++
 rtemsbsd/local/regdev_if.c|  27 ++
 rtemsbsd/local/regnode_if.c   |  56 
 8 files changed, 300 insertions(+)
 create mode 100644 rtemsbsd/include/rtems/bsd/local/regdev_if.h
 create mode 100644 rtemsbsd/include/rtems/bsd/local/regnode_if.h
 create mode 100644 rtemsbsd/local/regdev_if.c
 create mode 100644 rtemsbsd/local/regnode_if.c

diff --git a/Makefile.todo b/Makefile.todo
index 59e630e1..a05716ef 100644
--- a/Makefile.todo
+++ b/Makefile.todo
@@ -45,6 +45,10 @@ GENERATED += $(LOCAL_INC)/sdhci_if.h
 GENERATED += $(LOCAL_SRC)/sdhci_if.c
 GENERATED += $(LOCAL_INC)/gpiobus_if.h
 GENERATED += $(LOCAL_SRC)/gpiobus_if.c
+GENERATED += $(LOCAL_INC)/regdev_if.h
+GENERATED += $(LOCAL_SRC)/regdev_if.c
+GENERATED += $(LOCAL_INC)/regnode_if.h
+GENERATED += $(LOCAL_SRC)/regnode_if.c
 GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
 GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
 GENERATED += freebsd/contrib/libpcap/pcap_version.h
@@ -231,6 +235,28 @@ $(LOCAL_SRC)/gpio_if.c: 
$(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
awk -f $(TOOLS)/makeobjops.awk $< -c
mv gpio_if.c $@
 
+$(LOCAL_INC)/regnode_if.h: $(FREEBSD_SRC)/sys/dev/extres/regulator/regnode_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -h
+   mv regnode_if.h $@
+
+$(LOCAL_SRC)/regnode_if.c: $(FREEBSD_SRC)/sys/dev/extres/regulator/regnode_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -c
+   sed -i regnode_if.c \
+   -e '1 i\#include \n' \
+   -e 's|#include "regnode_if.h"|#include 
|'
+   mv regnode_if.c $@
+
+$(LOCAL_INC)/regdev_if.h: $(FREEBSD_SRC)/sys/dev/extres/regulator/regdev_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -h
+   mv regdev_if.h $@
+
+$(LOCAL_SRC)/regdev_if.c: $(FREEBSD_SRC)/sys/dev/extres/regulator/regdev_if.m
+   awk -f $(TOOLS)/makeobjops.awk $< -c
+   sed -i regdev_if.c \
+   -e '1 i\#include \n' \
+   -e 's|#include "regdev_if.h"|#include 
|'
+   mv regdev_if.c $@
+
 $(LOCAL_SRC)/rtwn-rtl8192cfwT.c: 
$(FREEBSD_SRC)/sys/contrib/dev/rtwn/rtwn-rtl8192cfwT.fw.uu
uudecode -o /dev/stdout $< | python firmware-gen.py \
-l "$(FREEBSD_SRC)/sys/contrib/dev/rtwn/LICENSE" \
diff --git a/buildset/default.ini b/buildset/default.ini
index ac8c9c48..b17f2b59 100644
--- a/buildset/default.ini
+++ b/buildset/default.ini
@@ -54,6 +54,7 @@ nvme = on
 opencrypto = on
 pci = on
 pf = on
+regulator = on
 rtems = on
 tests = on
 tty = on
diff --git a/libbsd.py b/libbsd.py
index e0690601..4f8fb4d2 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5032,6 +5032,35 @@ class imx(builder.Module):
 mm.generator['source']()
 )
 
+class regulator(builder.Module):
+def __init__(self, manager):
+super(regulator, self).__init__(manager, type(self).__name__)
+
+def generate(self):
+mm = self.manager
+self.addRTEMSSourceFiles(
+[
+'local/regdev_if.c',
+'local/regnode_if.c',
+],
+mm.generator['source']()
+)
+self.addKernelSpaceHeaderFiles(
+[
+'sys/dev/extres/regulator/regulator.h',
+'sys/dev/extres/regulator/regulator_fixed.h',
+]
+)
+self.addKernelSpaceSourceFiles(
+[
+'sys/dev/extres/regulator/regulator.c',
+'sys/dev/extres/regulator/regulator_bus.c',
+'sys/dev/extres/regulator/regulator_fixed.c',
+'sys/dev/gpio/gpioregulator.c',
+],
+mm.generator['source']()
+)
+
 #
 # Tests
 #
@@ -5189,6 +5218,7 @@ def load(mm):
 
 mm.addModule(nvme(mm))
 mm.addModule(imx(mm))
+mm.addModule(regulator(mm))
 
 # Add in_chksum
 mm.addModule(in_cksum(mm))
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 92665409..0a210bd9 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -136,6 +136,9 @@ SYSINIT_DRIVER_REFERENCE(imx51_gpio, simplebus);
 SYSINIT_DRIVER_REFERENCE(sdhci_fsl, simplebus);
 RTEMS_BSD_DRIVER_MMC;
 
+SYSINIT_DRIVER_REFERENCE(ofw_regulator_bus, simplebus);
+SYSINIT_DRIVER_REFERENCE(gpioregulator, simplebus);
+
 #elif defined(LIBBSP_ARM_LPC24XX_BSP_H)
 
 RTEMS_BSD_DEFINE_NEXUS_DEVICE(ohci, 0, 0, NULL);
diff --git a/rtemsbsd/include/rtems/bsd/local/regdev_if.h 
b/rtemsbsd/include/rtems/bsd/local/regdev_if.h
new file mode 100644
index ..4a75810f
--- /dev/null
+++ b/rtemsbsd/include/rtems/bsd/local/regdev_if.h
@@ -0,0 +1,36 

[PATCH rtems-libbsd v2 13/14] ehci_imx: Set/clear ENHOSTDISCONNECT in USB PHY.

2020-04-14 Thread Christian Mauderer
This is not a nice solution but it should work on all chips. As soon as
FreeBSD has a nice solution via the USB PHY driver, this should be
replaced.

Update #3869.
---
 freebsd/sys/dev/usb/controller/ehci_imx.c | 59 +++
 1 file changed, 59 insertions(+)

diff --git a/freebsd/sys/dev/usb/controller/ehci_imx.c 
b/freebsd/sys/dev/usb/controller/ehci_imx.c
index d158df1d..544a63b5 100644
--- a/freebsd/sys/dev/usb/controller/ehci_imx.c
+++ b/freebsd/sys/dev/usb/controller/ehci_imx.c
@@ -50,6 +50,9 @@ __FBSDID("$FreeBSD$");
 
 #include 
 #include 
+#ifdef __rtems__
+#include 
+#endif /* __rtems__ */
 
 #include 
 #include 
@@ -270,6 +273,9 @@ struct imx_ehci_softc {
device_tdev;
struct resource *ehci_mem_res;  /* EHCI core regs. */
struct resource *ehci_irq_res;  /* EHCI core IRQ. */ 
+#ifdef __rtems__
+   void*phy_regs;
+#endif /* __rtems__ */
 };
 
 static struct ofw_compat_data compat_data[] = {
@@ -380,6 +386,32 @@ imx_ehci_disable_oc(struct imx_ehci_softc *sc)
index = usbmprops[1];
imx_usbmisc_set_ctrl(usbmdev, index, USBNC_OVER_CUR_DIS);
 }
+#ifdef __rtems__
+#define BUS_SPACE_PHYSADDR(res, offs) \
+   ((u_int)(rman_get_start(res)+(offs)))
+
+static uint16_t
+imx_ehci_get_port_speed_portsc(struct ehci_softc *sc, uint16_t index)
+{
+   uint32_t v;
+   struct imx_ehci_softc *isc = (struct imx_ehci_softc *)sc;
+
+   v = ehci_get_port_speed_portsc(sc, index);
+
+   /* Set/clear ENHOSTDISCONDETECT in USBPHY CTRL register */
+   /* FIXME: This is a very hacky method. It should be done by the phy
+* driver instead. */
+   volatile uint32_t *ctrl_set = isc->phy_regs + 0x34;
+   volatile uint32_t *ctrl_clr = isc->phy_regs + 0x38;
+   if (v == UPS_HIGH_SPEED) {
+   *ctrl_set = 0x2;
+   } else {
+   *ctrl_clr = 0x2;
+   }
+
+   return (v);
+}
+#endif /* __rtems__ */
 
 static int
 imx_ehci_attach(device_t dev)
@@ -474,6 +506,33 @@ imx_ehci_attach(device_t dev)
esc->sc_flags |= EHCI_SCFLG_NORESTERM | EHCI_SCFLG_TT;
esc->sc_vendor_post_reset = imx_ehci_post_reset;
esc->sc_vendor_get_port_speed = ehci_get_port_speed_portsc;
+#ifdef __rtems__
+   /*
+* FIXME: This is a big hack to get the PHY regs and set one bit during
+* changes of the port speed.
+*/
+   sc->phy_regs = 0;
+   if (OF_hasprop(ofw_bus_get_node(sc->dev), "fsl,usbphy")) {
+   phandle_t *cells;
+   int len;
+   phandle_t phynode;
+
+   cells = NULL;
+   len = OF_getencprop_alloc_multi(ofw_bus_get_node(sc->dev),
+   "fsl,usbphy", sizeof(*cells), (void **));
+   if (len > 0
+   && (phynode = OF_node_from_xref(cells[0])) != -1 &&
+   ofw_bus_node_is_compatible(phynode, "fsl,imx6ul-usbphy")) {
+   u_long base, size;
+   if (fdt_regsize(phynode, , ) == 0) {
+   sc->phy_regs = (void*)base;
+   esc->sc_vendor_get_port_speed =
+   imx_ehci_get_port_speed_portsc;
+   }
+   }
+   OF_prop_free(cells);
+   }
+#endif /* __rtems__ */
 
err = ehci_init(esc);
if (err != 0) {
-- 
2.16.4

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


[PATCH rtems-libbsd v2 02/14] imx6_ccm: Import from FreeBSD

2020-04-14 Thread Christian Mauderer
From: Sebastian Huber 

Update #3869.
---
 freebsd/sys/arm/freescale/imx/imx6_anatopreg.h | 193 ++
 freebsd/sys/arm/freescale/imx/imx6_anatopvar.h |  49 +++
 freebsd/sys/arm/freescale/imx/imx6_ccm.c   | 468 +
 freebsd/sys/arm/freescale/imx/imx6_ccmreg.h| 149 
 freebsd/sys/arm/freescale/imx/imx6_machdep.h   |  38 ++
 freebsd/sys/arm/freescale/imx/imx_machdep.h|  72 
 6 files changed, 969 insertions(+)
 create mode 100644 freebsd/sys/arm/freescale/imx/imx6_anatopreg.h
 create mode 100644 freebsd/sys/arm/freescale/imx/imx6_anatopvar.h
 create mode 100644 freebsd/sys/arm/freescale/imx/imx6_ccm.c
 create mode 100644 freebsd/sys/arm/freescale/imx/imx6_ccmreg.h
 create mode 100644 freebsd/sys/arm/freescale/imx/imx6_machdep.h
 create mode 100644 freebsd/sys/arm/freescale/imx/imx_machdep.h

diff --git a/freebsd/sys/arm/freescale/imx/imx6_anatopreg.h 
b/freebsd/sys/arm/freescale/imx/imx6_anatopreg.h
new file mode 100644
index ..e8269526
--- /dev/null
+++ b/freebsd/sys/arm/freescale/imx/imx6_anatopreg.h
@@ -0,0 +1,193 @@
+/*-
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 2013 Ian Lepore 
+ * All rights reserved.
+ *
+ * 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 AUTHOR 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 AUTHOR 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndefIMX6_ANATOPREG_H
+#defineIMX6_ANATOPREG_H
+
+#defineIMX6_ANALOG_CCM_PLL_ARM 0x000
+#defineIMX6_ANALOG_CCM_PLL_ARM_SET 0x004
+#defineIMX6_ANALOG_CCM_PLL_ARM_CLR 0x008
+#defineIMX6_ANALOG_CCM_PLL_ARM_TOG 0x00C
+#define  IMX6_ANALOG_CCM_PLL_ARM_DIV_MASK0x7F
+#define  IMX6_ANALOG_CCM_PLL_ARM_LOCK(1U << 31)
+#define  IMX6_ANALOG_CCM_PLL_ARM_BYPASS  (1 << 16)
+#define  IMX6_ANALOG_CCM_PLL_ARM_CLK_SRC_MASK(0x03 << 16)
+#defineIMX6_ANALOG_CCM_PLL_USB10x010
+#defineIMX6_ANALOG_CCM_PLL_USB1_SET0x014
+#defineIMX6_ANALOG_CCM_PLL_USB1_CLR0x018
+#defineIMX6_ANALOG_CCM_PLL_USB1_TOG0x01C
+#define   IMX6_ANALOG_CCM_PLL_USB_LOCK   (1U << 31)
+#define   IMX6_ANALOG_CCM_PLL_USB_BYPASS (1 << 16)
+#define   IMX6_ANALOG_CCM_PLL_USB_ENABLE (1 << 13)
+#define   IMX6_ANALOG_CCM_PLL_USB_POWER  (1 << 12)
+#define   IMX6_ANALOG_CCM_PLL_USB_EN_USB_CLKS(1 <<  6)
+#defineIMX6_ANALOG_CCM_PLL_USB20x020
+#defineIMX6_ANALOG_CCM_PLL_USB2_SET0x024
+#defineIMX6_ANALOG_CCM_PLL_USB2_CLR0x028
+#defineIMX6_ANALOG_CCM_PLL_USB2_TOG0x02C
+#defineIMX6_ANALOG_CCM_PLL_SYS 0x030
+#defineIMX6_ANALOG_CCM_PLL_SYS_SET 0x034
+#defineIMX6_ANALOG_CCM_PLL_SYS_CLR 0x038
+#defineIMX6_ANALOG_CCM_PLL_SYS_TOG 0x03C
+#defineIMX6_ANALOG_CCM_PLL_SYS_SS  0x040
+#defineIMX6_ANALOG_CCM_PLL_SYS_NUM 0x050
+#defineIMX6_ANALOG_CCM_PLL_SYS_DENOM   0x060
+#defineIMX6_ANALOG_CCM_PLL_AUDIO   0x070
+#define   IMX6_ANALOG_CCM_PLL_AUDIO_ENABLE   (1 << 13)
+#define   IMX6_ANALOG_CCM_PLL_AUDIO_DIV_SELECT_SHIFT 0
+#define   IMX6_ANALOG_CCM_PLL_AUDIO_DIV_SELECT_MASK  0x7f
+#defineIMX6_ANALOG_CCM_PLL_AUDIO_SET   0x074
+#define

[PATCH rtems-libbsd v2 12/14] ehci_imx: Add to build.

2020-04-14 Thread Christian Mauderer
---
 libbsd.py| 2 ++
 rtemsbsd/include/bsp/nexus-devices.h | 5 +
 2 files changed, 7 insertions(+)

diff --git a/libbsd.py b/libbsd.py
index 4f8fb4d2..ed6493b2 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5028,6 +5028,8 @@ class imx(builder.Module):
 self.addKernelSpaceSourceFiles(
 [
 'sys/arm/freescale/imx/imx6_ccm.c',
+'sys/arm/freescale/imx/imx6_usbphy.c',
+'sys/dev/usb/controller/ehci_imx.c',
 ],
 mm.generator['source']()
 )
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 0a210bd9..d2ceab8e 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -128,6 +128,11 @@ RTEMS_BSD_DEFINE_NEXUS_DEVICE(ofwbus, 0, 0, NULL);
 SYSINIT_DRIVER_REFERENCE(simplebus, ofwbus);
 
 SYSINIT_DRIVER_REFERENCE(ccm, simplebus);
+SYSINIT_DRIVER_REFERENCE(ehci, simplebus);
+SYSINIT_DRIVER_REFERENCE(usbphy, simplebus);
+SYSINIT_DRIVER_REFERENCE(usbus, ehci);
+RTEMS_BSD_DRIVER_USB;
+RTEMS_BSD_DRIVER_USB_MASS;
 
 SYSINIT_DRIVER_REFERENCE(ffec, simplebus);
 SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
-- 
2.16.4

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


[PATCHES v2] Add more i.MX6UL/ULL support

2020-04-14 Thread Christian Mauderer
Hello,

this patches are an update for

https://lists.rtems.org/pipermail/devel/2020-April/058863.html

The RTEMS and docs patch is rebased to the current master.

The libbsd patches are adapted to have the right order and include the
changes like discussed. This version is for the 5-freebsd-12 branch.
I'll adapt them for libbsd master and push them together as soon as I
have a go.

Best regards

Christian

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


[PATCH rtems v2] bsp/imx: Add an extra ecspi clock.

2020-04-14 Thread Christian Mauderer
Some imx chips or boards don't use the same frequency for ECSPI and IPG.

Update #3869
---
 bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h | 3 +++
 bsps/arm/imx/spi/imx-ecspi.c| 2 +-
 bsps/arm/imx/start/ccm.c| 5 +
 c/src/lib/libbsp/arm/imx/configure.ac   | 3 +++
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h 
b/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h
index 5633de6f50..0f19d80813 100644
--- a/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h
+++ b/bsps/arm/imx/include/arm/freescale/imx/imx_ccmvar.h
@@ -48,6 +48,9 @@ uint32_t imx_ccm_perclk_hz(void);
 uint32_t imx_ccm_sdhci_hz(void);
 uint32_t imx_ccm_uart_hz(void);
 uint32_t imx_ccm_ahb_hz(void);
+#ifdef __rtems__
+uint32_t imx_ccm_ecspi_hz(void);
+#endif /* __rtems__ */
 
 #ifndef __rtems__
 void imx_ccm_usb_enable(device_t _usbdev);
diff --git a/bsps/arm/imx/spi/imx-ecspi.c b/bsps/arm/imx/spi/imx-ecspi.c
index 4c4978cdac..a18047f2e0 100644
--- a/bsps/arm/imx/spi/imx-ecspi.c
+++ b/bsps/arm/imx/spi/imx-ecspi.c
@@ -435,7 +435,7 @@ int spi_bus_register_imx(const char *bus_path, const char 
*alias_or_path)
 return -1;
   }
 
-  bus->base.max_speed_hz = imx_ccm_ipg_hz();
+  bus->base.max_speed_hz = imx_ccm_ecspi_hz();
   bus->base.delay_usecs = 1;
   bus->regs = imx_get_reg_of_node(fdt, node);
   bus->irq = imx_get_irq_of_node(fdt, node, 0);
diff --git a/bsps/arm/imx/start/ccm.c b/bsps/arm/imx/start/ccm.c
index cc93dcbd5d..3487470357 100644
--- a/bsps/arm/imx/start/ccm.c
+++ b/bsps/arm/imx/start/ccm.c
@@ -27,6 +27,11 @@ uint32_t imx_ccm_uart_hz(void)
   return IMX_CCM_UART_HZ;
 }
 
+uint32_t imx_ccm_ecspi_hz(void)
+{
+  return IMX_CCM_ECSPI_HZ;
+}
+
 uint32_t imx_ccm_ahb_hz(void)
 {
   return IMX_CCM_AHB_HZ;
diff --git a/c/src/lib/libbsp/arm/imx/configure.ac 
b/c/src/lib/libbsp/arm/imx/configure.ac
index aa119b9236..fbb9d9278a 100644
--- a/c/src/lib/libbsp/arm/imx/configure.ac
+++ b/c/src/lib/libbsp/arm/imx/configure.ac
@@ -43,6 +43,9 @@ RTEMS_BSPOPTS_HELP([IMX_CCM_IPG_HZ],[IPG clock frequency in 
Hz])
 RTEMS_BSPOPTS_SET([IMX_CCM_UART_HZ],[*],[2400])
 RTEMS_BSPOPTS_HELP([IMX_CCM_UART_HZ],[UART clock frequency in Hz])
 
+RTEMS_BSPOPTS_SET([IMX_CCM_ECSPI_HZ],[*],[6750])
+RTEMS_BSPOPTS_HELP([IMX_CCM_ECSPI_HZ],[ECSPI clock frequency in Hz])
+
 RTEMS_BSPOPTS_SET([IMX_CCM_AHB_HZ],[*],[13500])
 RTEMS_BSPOPTS_HELP([IMX_CCM_AHB_HZ],[AHB clock frequency in Hz])
 
-- 
2.16.4

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


Re: [PATCH] Test for clock_nanosleep with CLOCK_MONOTONIC option.

2020-04-14 Thread Gedare Bloom
On Tue, Apr 14, 2020 at 6:05 AM Utkarsh Rai  wrote:
>
> This test checks for a simple 1 ns delay with clock_nanosleep with
> CLOCK_MONOTONIC.
> ---
>  testsuites/psxtests/Makefile.am   |  9 +++
>  testsuites/psxtests/configure.ac  |  1 +
>  .../psxtests/psxclocknanosleep01/init.c   | 81 +++
>  .../psxclocknanosleep01.doc   | 10 +++
>  .../psxclocknanosleep01.scn   |  3 +
>  5 files changed, 104 insertions(+)
>  create mode 100644 testsuites/psxtests/psxclocknanosleep01/init.c
>  create mode 100644 
> testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc
>  create mode 100644 
> testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn
>
> diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
> index 1f9e4233ec..e3918ae7a5 100755
> --- a/testsuites/psxtests/Makefile.am
> +++ b/testsuites/psxtests/Makefile.am
> @@ -321,6 +321,15 @@ psxclockrealtime01_CPPFLAGS = $(AM_CPPFLAGS) \
> $(TEST_FLAGS_psxclockrealtime01) $(support_includes)
>  endif
>
> +if TEST_psxclocknanosleep01
> +psx_tests += psxclocknanosleep01
> +psx_screens += psxclocknanosleep01/psxclocknanosleep01.scn
> +psx_docs += psxclocknanosleep01/psxclocknanosleep01.doc
> +psxclocknanosleep01_SOURCES = psxclocknanosleep01/init.c
> +psxclocknanosleep01_CPPFLAGS = $(AM_CPPFLAGS) \
> +   $(TEST_FLAGS_psxclocknanosleep01) $(support_includes)
> +endif
> +
>  if TEST_psxconcurrency01
>  psx_tests += psxconcurrency01
>  psx_screens += psxconcurrency01/psxconcurrency01.scn
> diff --git a/testsuites/psxtests/configure.ac 
> b/testsuites/psxtests/configure.ac
> index 139787cccb..9bfe8e2c0b 100644
> --- a/testsuites/psxtests/configure.ac
> +++ b/testsuites/psxtests/configure.ac
> @@ -75,6 +75,7 @@ RTEMS_TEST_CHECK([psxcleanup01])
>  RTEMS_TEST_CHECK([psxcleanup02])
>  RTEMS_TEST_CHECK([psxclock])
>  RTEMS_TEST_CHECK([psxclock01])
> +RTEMS_TEST_CHECK([psxclocknanosleep01])
>  RTEMS_TEST_CHECK([psxclockrealtime01])
>  RTEMS_TEST_CHECK([psxconcurrency01])
>  RTEMS_TEST_CHECK([psxcond01])
> diff --git a/testsuites/psxtests/psxclocknanosleep01/init.c 
> b/testsuites/psxtests/psxclocknanosleep01/init.c
> new file mode 100644
> index 00..462ee114f8
> --- /dev/null
> +++ b/testsuites/psxtests/psxclocknanosleep01/init.c
> @@ -0,0 +1,81 @@
> +/*
> + * SPDX-License-Identifier: BSD-2-Clause
> + *
> + * Copyright (C) 2020 Utkarsh Rai
> + *
> + * 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.
> + */
> +
> +#include
> +#include
> +#include
> +#include
add space after the CPP directive
#include 

> +
> +/*Forward declaration to avoid compiler warning*/
> +void clock_sleep(void);
> +
> +rtems_task Init(rtems_task_argument ignored);
> +
> +const char rtems_test_name[] = "PSXCLOCKNANOSLEEP 01";
> +
> +void clock_sleep(void)
> +{
> +  struct timespec delay_time;
> +  intstatus;
> +
> +  delay_time.tv_sec=0;
> +  delay_time.tv_nsec=1;
add spaces around operators

> +
> +  status=clock_nanosleep(CLOCK_MONOTONIC, 0, _time, (struct timespec* 
> )NULL);
add spaces within function parens, repeat below.
ex: clock_nanosleep( CLOCK_MONOTONIC, ..., NULL );

> +  rtems_test_assert(!status);
It is better to check the explicit value:
rtems_test_assert( status == 0 );

> +}
> +
> +rtems_task Init(rtems_task_argument ignored)
> +{
> +
> +  struct timespec init_time;
> +  struct timespec end_time;
> +  intstatus;
> +
> +  TEST_BEGIN();
> +
> +  status = clock_gettime(CLOCK_MONOTONIC, _time);
> +  rtems_test_assert(!status);
> +
> +  clock_sleep();
> +
> +  status = clock_gettime(CLOCK_MONOTONIC, _time);
> +  rtems_test_assert(!status);
> +
> +  

Re: Use weak functions in the RTEMS core?

2020-04-14 Thread Gedare Bloom
On Mon, Apr 13, 2020 at 11:48 PM Sebastian Huber
 wrote:
>
> On 09/04/2020 17:25, Gedare Bloom wrote:
>
> > On Wed, Apr 8, 2020 at 10:53 PM Sebastian Huber
> >  wrote:
> >> On 09/04/2020 03:32, Chris Johns wrote:
> >>
> >>> On 2020-04-09 03:43, Sebastian Huber wrote:
>  On 08/04/2020 19:34, Jonathan Brandmeyer wrote:
> > Instead of treating weak references as a single level of
> > indirection, I think you have to treat them as a single overridable
> > interface.  In a dynamically-linked application, we might try to
> > perform an override using the LD_PRELOAD feature. But in a
> > statically-linked application we have to do it differently.  The
> > overriding archive must be named in full, and it must be named as an
> > object to be linked instead of a library to be searched.
> > Furthermore, an interface can have only one override that ends up in
> > the linked application.
>  Yes, you can only have one strong implementation, otherwise you get
>  multiple definition errors.
> >>> I have only ever considered weak references as an overridable
> >>> interface within a user's application and not layered within RTEMS
> >>> itself. I am not sure about automatic indirection within an archive.
> >> Yes, this is one use case. You could use also a normal function in a
> >> separate file to get something similar.
> >>> In the case of different heap allocators why not have confdefs.h
> >>> select the one we want and manage the indirection with a const table
> >>> of pointers?
> >> Yes it can be done with new configuration options, however, this would
> >> be my least favorite choice. I created an example how I would like to
> >> use weak functions:
> >>
> >> https://lists.rtems.org/pipermail/devel/2020-April/059196.html
> >>
> > Thanks for the code example it was helpful to me. What I understood is that:
> > 1) An internal interface may be declared weakly aliased in RTEMS.
> Yes, in this example and the other things I have in mind with weak
> functions, the weak function implements an internal interface.
> > 2) Implementations each need to go to a different file.
> >  * Not clear to me if there can be more than 2: 1 weak, 1 strong?
> Exactly one strong implementation in librtemscpu.a and at least one weak
> implementation. If you have multiple weak implementations and no strong
> one is referenced, then the first weak implementation seen by the linker
> wins.
> > 3) A strong implementation may be pulled in by invoking a different,
> >  non-aliased function implemented in the same file as (one of) the
> >  strong implementations.
> Yes. In the example, the application references free() and this enables
> the full support for the deferred free.
> >
> > Am I understanding this? I tried to map this to something in OOP but
> > the abstraction failed somewhere in my cortex. It is almost like an
> > interface class where you can instantiate objects of only one of the
> > implementations.
> >
> > The weakly aliased interface proposal under consideration is NOT a
> > public API, at least so far. It is not yet clear to me how or whether
> > the approach can be used in conjunction with a weak public interface.
> I don't know a mapping to OOP. The weak functions are a bit special.
> >
> > I am a little concerned that the approach is fragile still, based on
> > the discussion about how weak aliases may be resolved dependent upon
> > link order in command lines, etc.
>
> The dose makes the poison. This stuff should be used with care and a
> clear purpose. The example with the deferred free doesn't depend on a
> link order.
>
> For me the question is if we want to use a feature which depends on the
> ELF format. I would say yes, since even if a future format doesn't
> support weak functions, then we can still use workaround based on global
> pointers and system initialization handlers.
>
I'm leaning in favor of this proposal for some very clear use cases.
It is an elegant way to handle the problem of customizable
implementations to specialize some features. Maybe let's try out the
approach with the heap management in rtems6 without modifying the user
APIs.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: RTEMS Timeline Update and 25th Anniversary of First Public Commit

2020-04-14 Thread Joel Sherrill
On Tue, Apr 14, 2020 at 1:47 AM Christian Mauderer <
christian.maude...@embedded-brains.de> wrote:

> Hello Joel,
>
> On 07/04/2020 22:44, Joel Sherrill wrote:
> > Hi
> >
> > The RTEMS Project is rapidly approaching a major milestone -- the 25th
> > anniversary of the oldest commit in the git repository! That occurs on 4
> > May 2020!
> >
> > Before that time, the source code was managed on an internal research
> > project repository and snapshots/releases made available via ftp. I know
> > I started with the project in July 1989 and was coding nearly from the
> > first day.
> >
> > With this in mind, the https://devel.rtems.org/wiki/History/Timeline is
> > sorely out of date and lacking missing entries. Multiple mission
> > launches, addition of SMP, GSoC, GCI, and SOCIC participation, move to
> > OSU OSL, incorporation of RTEMS Foundation, scientific discoveries like
> > the particle discovered by an Atlas detector at CERN or the famous gamma
> > ray burst from Fermi. All are missing.
> >
> > Please pitch in and help. If you want to help but don't have any ideas,
> > just post back and I will try to follow up with ideas that someone else
> > can put a date on.
> >
> > Thanks.
> >
> > --joel
>
> I added some small stuff (start of SMP work, main work, release numbers)
> based on the git history (see
>
> https://devel.rtems.org/wiki/History/Timeline?action=diff=27_version=25
> ).
>

Thanks! That's a good set of information.

>
> Although I'm terribly bad with dates: You said you would try to follow
> up with ideas. If you have any where I might could help, please let me
> know.
>

How about these (random and before coffee/tea)

+ Any cool non-space programs folks can admit to?
+ First submission from some core developers.
- Chris was second submitter and is in the 91-92 timeframe. We don't
remember.
- Thomas first shows up in git in March 1998.
- Sebastian gets a nod in July 2008. :)
+ When were some ports added?
+ When were some interesting/popular BSPs added: Zyng, Leon3, gba, etc
- FWIW the original PC BSP was based on DJ Delorie's go32 and pre-dates
  the git history. I did that on a single PC (486 with 32 MB RAM). I
couldn't run
  X11 and compile at the same time. I had to reboot to test. Yes it was
uphill
  both ways back in those days. :)
+ When were some of the original ports/BSPs removed?
   - mvme135/136 was first BSP
   - i386 was second port
   - i960 was last of original 3 ports
+ Interesting features? Like libnetworking, libbsd, shell, dynamic loading?
+ The Cygnus floppy mailing:
https://ftp.rtems.org/pub/rtems/people/joel/CygnusFloppyAugust1995/

This may be good as a small tasks ticket where people cross things off
as they get added.

It is amazing how much this has prodded my memory.  :)

--joel


>
> Best regards
>
> Christian
> --
> 
> 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

[PATCH] Test for clock_nanosleep with CLOCK_MONOTONIC option.

2020-04-14 Thread Utkarsh Rai
This test checks for a simple 1 ns delay with clock_nanosleep with
CLOCK_MONOTONIC.
---
 testsuites/psxtests/Makefile.am   |  9 +++
 testsuites/psxtests/configure.ac  |  1 +
 .../psxtests/psxclocknanosleep01/init.c   | 81 +++
 .../psxclocknanosleep01.doc   | 10 +++
 .../psxclocknanosleep01.scn   |  3 +
 5 files changed, 104 insertions(+)
 create mode 100644 testsuites/psxtests/psxclocknanosleep01/init.c
 create mode 100644 
testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc
 create mode 100644 
testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.scn

diff --git a/testsuites/psxtests/Makefile.am b/testsuites/psxtests/Makefile.am
index 1f9e4233ec..e3918ae7a5 100755
--- a/testsuites/psxtests/Makefile.am
+++ b/testsuites/psxtests/Makefile.am
@@ -321,6 +321,15 @@ psxclockrealtime01_CPPFLAGS = $(AM_CPPFLAGS) \
$(TEST_FLAGS_psxclockrealtime01) $(support_includes)
 endif
 
+if TEST_psxclocknanosleep01
+psx_tests += psxclocknanosleep01
+psx_screens += psxclocknanosleep01/psxclocknanosleep01.scn
+psx_docs += psxclocknanosleep01/psxclocknanosleep01.doc
+psxclocknanosleep01_SOURCES = psxclocknanosleep01/init.c
+psxclocknanosleep01_CPPFLAGS = $(AM_CPPFLAGS) \
+   $(TEST_FLAGS_psxclocknanosleep01) $(support_includes)
+endif
+
 if TEST_psxconcurrency01
 psx_tests += psxconcurrency01
 psx_screens += psxconcurrency01/psxconcurrency01.scn
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 139787cccb..9bfe8e2c0b 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -75,6 +75,7 @@ RTEMS_TEST_CHECK([psxcleanup01])
 RTEMS_TEST_CHECK([psxcleanup02])
 RTEMS_TEST_CHECK([psxclock])
 RTEMS_TEST_CHECK([psxclock01])
+RTEMS_TEST_CHECK([psxclocknanosleep01])
 RTEMS_TEST_CHECK([psxclockrealtime01])
 RTEMS_TEST_CHECK([psxconcurrency01])
 RTEMS_TEST_CHECK([psxcond01])
diff --git a/testsuites/psxtests/psxclocknanosleep01/init.c 
b/testsuites/psxtests/psxclocknanosleep01/init.c
new file mode 100644
index 00..462ee114f8
--- /dev/null
+++ b/testsuites/psxtests/psxclocknanosleep01/init.c
@@ -0,0 +1,81 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 Utkarsh Rai
+ *
+ * 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.
+ */
+
+#include
+#include
+#include
+#include
+
+/*Forward declaration to avoid compiler warning*/
+void clock_sleep(void);
+
+rtems_task Init(rtems_task_argument ignored);
+
+const char rtems_test_name[] = "PSXCLOCKNANOSLEEP 01";
+
+void clock_sleep(void)
+{
+  struct timespec delay_time;
+  intstatus;
+
+  delay_time.tv_sec=0;
+  delay_time.tv_nsec=1;
+
+  status=clock_nanosleep(CLOCK_MONOTONIC, 0, _time, (struct timespec* 
)NULL);
+  rtems_test_assert(!status);
+}
+
+rtems_task Init(rtems_task_argument ignored)
+{
+
+  struct timespec init_time;
+  struct timespec end_time;
+  intstatus;
+
+  TEST_BEGIN();
+
+  status = clock_gettime(CLOCK_MONOTONIC, _time);
+  rtems_test_assert(!status);
+
+  clock_sleep();
+
+  status = clock_gettime(CLOCK_MONOTONIC, _time);
+  rtems_test_assert(!status);
+
+  rtems_test_assert((end_time.tv_sec-init_time.tv_sec)==0);
+  rtems_test_assert((end_time.tv_nsec-init_time.tv_nsec)>=1);
+
+  TEST_END();
+  rtems_test_exit(0);
+}
+
+#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
+
+#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
+#define CONFIGURE_MAXIMUM_TASKS  1
+#define CONFIGURE_INIT
+#include
\ No newline at end of file
diff --git a/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc 
b/testsuites/psxtests/psxclocknanosleep01/psxclocknanosleep01.doc
new file mode 100644
index 00..ac70182aa0
--- /dev/null
+++ 

Re: [PATCH] Use linker garbage collection for BSP based builds

2020-04-14 Thread Chris Johns

On 14/4/20 5:12 pm, Sebastian Huber wrote:

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


On 14/4/20 4:57 pm, Sebastian Huber wrote:

Close #3944.
---
  rtems/config/rtems-bsp.cfg | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index d50615e..91296b1 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -231,7 +231,7 @@
  # The linker flags need to include the machine options for the BSP.
  #
  %define mflags_filter  awk '{for (i=1;iprintf("%s ",$i);}'
-%define rtems_bsp_ldflags %{rtems_bsp_ldflags} $(echo 
"%{rtems_bsp_cflags}" | %{mflags_filter})
+%define rtems_bsp_ldflags %{rtems_bsp_ldflags} $(echo 
"%{rtems_bsp_cflags}" | %{mflags_filter}) -Wl,--gc-sections


What about adding a define like ..

%define rtems_bsp_ldflags_extra -Wl,--gc-sections

.. or something like that and then adding it to rtems_bsp_ldflags?

It would make it easier to track. 

Could you please change the patch and push it.


Sure, I will do this tomorrow.


In RTEMS 6, we should replace this flag tinkering.


We need to only expose the machine flags from RTEMS by default and an 
extra flags are special pkgcfg flags.


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

[PATCH 4.11] libmisc/shell: Updating joel script handling fixes from RTEMS 5

2020-04-14 Thread chrisj
From: Chris Johns 

Updates #3877
---
 cpukit/libmisc/shell/shell.c | 183 ++-
 1 file changed, 116 insertions(+), 67 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 12be9cf3d1..e87a79dfaa 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -43,8 +43,9 @@
 #define SHELL_STD_DEBUG 0
 
 #if SHELL_STD_DEBUG
-static FILE* default_stdout;
-#define shell_std_debug(...) fprintf(default_stdout, __VA_ARGS__)
+#include 
+#define shell_std_debug(...) \
+  do { printk("shell[%08x]: ", rtems_task_self()); printk(__VA_ARGS__); } 
while (0)
 #else
 #define shell_std_debug(...)
 #endif
@@ -124,7 +125,7 @@ static void rtems_shell_env_free(
 free((void *)shell_env->input);
   if ( shell_env->output )
 free((void *)shell_env->output);
-  free( ptr );
+  free( shell_env );
 }
 
 free( handle );
@@ -160,10 +161,6 @@ static void rtems_shell_init_once(void)
   struct passwd pwd;
   struct passwd *pwd_res;
 
-#if SHELL_STD_DEBUG
-  default_stdout = stdout;
-#endif
-
   pthread_key_create(_shell_current_env_key, rtems_shell_env_free);
 
   /* dummy call to init /etc dir */
@@ -189,7 +186,7 @@ void rtems_shell_init_environment(void)
 }
 
 /*
- * Create a current shell key.
+ * Set the shell env into the current thread's shell key.
  */
 static bool rtems_shell_set_shell_env(
   rtems_shell_env_t* shell_env
@@ -213,13 +210,39 @@ static bool rtems_shell_set_shell_env(
 
   eno = pthread_setspecific(rtems_shell_current_env_key, handle);
   if (eno != 0) {
-rtems_error(0, "pthread_setspecific(shell_current_env_key)");
+rtems_error(0, "pthread_setspecific(shell_current_env_key): set");
 return false;
   }
 
   return true;
 }
 
+/*
+ * Clear the current thread's shell key.
+ */
+static void rtems_shell_clear_shell_env(void)
+{
+  int eno;
+
+  /*
+   * Run the destructor manually.
+   */
+  rtems_shell_env_free(pthread_getspecific(rtems_shell_current_env_key));
+
+  /*
+   * Clear the key
+   */
+  eno = pthread_setspecific(rtems_shell_current_env_key, NULL);
+  if (eno != 0)
+rtems_error(0, "pthread_setspecific(shell_current_env_key): clear");
+
+  /*
+   * Clear stdin and stdout file pointers of they will be closed
+   */
+  stdin = NULL;
+  stdout = NULL;
+}
+
 /*
  *  Return the current shell environment
  */
@@ -228,7 +251,7 @@ rtems_shell_env_t *rtems_shell_get_current_env(void)
   rtems_shell_env_key_handle *handle;
   handle = (rtems_shell_env_key_handle*)
 pthread_getspecific(rtems_shell_current_env_key);
-  return handle->env;
+  return handle == NULL ? NULL : handle->env;
 }
 
 /*
@@ -239,6 +262,7 @@ void rtems_shell_dup_current_env(rtems_shell_env_t *copy)
 {
   rtems_shell_env_t *env = rtems_shell_get_current_env();
   if (env != NULL) {
+shell_std_debug("dup: existing parent\n");
 *copy = *env;
   }
   else {
@@ -249,6 +273,10 @@ void rtems_shell_dup_current_env(rtems_shell_env_t *copy)
 copy->parent_stdout = stdout;
 copy->parent_stdin  = stdin;
 copy->parent_stderr = stderr;
+shell_std_debug("dup: global: copy: %p out: %d (%p) in: %d (%p)\n",
+copy,
+fileno(copy->parent_stdout), copy->parent_stdout,
+fileno(copy->parent_stdin), copy->parent_stdin);
   }
   /*
* Duplicated environments are not managed.
@@ -278,14 +306,21 @@ static int rtems_shell_line_editor(
   int  up;
   int  cmd = -1;
   int  inserting = 1;
+  int  in_fileno = fileno(in);
+  int  out_fileno = fileno(out);
 
-  output = (out && isatty(fileno(in)));
+  /*
+   * Only this task can use this file descriptor because calling
+   * fileno will block if another thread call made a call on this
+   * descriptor.
+   */
+  output = (out && isatty(in_fileno));
 
   col = last_col = 0;
 
-  tcdrain(fileno(in));
+  tcdrain(in_fileno);
   if (out)
-tcdrain(fileno(out));
+tcdrain(out_fileno);
 
   if (output && prompt)
 fprintf(out, "\r%s", prompt);
@@ -631,9 +666,9 @@ static bool rtems_shell_login(rtems_shell_env_t *env, FILE 
* in,FILE * out)
 (env->devname[7]!='y')) {
   fd = fopen("/etc/issue","r");
   if (fd) {
-while ((c=fgetc(fd))!=EOF) {
+while ((c = fgetc(fd)) != EOF) {
   if (c=='@')  {
-switch(c=fgetc(fd)) {
+switch (c = fgetc(fd)) {
   case 'L':
 fprintf(out,"%s", env->devname);
 break;
@@ -812,59 +847,53 @@ bool rtems_shell_main_loop(
 
   if (!rtems_shell_init_user_env()) {
 rtems_error(0, "rtems_shell_init_user_env");
+rtems_shell_clear_shell_env();
 return false;
   }
 
-  shell_std_debug("shell: out: %d %d %s\n",
-  fileno(stdout), fileno(shell_env->parent_stdout),
-  shell_env->output);
-  shell_std_debug(" :  in: %d %d %s\n",
-  fileno(stdin), fileno(shell_env->parent_stdin),
- 

[PATCH v2] libmisc/shell: Fix the handling of joel scripts in telnet

2020-04-14 Thread chrisj
From: Chris Johns 

- Fix the passing of std[in/out] to child threads
- Fix deleting of managed memory in the key destructor
- Only set the key in the main loop thread
- Only allocate a shell env outside of the main loop
- Fix memory leak if the task start fails
- Remove error level from shell env, it cannot be returned this way. Add
  exit_code but the API is broken so it cannot be returned.

Closes #3859
---
 cpukit/include/rtems/shell.h   |   7 +-
 cpukit/libmisc/shell/shell.c   | 369 +
 testsuites/libtests/shell01/init.c | 123 +-
 3 files changed, 394 insertions(+), 105 deletions(-)

diff --git a/cpukit/include/rtems/shell.h b/cpukit/include/rtems/shell.h
index 973db16605..d705dcb0a7 100644
--- a/cpukit/include/rtems/shell.h
+++ b/cpukit/include/rtems/shell.h
@@ -220,16 +220,21 @@ extern rtems_status_code rtems_shell_script(
 typedef struct {
   /** 'S','E','N','V': Shell Environment */
   rtems_name magic;
+  bool managed;
   const char *devname;
   const char *taskname;
   bool exit_shell; /* logout */
   bool forever; /* repeat login */
-  int errorlevel;
+  int *exit_code;
+  bool exit_on_error;
   bool echo;
   char cwd[256];
   const char *input;
   const char *output;
   bool output_append;
+  FILE *parent_stdin;
+  FILE *parent_stdout;
+  FILE *parent_stderr;
   rtems_id wake_on_end;
   rtems_shell_login_check_t login_check;
 
diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index c2ea3c4afa..f00ae54b49 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -20,6 +20,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -38,22 +39,44 @@
 #include 
 #include 
 
+#define SHELL_STD_DEBUG 0
+
+#if SHELL_STD_DEBUG
+#include 
+#define shell_std_debug(...) \
+  do { printk("shell[%08x]: ", rtems_task_self()); printk(__VA_ARGS__); } 
while (0)
+#else
+#define shell_std_debug(...)
+#endif
+
 const rtems_shell_env_t rtems_global_shell_env = {
   .magic = rtems_build_name('S', 'E', 'N', 'V'),
+  .managed   = false,
   .devname   = CONSOLE_DEVICE_NAME,
   .taskname  = "SHGL",
   .exit_shell= false,
   .forever   = true,
-  .errorlevel= -1,
   .echo  = false,
   .cwd   = "/",
   .input = NULL,
   .output= NULL,
   .output_append = false,
+  .parent_stdin  = NULL,
+  .parent_stdout = NULL,
+  .parent_stderr = NULL,
   .wake_on_end   = RTEMS_ID_NONE,
-  .login_check   = NULL
+  .exit_code = NULL,
+  .login_check   = NULL,
+  .uid   = 0,
+  .gid   = 0
 };
 
+typedef struct rtems_shell_env_key_handle
+{
+  bool managed;
+  rtems_shell_env_t* env;
+} rtems_shell_env_key_handle;
+
 static pthread_once_t rtems_shell_once = PTHREAD_ONCE_INIT;
 
 static pthread_key_t rtems_shell_current_env_key;
@@ -62,7 +85,7 @@ static pthread_key_t rtems_shell_current_env_key;
  *  Initialize the shell user/process environment information
  */
 static rtems_shell_env_t *rtems_shell_init_env(
-  rtems_shell_env_t *shell_env_p
+  rtems_shell_env_t *shell_env_parent
 )
 {
   rtems_shell_env_t *shell_env;
@@ -70,12 +93,17 @@ static rtems_shell_env_t *rtems_shell_init_env(
   shell_env = malloc(sizeof(rtems_shell_env_t));
   if ( !shell_env )
 return NULL;
-  if ( !shell_env_p ) {
+
+  if ( shell_env_parent == NULL ) {
+shell_env_parent = rtems_shell_get_current_env();
+  }
+  if ( shell_env_parent == NULL ) {
 *shell_env = rtems_global_shell_env;
-shell_env->taskname = NULL;
   } else {
-*shell_env = *shell_env_p;
+*shell_env = *shell_env_parent;
   }
+  shell_env->managed = true;
+  shell_env->taskname = NULL;
 
   return shell_env;
 }
@@ -87,17 +115,20 @@ static void rtems_shell_env_free(
   void *ptr
 )
 {
-  rtems_shell_env_t *shell_env;
-  shell_env = (rtems_shell_env_t *) ptr;
-
-  if ( !ptr )
-return;
+  if ( ptr != NULL ) {
+rtems_shell_env_key_handle *handle = (rtems_shell_env_key_handle *) ptr;
+rtems_shell_env_t *shell_env = handle->env;
+
+if ( handle->managed ) {
+  if ( shell_env->input )
+free((void *)shell_env->input);
+  if ( shell_env->output )
+free((void *)shell_env->output);
+  free( shell_env );
+}
 
-  if ( shell_env->input )
-free((void *)shell_env->input);
-  if ( shell_env->output )
-free((void *)shell_env->output);
-  free( ptr );
+free( handle );
+  }
 }
 
 static void rtems_shell_create_file(const char *name, const char *content)
@@ -153,12 +184,73 @@ void rtems_shell_init_environment(void)
   assert(pthread_once(_shell_once, rtems_shell_init_once) == 0);
 }
 
+/*
+ * Set the shell env into the current thread's shell key.
+ */
+static bool rtems_shell_set_shell_env(
+  rtems_shell_env_t* shell_env
+)
+{
+  /*
+   * The shell environment can be managed or it can be provided by a
+   * user. We need to create a handle to hold the env pointer.
+   */
+  rtems_shell_env_key_handle *handle;
+  int eno;
+
+  handle = 

Re: [PATCH rtems-docs] user/imx: Add i.MX6UL/ULL.

2020-04-14 Thread Christian Mauderer
On 02/04/2020 16:56, Christian Mauderer wrote:
> On 02/04/2020 16:53, Gedare Bloom wrote:
>> PS: how do you get the repo inlined to the [PATCH xxx] subject line? It's 
>> handy.
> 
> git format patch supports to set the prefix with:
> 
>  git format-patch HEAD^ --subject-prefix="PATCH rtems-docs"
> 
> I haven't found a good method yet to set it automatically to the repo
> name. But With the growing number of repositories in RTEMS I try to add
> the prefixes when not comiting to the core.

I found a nicer solution with some help from Stackoverflow:

git config --global alias.format-patch-repo '!git format-patch
--subject-prefix="PATCH $(basename $(git rev-parse --show-toplevel))"'

This adds an alias that automatically adds the folder name of the
repository. It can be used with

git format-patch-repo HEAD^

If you only work in one directory, an alternative is to set the
format.subjectPrefix option in the repository.

Best regards

Christian

> 
>>
>> On Thu, Apr 2, 2020 at 8:51 AM Gedare Bloom  wrote:
>>>
>>> On Thu, Apr 2, 2020 at 8:43 AM Christian Mauderer
>>>  wrote:

 Update #3869
 ---
  user/bsps/arm/imx.rst | 49 
 ++---
  1 file changed, 46 insertions(+), 3 deletions(-)

 diff --git a/user/bsps/arm/imx.rst b/user/bsps/arm/imx.rst
 index bc93ae3..51c3b7e 100644
 --- a/user/bsps/arm/imx.rst
 +++ b/user/bsps/arm/imx.rst
 @@ -7,9 +7,10 @@ imx (NXP i.MX)
  ==

  This BSP offers only one variant, the `imx7`.  This variant supports the 
 i.MX
 -7Dual processor.  The basic hardware initialization is not performed by 
 the
 -BSP.  A boot loader with device tree support must be used to start the 
 BSP,
 -e.g. U-Boot.
 +7Dual processor and the i.MX 6UL/ULL processor family (with slightly 
 different
 +clock settings).  The basic hardware initialization is not performed by 
 the BSP.
 +A boot loader with device tree support must be used to start the BSP, e.g.
 +U-Boot or barebox.

  Build Configuration Options
  ---
 @@ -40,9 +41,30 @@ The following options are available at the configure 
 command line.
  ``IMX_CCM_UART_HZ``
 The UART clock frequency in Hz (default is 2400).

 +``IMX_CCM_ECSPI_HZ``
 +   The ECSPI clock frequency in Hz (default is 6750).
 +
  ``IMX_CCM_AHB_HZ``
 The AHB clock frequency in Hz (default is 13500).

 +``IMX_CCM_SDHCI_HZ``
 +   The SDHCI clock frequency in Hz (default is 196363000).
 +
 +Clock settings for different boards
 +---
 +
 +The default clock settings are targeted for an i.MX 7Dual evaluation 
 board using
 +U-Boot. Some other boards with different boot loaders need different 
 settings:
 +
 + * Phytec phyCORE-i.MX 6ULL (system on module) with MCIMX6Y2CVM08AB and a
 +   barebox bootloader (version ``2019.01.0-bsp-yocto-i.mx6ul-pd19.1.0``):
 +
 +   * IMX_CCM_IPG_HZ=6600
 +   * IMX_CCM_UART_HZ=8000
 +   * IMX_CCM_AHB_HZ=6600
 +   * IMX_CCM_SDHCI_HZ=19800
 +   * IMX_CCM_ECSPI_HZ=6000
 +
  Boot via U-Boot
  ---

 @@ -65,6 +87,14 @@ The ``loadfdt`` command may be not defined in your 
 U-Boot environment.  Just
  replace it with the appropriate commands to load the device tree at
  ``${fdt_addr}``.

 +Boot via barebox
 +
 +
 +The same command like for U-Boot can be used to generate an application 
 image.
 +In a default configuration barebox expects an fdt image called `oftree` 
 and a
 +kernel image called `zImage` in the root folder of the bootable medium 
 (e.g. an
 +SD card).
 +
  Clock Driver
  

 @@ -133,6 +163,18 @@ system controls:
  A value of zero for the time or count disables the interrupt coalescing 
 in the
  corresponding direction.

 +On the Phytec phyCORE-i.MX 6ULL modules the PHY needs an initialization 
 for the
 +clock. A special PHY driver handles that (``ksz8091rnb``). Add it to your 
 libbsd
 +config like that:
 +
 +.. code-block:: c
 +
 +#define RTEMS_BSD_CONFIG_BSP_CONFIG
 +#define RTEMS_BSD_CONFIG_INIT
 +SYSINIT_DRIVER_REFERENCE(ksz8091rnb, miibus);
 +#include 
 +
 +
>>> Is the extra space needed here?
>>>
  MMC/SDCard Driver
  -

 @@ -147,3 +189,4 @@ Caveats
  The clock and pin configuration support is quite rudimentary and mostly 
 relies
  on the boot loader.  For a pin group configuration see
  ``imx_iomux_configure_pins()``.  There is no power management support.
 +
>>>
>>> Many docs end without the blank line. It does cause git to complain.
>>> I'm not sure if we have any rule about 

Re: [PATCH] Use linker garbage collection for BSP based builds

2020-04-14 Thread Sebastian Huber

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


On 14/4/20 4:57 pm, Sebastian Huber wrote:

Close #3944.
---
  rtems/config/rtems-bsp.cfg | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index d50615e..91296b1 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -231,7 +231,7 @@
  # The linker flags need to include the machine options for the BSP.
  #
  %define mflags_filter  awk '{for (i=1;iprintf("%s ",$i);}'
-%define rtems_bsp_ldflags %{rtems_bsp_ldflags} $(echo 
"%{rtems_bsp_cflags}" | %{mflags_filter})
+%define rtems_bsp_ldflags %{rtems_bsp_ldflags} $(echo 
"%{rtems_bsp_cflags}" | %{mflags_filter}) -Wl,--gc-sections


What about adding a define like ..

%define rtems_bsp_ldflags_extra -Wl,--gc-sections

.. or something like that and then adding it to rtems_bsp_ldflags?

It would make it easier to track. 
Could you please change the patch and push it. In RTEMS 6, we should 
replace this flag tinkering.
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] Use linker garbage collection for BSP based builds

2020-04-14 Thread Chris Johns

On 14/4/20 4:57 pm, Sebastian Huber wrote:

Close #3944.
---
  rtems/config/rtems-bsp.cfg | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index d50615e..91296b1 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -231,7 +231,7 @@
  # The linker flags need to include the machine options for the BSP.
  #
  %define mflags_filter  awk '{for (i=1;i

What about adding a define like ..

%define rtems_bsp_ldflags_extra -Wl,--gc-sections

.. or something like that and then adding it to rtems_bsp_ldflags?

It would make it easier to track.

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


[PATCH] Use linker garbage collection for BSP based builds

2020-04-14 Thread Sebastian Huber
Close #3944.
---
 rtems/config/rtems-bsp.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtems/config/rtems-bsp.cfg b/rtems/config/rtems-bsp.cfg
index d50615e..91296b1 100644
--- a/rtems/config/rtems-bsp.cfg
+++ b/rtems/config/rtems-bsp.cfg
@@ -231,7 +231,7 @@
 # The linker flags need to include the machine options for the BSP.
 #
 %define mflags_filter  awk '{for (i=1;ihttp://lists.rtems.org/mailman/listinfo/devel


Re: RTEMS Timeline Update and 25th Anniversary of First Public Commit

2020-04-14 Thread Christian Mauderer
Hello Joel,

On 07/04/2020 22:44, Joel Sherrill wrote:
> Hi
> 
> The RTEMS Project is rapidly approaching a major milestone -- the 25th
> anniversary of the oldest commit in the git repository! That occurs on 4
> May 2020!
> 
> Before that time, the source code was managed on an internal research
> project repository and snapshots/releases made available via ftp. I know
> I started with the project in July 1989 and was coding nearly from the
> first day.
> 
> With this in mind, the https://devel.rtems.org/wiki/History/Timeline is
> sorely out of date and lacking missing entries. Multiple mission
> launches, addition of SMP, GSoC, GCI, and SOCIC participation, move to
> OSU OSL, incorporation of RTEMS Foundation, scientific discoveries like
> the particle discovered by an Atlas detector at CERN or the famous gamma
> ray burst from Fermi. All are missing. 
> 
> Please pitch in and help. If you want to help but don't have any ideas,
> just post back and I will try to follow up with ideas that someone else
> can put a date on. 
> 
> Thanks.
> 
> --joel

I added some small stuff (start of SMP work, main work, release numbers)
based on the git history (see
https://devel.rtems.org/wiki/History/Timeline?action=diff=27_version=25).

Although I'm terribly bad with dates: You said you would try to follow
up with ideas. If you have any where I might could help, please let me know.

Best regards

Christian
-- 

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

Re: [PATCH RSB 3/4] source-builder: Add capstone

2020-04-14 Thread Vijay Kumar Banerjee
On Tue, Apr 14, 2020, 10:00 AM Chris Johns  wrote:

> What is the use case for this package?
>
qemu-couverture uses capstone.

> Chris
>
> On 10/4/20 6:21 am, Vijay Kumar Banerjee wrote:
> > ---
> >   bare/config/devel/capstone-4.0.1-1.cfg | 27 +++
> >   bare/config/devel/capstone.bset|  7 +++
> >   source-builder/config/capstone-1-1.cfg | 62 ++
> >   3 files changed, 96 insertions(+)
> >   create mode 100644 bare/config/devel/capstone-4.0.1-1.cfg
> >   create mode 100644 bare/config/devel/capstone.bset
> >   create mode 100644 source-builder/config/capstone-1-1.cfg
> >
> > diff --git a/bare/config/devel/capstone-4.0.1-1.cfg
> b/bare/config/devel/capstone-4.0.1-1.cfg
> > new file mode 100644
> > index 000..9f3627c
> > --- /dev/null
> > +++ b/bare/config/devel/capstone-4.0.1-1.cfg
> > @@ -0,0 +1,27 @@
> > +#
> > +# Capstone from Git
> > +#
> > +
> > +%if %{release} == %{nil}
> > + %define release 1
> > +%endif
> > +
> > +%include %{_configdir}/base.cfg
> > +
> > +%include %{_configdir}/bare-config.cfg
> > +
> > +#
> > +# Capstone Version.
> > +#
> > +%define capstone_version 4.0.1
> > +
> > +#
> > +# Set source from github.
> > +#
> > +%source set capstone --rsb-file=capstone-%{capstone_version}.tar.gz
> https://github.com/aquynh/capstone/archive/%{capstone_version}.tar.gz
> > +%hash sha512 capstone-%{capstone_version}.tar.gz
> 43c52024065b41b45eff9423341db3f3d5163fa7aa01b360faa30437786740c8f2c34c36faa04dced5308e09d8bd78df3bad0ab9c06f98612169edb176f83c36
> > +
> > +#
> > +# The build instructions.
> > +#
> > +%include %{_configdir}/capstone-1-1.cfg
> > diff --git a/bare/config/devel/capstone.bset
> b/bare/config/devel/capstone.bset
> > new file mode 100644
> > index 000..d56406d
> > --- /dev/null
> > +++ b/bare/config/devel/capstone.bset
> > @@ -0,0 +1,7 @@
> > +#
> > +# Build set for Capstone Disassembler
> > +#
> > +
> > +%define release 1
> > +
> > +devel/capstone-4.0.1-1
> > diff --git a/source-builder/config/capstone-1-1.cfg
> b/source-builder/config/capstone-1-1.cfg
> > new file mode 100644
> > index 000..703fd54
> > --- /dev/null
> > +++ b/source-builder/config/capstone-1-1.cfg
> > @@ -0,0 +1,62 @@
> > +#
> > +#
> > +# This configuration file configure's, make's and install's CAPSTONE.
> > +#
> > +
> > +%if %{release} == %{nil}
> > +%define release 1
> > +%endif
> > +
> > +#
> > +# Select Snapshot Macro Maps
> > +#
> > +%select capstone-snapshot
> > +
> > +#
> > +# The description.
> > +#
> > +Name:  capstone-%{capstone_version}-%{_host}-%{release}
> > +Summary:   Capstone is light-weight multiplatform disassembler.
> > +Version:   %{capstone_version}
> > +Release:   %{release}
> > +URL:http://www.capstone-engine.org/
> > +
> > +#
> > +# Source
> > +#
> > +%source set capstone
> https://github.com/aquynh/capstone/archive/capstone-%{capstone_version}.tar.gz
> > +%hash sha512 capstone-%{capstone_version}.tar.gz
> 43c52024065b41b45eff9423341db3f3d5163fa7aa01b360faa30437786740c8f2c34c36faa04dced5308e09d8bd78df3bad0ab9c06f98612169edb176f83c36
> > +
> > +#
> > +# Prepare the source code.
> > +#
> > +%prep
> > +  build_top=$(pwd)
> > +
> > +  source_dir_capstone="capstone-%{capstone_version}"
> > +  %source setup capstone -q -n capstone-%{capstone_version}
> > +  %patch setup capstone -p1
> > +
> > +  cd ${build_top}
> > +
> > +%build
> > +  build_top=$(pwd)
> > +
> > +  %{build_directory}
> > +
> > +  cd ${source_dir_capstone}
> > +
> > +  %{__make} PREFIX=%{_prefix}
> > +
> > +  cd ${build_top}
> > +
> > +%install
> > +  build_top=$(pwd)
> > +
> > +  %{__rmdir} ${SB_BUILD_ROOT}
> > +
> > +  cd ${source_dir_capstone}
> > +
> > +  %{__make} DESTDIR=$SB_BUILD_ROOT PREFIX=%{_prefix} install
> > +
> > +  cd ${build_top}
> >
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel