[PATCH 1/3] Move all python commands to use env python

2020-09-24 Thread chrisj
From: Chris Johns 

- If you host does not provide a python command consult the User
  manual for ways you can run the python commands.

- Full package paths are being used to avoid namespace pollution and
  crosstalk.
---
 tester/rt/cmd-run.py => misc/__init__.py  | 18 +--
 misc/rtems-boot-image | 31 ++--
 misc/rtems-tftp-proxy | 31 ++--
 misc/tools/{cmd-boot-image.py => __init__.py} | 18 +--
 misc/tools/boot.py|  2 +-
 misc/tools/cmd-tftpproxy.py   | 44 
 misc/tools/tftpproxy.py   |  6 +--
 misc/wscript  |  8 +--
 rtemstoolkit/rtems.py |  9 ++--
 tester/{rt/cmd-bsp-builder.py => __init__.py} | 19 +--
 tester/rt/cmd-test.py | 45 -
 tester/rt/config.py   | 30 +--
 tester/rt/console.py  |  8 +--
 tester/rt/coverage.py |  2 -
 tester/rt/gdb.py  | 14 +++---
 tester/rt/run.py  | 30 ++-
 tester/rt/test.py | 50 +--
 tester/rt/tftp.py | 14 +++---
 tester/rtems-bsp-builder  | 31 ++--
 tester/rtems-run  | 31 ++--
 tester/rtems-test | 31 ++--
 tester/rtems-tftp-server  | 12 ++---
 tester/wscript|  8 ++-
 23 files changed, 182 insertions(+), 310 deletions(-)
 rename tester/rt/cmd-run.py => misc/__init__.py (77%)
 mode change 100755 => 100644
 rename misc/tools/{cmd-boot-image.py => __init__.py} (77%)
 mode change 100755 => 100644
 delete mode 100755 misc/tools/cmd-tftpproxy.py
 rename tester/{rt/cmd-bsp-builder.py => __init__.py} (77%)
 mode change 100755 => 100644
 delete mode 100755 tester/rt/cmd-test.py

diff --git a/tester/rt/cmd-run.py b/misc/__init__.py
old mode 100755
new mode 100644
similarity index 77%
rename from tester/rt/cmd-run.py
rename to misc/__init__.py
index 221c3f8..6ff279c
--- a/tester/rt/cmd-run.py
+++ b/misc/__init__.py
@@ -1,6 +1,5 @@
-#
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2017 Chris Johns (chr...@rtems.org)
+# Copyright 2020 Chris Johns (chr...@rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,17 +27,4 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 
-from __future__ import print_function
-
-import sys, os
-
-base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
-rtems = os.path.dirname(base)
-sys.path = [rtems] + sys.path
-
-try:
-import run
-run.run(sys.argv[1:], command_path = base)
-except ImportError:
-print("Incorrect RTEMS Tools installation", file = sys.stderr)
-sys.exit(1)
+all = []
diff --git a/misc/rtems-boot-image b/misc/rtems-boot-image
index aa23b2e..7f7ac0d 100755
--- a/misc/rtems-boot-image
+++ b/misc/rtems-boot-image
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chr...@rtems.org)
+# Copyright 2019, 2020 Chris Johns (chr...@rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
-set -e
-base=$(dirname $(dirname $0))
-cmd=misc/tools/cmd-boot-image.py
-PYTHON_WRAPPER=rtemstoolkit/python-wrapper.sh
-if test -f ${base}/${PYTHON_WRAPPER}; then
-  PYTHON_CMD=${base}/${cmd}
-  . ${base}/${PYTHON_WRAPPER}
-elif test -f ${base}/share/rtems/${PYTHON_WRAPPER}; then
-  PYTHON_CMD=${base}/share/rtems/${cmd}
-  . ${base}/share/rtems/${PYTHON_WRAPPER}
-fi
-echo "error: RTEMS Toolkit python wrapper not found, please report"
+
+from __future__ import print_function
+
+import sys, os
+
+base = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
+rtems = os.path.join(base, 'share', 'rtems')
+sys.path = sys.path[0:1] + [rtems, base] + sys.path[1:]
+
+try:
+import misc.tools.boot
+misc.tools.boot.run()
+except ImportError:
+print("Incorrect RTEMS Tools installation", file = sys.stderr)
+sys.exit(1)
diff --git a/misc/rtems-tftp-proxy b/misc/rtems-tftp-proxy
index 213311d..2125662 100755
--- a/misc/rtems-tftp-proxy
+++ b/misc/rtems-tftp-proxy
@@ -1,7 +1,7 @@
-#! /bin/sh
+#! /usr/bin/env python
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2019 Chris Johns (chr...@rtems.org)
+# Copyright 2019, 2020 Chris Johns (chr...@rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.
@@ -28,15 +28,18 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
-set -e
-base=$(dirname $(dir

[PATCH 2/3] rtemstoolkit/configuration: Treat an empty variable as an empty list

2020-09-24 Thread chrisj
From: Chris Johns 

---
 rtemstoolkit/configuration.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rtemstoolkit/configuration.py b/rtemstoolkit/configuration.py
index a73fd9b..1f57de4 100644
--- a/rtemstoolkit/configuration.py
+++ b/rtemstoolkit/configuration.py
@@ -140,7 +140,7 @@ class configuration:
 
 def comma_list(self, section, label, err = True):
 items = self.get_item(section, label, err)
-if items is None:
+if items is None or len(items) == 0:
 return []
 return sorted(set([a.strip() for a in items.split(',')]))
 
-- 
2.24.1

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


[PATCH 3/3] rtemstoolkit/dwarf: Dump the DIE offset

2020-09-24 Thread chrisj
From: Chris Johns 

---
 rtemstoolkit/rld-dwarf.cpp | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rtemstoolkit/rld-dwarf.cpp b/rtemstoolkit/rld-dwarf.cpp
index fc4399a..d9ac6f3 100644
--- a/rtemstoolkit/rld-dwarf.cpp
+++ b/rtemstoolkit/rld-dwarf.cpp
@@ -1429,7 +1429,11 @@ namespace rld
   const char* s;
   ::dwarf_get_TAG_name (tag (), &s);
   out << level_prefix.substr (0, level_prefix.length () - 1)
-  << "+- " << s << std::endl;
+  << "+- " << s << " ("
+  << std::hex << std::setfill ('0')
+  << std::setw (8) << offset_
+  << std::dec << std::setfill (' ')
+  << ')' << std::endl;
 
   dwarf_attribute* attributes;
   dwarf_signed attr_count;
-- 
2.24.1

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


[PATCH] leon,gr1553b: improve init check

2020-09-30 Thread chrisj
From: Daniel Hellstrom 

Check in init3 not needed since same data is already checked in init2
stage. Adds an extra check that the APB register space is available before
accessing it.

Closes #2331
---
 c/src/lib/libbsp/sparc/shared/1553/gr1553b.c | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/c/src/lib/libbsp/sparc/shared/1553/gr1553b.c 
b/c/src/lib/libbsp/sparc/shared/1553/gr1553b.c
index 2e778606ac..c05d53a4f9 100644
--- a/c/src/lib/libbsp/sparc/shared/1553/gr1553b.c
+++ b/c/src/lib/libbsp/sparc/shared/1553/gr1553b.c
@@ -191,6 +191,8 @@ static int gr1553_init2(struct drvmgr_dev *dev)
return DRVMGR_FAIL;
}
pnpinfo = &ambadev->info;
+   if ( pnpinfo->apb_slv == NULL )
+   return DRVMGR_EIO;
regs = (struct gr1553b_regs *)pnpinfo->apb_slv->start;
 
/* Stop IRQ */
@@ -227,9 +229,6 @@ static int gr1553_init3(struct drvmgr_dev *dev)
 
/* Get device information from AMBA PnP information */
ambadev = (struct amba_dev_info *)dev->businfo;
-   if ( ambadev == NULL ) {
-   return DRVMGR_FAIL;
-   }
pnpinfo = &ambadev->info;
regs = (struct gr1553b_regs *)pnpinfo->apb_slv->start;
 
@@ -257,6 +256,12 @@ static int gr1553_init3(struct drvmgr_dev *dev)
gr1553_list_add(&gr1553_rt_root, feat);
}
 
+   if ( priv->features == 0 ) {
+   /* no features in HW should never happen.. an I/O error? */
+   free(priv);
+   return DRVMGR_EIO;
+   }
+
return DRVMGR_OK;
 }
 
-- 
2.24.1

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


[PATCH 1/3] rtemstoolkit: Fix macro's use of 'is'

2020-10-02 Thread chrisj
From: Chris Johns 

Updates #4111
---
 rtemstoolkit/macros.py | 90 +-
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/rtemstoolkit/macros.py b/rtemstoolkit/macros.py
index 4eb8829..be983f1 100644
--- a/rtemstoolkit/macros.py
+++ b/rtemstoolkit/macros.py
@@ -189,24 +189,24 @@ class macros:
 
 def __setitem__(self, key, value):
 key = self._unicode_to_str(key)
-if type(key) is not str:
+if type(key) != str:
 raise TypeError('bad key type (want str): %s' % (type(key)))
-if type(value) is not tuple:
+if type(value) != tuple:
 value = self._unicode_to_str(value)
-if type(value) is str:
+if type(value) == str:
 value = ('none', 'none', value)
-if type(value) is not tuple:
+if type(value) != tuple:
 raise TypeError('bad value type (want tuple): %s' % (type(value)))
 if len(value) != 3:
 raise TypeError('bad value tuple (len not 3): %d' % (len(value)))
 value = (self._unicode_to_str(value[0]),
  self._unicode_to_str(value[1]),
  self._unicode_to_str(value[2]))
-if type(value[0]) is not str:
+if type(value[0]) != str:
 raise TypeError('bad value tuple type field: %s' % 
(type(value[0])))
-if type(value[1]) is not str:
+if type(value[1]) != str:
 raise TypeError('bad value tuple attrib field: %s' % 
(type(value[1])))
-if type(value[2]) is not str:
+if type(value[2]) != str:
 raise TypeError('bad value tuple value field: %s' % 
(type(value[2])))
 if value[0] not in ['none', 'triplet', 'dir', 'file', 'exe']:
 raise TypeError('bad value tuple (type field): %s' % (value[0]))
@@ -238,7 +238,7 @@ class macros:
 return sorted(set(keys))
 
 def has_key(self, key):
-if type(key) is not str:
+if type(key) != str:
 raise TypeError('bad key type (want str): %s' % (type(key)))
 if self.key_filter(key) not in list(self.keys()):
 return False
@@ -251,7 +251,7 @@ class macros:
 return [rm[5:] for rm in self.read_maps]
 
 def key_filter(self, key):
-if key.startswith('%{') and key[-1] is '}':
+if key.startswith('%{') and key[-1] == '}':
 key = key[2:-1]
 return key.lower()
 
@@ -286,29 +286,29 @@ class macros:
 print(' c:%s(%d) s:%s t:"%s" m:%r M:%s' % \
 (c, ord(c), state, token, macro, map))
 l_remaining = l_remaining[1:]
-if c is '#' and not state.startswith('value'):
+if c == '#' and not state.startswith('value'):
 break
 if c == '\n' or c == '\r':
-if not (state is 'key' and len(token) == 0) and \
+if not (state == 'key' and len(token) == 0) and \
 not state.startswith('value-multiline'):
 self.macros = orig_macros
 raise error.general('malformed macro line:%d: %s' % 
(lc, l))
-if state is 'key':
+if state == 'key':
 if c not in string.whitespace:
-if c is '[':
+if c == '[':
 state = 'map'
-elif c is '%':
+elif c == '%':
 state = 'directive'
-elif c is ':':
+elif c == ':':
 macro += [token]
 token = ''
 state = 'attribs'
-elif c is '#':
+elif c == '#':
 break
 else:
 token += c
-elif state is 'map':
-if c is ']':
+elif state == 'map':
+if c == ']':
 if token not in self.macros:
 self.macros[token] = {}
 map = token
@@ -319,7 +319,7 @@ class macros:
 else:
 self.macros = orig_macros
 raise error.general('invalid macro map:%d: %s' % (lc, 
l))
-elif state is 'directive':
+elif state == 'directive':
 if c in string.whitespace:
 if token == 'include':
 self.load(_clean(l_remaining))
@@ -331,8 +331,8 @@ class macros:
 else:
 self.macros = orig_macros
 raise error.general('invalid macro directive:%d: %s' % 
(lc, l))
-elif state is 'include':
-if c is string.whitespace:
+  

[PATCH 3/3] rtemstoolkit/linux: Fix the host support

2020-10-02 Thread chrisj
From: Chris Johns 

Updates #4111
---
 rtemstoolkit/linux.py | 20 
 1 file changed, 4 insertions(+), 16 deletions(-)

diff --git a/rtemstoolkit/linux.py b/rtemstoolkit/linux.py
index 15c6132..1ce6739 100644
--- a/rtemstoolkit/linux.py
+++ b/rtemstoolkit/linux.py
@@ -33,6 +33,7 @@
 # RTEMS project's spec files.
 #
 
+import multiprocessing
 import pprint
 import os
 import platform
@@ -42,28 +43,14 @@ import platform
 # If there is a better way to let us know.
 #
 try:
-from . import execute
 from . import path
 except (ValueError, SystemError):
-import execute
 import path
 
 def load():
 uname = os.uname()
 smp_mflags = ''
-processors = '/bin/grep processor /proc/cpuinfo'
-e = execute.capture_execution()
-exit_code, proc, output = e.shell(processors)
-ncpus = 0
-if exit_code == 0:
-try:
-for l in output.split('\n'):
-count = l.split(':')[1].strip()
-if int(count) > ncpus:
-ncpus = int(count)
-except:
-pass
-ncpus = str(ncpus + 1)
+ncpus = str(multiprocessing.cpu_count())
 if uname[4].startswith('arm'):
 cpu = 'arm'
 else:
@@ -89,8 +76,9 @@ def load():
 try:
 distro = platform.dist()[0]
 distro_ver = float(platform.dist()[1])
-except ValueError:
+except (AttributeError, ValueError):
 # Non LSB distro found, use failover"
+distro = ''
 pass
 
 # Non LSB - fail over to issue
-- 
2.24.1

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


[PATCH v4] cpukit/librcxx: Add a C++ thread interface with attributes

2020-10-02 Thread chrisj
From: Chris Johns 

---
 cpukit/include/rtems/c++/error|  65 +++
 cpukit/include/rtems/c++/thread   | 469 ++
 cpukit/librtemscxx/error.cc   |  76 
 cpukit/librtemscxx/thread.cc  | 416 +++
 spec/build/cpukit/grp.yml |   2 +
 spec/build/cpukit/librtemscxx.yml |  21 +
 spec/build/testsuites/libtests/grp.yml|   2 +
 spec/build/testsuites/libtests/rcxx01.yml |  22 +
 testsuites/libtests/rcxx01/init.c |  69 
 testsuites/libtests/rcxx01/rcxx01.doc |  16 +
 testsuites/libtests/rcxx01/rcxx01.scn |  13 +
 testsuites/libtests/rcxx01/thread.cc  |  90 +
 12 files changed, 1261 insertions(+)
 create mode 100644 cpukit/include/rtems/c++/error
 create mode 100644 cpukit/include/rtems/c++/thread
 create mode 100644 cpukit/librtemscxx/error.cc
 create mode 100644 cpukit/librtemscxx/thread.cc
 create mode 100644 spec/build/cpukit/librtemscxx.yml
 create mode 100644 spec/build/testsuites/libtests/rcxx01.yml
 create mode 100644 testsuites/libtests/rcxx01/init.c
 create mode 100644 testsuites/libtests/rcxx01/rcxx01.doc
 create mode 100644 testsuites/libtests/rcxx01/rcxx01.scn
 create mode 100644 testsuites/libtests/rcxx01/thread.cc

diff --git a/cpukit/include/rtems/c++/error b/cpukit/include/rtems/c++/error
new file mode 100644
index 00..8b9d875e0f
--- /dev/null
+++ b/cpukit/include/rtems/c++/error
@@ -0,0 +1,65 @@
+/* -*- C++ -*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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.
+ */
+/**
+ * @file
+ *
+ * @ingroup RTEMSC++
+ *
+ * RTEMS Error exception.
+ */
+
+#if !defined(RTEMS_CXX_ERROR)
+#define RTEMS_CXX_ERROR
+
+#include 
+#include 
+
+#include 
+
+namespace rtems
+{
+  class runtime_error :
+public std::runtime_error
+  {
+const rtems_status_code sc;
+  public:
+runtime_error (const rtems_status_code sc);
+runtime_error (const rtems_status_code sc, const std::string& what);
+runtime_error (const rtems_status_code sc, const char* what);
+~runtime_error ();
+  };
+
+  /**
+   * Throw a rtems::runtime_error exception if the RTEMS status code is
+   * not RTEMS_SUCCESSFUL.
+   */
+  void runtime_error_check (const rtems_status_code sc);
+  void runtime_error_check (const rtems_status_code sc, const std::string& 
what);
+  void runtime_error_check (const rtems_status_code sc, const char* what);
+};
+
+#endif
diff --git a/cpukit/include/rtems/c++/thread b/cpukit/include/rtems/c++/thread
new file mode 100644
index 00..c3f18ab3cf
--- /dev/null
+++ b/cpukit/include/rtems/c++/thread
@@ -0,0 +1,469 @@
+/* -*- C++ -*-
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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, INCID

[PATCH v5] cpukit/librcxx: Add a C++ thread interface with attributes

2020-10-05 Thread chrisj
From: Chris Johns 

---
 cpukit/include/rtems/c++/error|  69 
 cpukit/include/rtems/c++/thread   | 476 ++
 cpukit/librtemscxx/error.cc   |  76 
 cpukit/librtemscxx/thread.cc  | 416 +++
 spec/build/cpukit/grp.yml |   2 +
 spec/build/cpukit/librtemscxx.yml |  21 +
 spec/build/testsuites/libtests/grp.yml|   2 +
 spec/build/testsuites/libtests/rcxx01.yml |  22 +
 testsuites/libtests/rcxx01/init.c |  89 
 testsuites/libtests/rcxx01/rcxx01.doc |  16 +
 testsuites/libtests/rcxx01/rcxx01.scn |  13 +
 testsuites/libtests/rcxx01/thread.cc  | 110 +
 12 files changed, 1312 insertions(+)
 create mode 100644 cpukit/include/rtems/c++/error
 create mode 100644 cpukit/include/rtems/c++/thread
 create mode 100644 cpukit/librtemscxx/error.cc
 create mode 100644 cpukit/librtemscxx/thread.cc
 create mode 100644 spec/build/cpukit/librtemscxx.yml
 create mode 100644 spec/build/testsuites/libtests/rcxx01.yml
 create mode 100644 testsuites/libtests/rcxx01/init.c
 create mode 100644 testsuites/libtests/rcxx01/rcxx01.doc
 create mode 100644 testsuites/libtests/rcxx01/rcxx01.scn
 create mode 100644 testsuites/libtests/rcxx01/thread.cc

diff --git a/cpukit/include/rtems/c++/error b/cpukit/include/rtems/c++/error
new file mode 100644
index 00..6b973f68e6
--- /dev/null
+++ b/cpukit/include/rtems/c++/error
@@ -0,0 +1,69 @@
+/* -*- C++ -*- */
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSC++
+ *
+ * @brief RTEMS Error exception.
+ *
+ * Provide an error exception for RTEMS errors.
+ */
+
+/*
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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.
+ */
+
+#if !defined(RTEMS_CXX_ERROR)
+#define RTEMS_CXX_ERROR
+
+#include 
+#include 
+
+#include 
+
+namespace rtems
+{
+  class runtime_error :
+public std::runtime_error
+  {
+const rtems_status_code sc;
+  public:
+runtime_error (const rtems_status_code sc);
+runtime_error (const rtems_status_code sc, const std::string& what);
+runtime_error (const rtems_status_code sc, const char* what);
+~runtime_error ();
+  };
+
+  /**
+   * Throw a rtems::runtime_error exception if the RTEMS status code is
+   * not RTEMS_SUCCESSFUL.
+   */
+  void runtime_error_check (const rtems_status_code sc);
+  void runtime_error_check (const rtems_status_code sc, const std::string& 
what);
+  void runtime_error_check (const rtems_status_code sc, const char* what);
+};
+
+#endif
diff --git a/cpukit/include/rtems/c++/thread b/cpukit/include/rtems/c++/thread
new file mode 100644
index 00..5815a86252
--- /dev/null
+++ b/cpukit/include/rtems/c++/thread
@@ -0,0 +1,476 @@
+/* -*- C++ -*- */
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSC++
+ *
+ * @brief C++ standard thread support with thread attribute control.
+ *
+ * Provide a way to create a thread in C++ with attributes that let
+ * you control the real-time embedded parameters need to run
+ * threads on RTEMS.
+ *
+ * The code requires the `-std=c++17` option to access `std::invoke()`.
+ */
+
+/*
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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
+

Update 4.11 RSB to work with python 3 and python 2

2020-10-05 Thread chrisj
Hello,

This change backports the RSB python source from master to 4.11 so
4.11 can be maintained on newer hosts.

GDB has been updated to 9.1 for the architectures that can support it.
The SPARC architecture has been lift at 7.9 with building with python
been disabled.

Builds on Ubuntu 20 and FreeBSD. FreeBSD has been tested with
Python 2 and Python 3

Chris

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


[PATCH v6] cpukit/librcxx: Add a C++ thread interface with attributes

2020-10-06 Thread chrisj
From: Chris Johns 

---
 cpukit/include/rtems/error.hpp|  68 +++
 cpukit/include/rtems/thread.hpp   | 477 ++
 cpukit/librtemscxx/error.cpp  |  76 
 cpukit/librtemscxx/thread.cpp | 416 +++
 spec/build/cpukit/grp.yml |   2 +
 spec/build/cpukit/librtemscxx.yml |  21 +
 spec/build/testsuites/libtests/grp.yml|   2 +
 spec/build/testsuites/libtests/rcxx01.yml |  22 +
 testsuites/libtests/rcxx01/init.c |  89 
 testsuites/libtests/rcxx01/rcxx01.doc |  16 +
 testsuites/libtests/rcxx01/rcxx01.scn |  13 +
 testsuites/libtests/rcxx01/thread.cpp | 110 +
 12 files changed, 1312 insertions(+)
 create mode 100644 cpukit/include/rtems/error.hpp
 create mode 100644 cpukit/include/rtems/thread.hpp
 create mode 100644 cpukit/librtemscxx/error.cpp
 create mode 100644 cpukit/librtemscxx/thread.cpp
 create mode 100644 spec/build/cpukit/librtemscxx.yml
 create mode 100644 spec/build/testsuites/libtests/rcxx01.yml
 create mode 100644 testsuites/libtests/rcxx01/init.c
 create mode 100644 testsuites/libtests/rcxx01/rcxx01.doc
 create mode 100644 testsuites/libtests/rcxx01/rcxx01.scn
 create mode 100644 testsuites/libtests/rcxx01/thread.cpp

diff --git a/cpukit/include/rtems/error.hpp b/cpukit/include/rtems/error.hpp
new file mode 100644
index 00..a62ee966c6
--- /dev/null
+++ b/cpukit/include/rtems/error.hpp
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSC++
+ *
+ * @brief RTEMS Error exception.
+ *
+ * Provide an error exception for RTEMS errors.
+ */
+
+/*
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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.
+ */
+
+#if !defined(RTEMS_ERROR_HPP)
+#define RTEMS_ERROR_HPP
+
+#include 
+#include 
+
+#include 
+
+namespace rtems
+{
+  class runtime_error :
+public std::runtime_error
+  {
+const rtems_status_code sc;
+  public:
+runtime_error (const rtems_status_code sc);
+runtime_error (const rtems_status_code sc, const std::string& what);
+runtime_error (const rtems_status_code sc, const char* what);
+~runtime_error ();
+  };
+
+  /**
+   * Throw a rtems::runtime_error exception if the RTEMS status code is
+   * not RTEMS_SUCCESSFUL.
+   */
+  void runtime_error_check (const rtems_status_code sc);
+  void runtime_error_check (const rtems_status_code sc, const std::string& 
what);
+  void runtime_error_check (const rtems_status_code sc, const char* what);
+};
+
+#endif
diff --git a/cpukit/include/rtems/thread.hpp b/cpukit/include/rtems/thread.hpp
new file mode 100644
index 00..e90e664dfa
--- /dev/null
+++ b/cpukit/include/rtems/thread.hpp
@@ -0,0 +1,477 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSC++
+ *
+ * @brief C++ standard thread support with thread attribute control.
+ *
+ * Provide a way to create a thread in C++ with attributes that let
+ * you control the real-time embedded parameters need to run
+ * threads on RTEMS.
+ *
+ * The code requires the `-std=c++17` option to access `std::invoke()`.
+ */
+
+/*
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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 mat

[PATCH 2/2] testsuite/rcxx01: Add examples for use in the User manual

2020-10-08 Thread chrisj
From: Chris Johns 

---
 spec/build/testsuites/libtests/rcxx01.yml |   3 +
 testsuites/libtests/rcxx01/init.c |   2 +-
 testsuites/libtests/rcxx01/thread.cpp |  21 +++-
 testsuites/libtests/rcxx01/user-example-1.cpp |  49 
 testsuites/libtests/rcxx01/user-example-2.cpp |  68 +++
 testsuites/libtests/rcxx01/user-example-3.cpp | 113 ++
 6 files changed, 251 insertions(+), 5 deletions(-)
 create mode 100644 testsuites/libtests/rcxx01/user-example-1.cpp
 create mode 100644 testsuites/libtests/rcxx01/user-example-2.cpp
 create mode 100644 testsuites/libtests/rcxx01/user-example-3.cpp

diff --git a/spec/build/testsuites/libtests/rcxx01.yml 
b/spec/build/testsuites/libtests/rcxx01.yml
index 864ad4d9d6..49bd9cff66 100644
--- a/spec/build/testsuites/libtests/rcxx01.yml
+++ b/spec/build/testsuites/libtests/rcxx01.yml
@@ -13,6 +13,9 @@ links: []
 source:
 - testsuites/libtests/rcxx01/init.c
 - testsuites/libtests/rcxx01/thread.cpp
+- testsuites/libtests/rcxx01/user-example-1.cpp
+- testsuites/libtests/rcxx01/user-example-2.cpp
+- testsuites/libtests/rcxx01/user-example-3.cpp
 stlib: []
 target: testsuites/libtests/rcxx01.exe
 type: build
diff --git a/testsuites/libtests/rcxx01/init.c 
b/testsuites/libtests/rcxx01/init.c
index 87d3155c7f..bea71d14c7 100644
--- a/testsuites/libtests/rcxx01/init.c
+++ b/testsuites/libtests/rcxx01/init.c
@@ -72,7 +72,7 @@ rtems_task Init(
 #define CONFIGURE_MEMORY_OVERHEAD (2024)
 
 #define CONFIGURE_MAXIMUM_TASKS  1
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 5
 
 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
 
diff --git a/testsuites/libtests/rcxx01/thread.cpp 
b/testsuites/libtests/rcxx01/thread.cpp
index 05a9de8c48..f977a340a9 100644
--- a/testsuites/libtests/rcxx01/thread.cpp
+++ b/testsuites/libtests/rcxx01/thread.cpp
@@ -36,6 +36,10 @@ using namespace std::chrono_literals;
 
 extern "C" void rcxx_run_test(void);
 
+void example_1();
+void example_2();
+void example_3();
+
 struct test_thread
 {
   test_thread();
@@ -96,13 +100,22 @@ bool test_thread::running()
   return finished == false;
 }
 
+void test_1()
+{
+  test_thread tt;
+  tt.start();
+  while (tt.running())
+std::this_thread::sleep_for(1s);
+}
+
 void rcxx_run_test(void)
 {
   try {
-test_thread tt;
-tt.start();
-while (tt.running())
-  std::this_thread::sleep_for(1s);
+test_1();
+/* From the user manual */
+example_1();
+example_2();
+example_3();
   } catch (...) {
 std::cout << "Thread: ouch" << std::endl;
 throw;
diff --git a/testsuites/libtests/rcxx01/user-example-1.cpp 
b/testsuites/libtests/rcxx01/user-example-1.cpp
new file mode 100644
index 00..dfc0992193
--- /dev/null
+++ b/testsuites/libtests/rcxx01/user-example-1.cpp
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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 
+
+static void wait_for(size_t seconds)
+{
+  while (seconds--) {
+std::this_thread::sleep_for(std::chrono::seconds(1));
+std::cout << "Seconds: " << seconds << std::endl;
+  }
+}
+
+void example_1()
+{
+  std::cout << "Start example 1" << std::endl;
+
+  rtems::thread::thread t(wait_for, 5);
+  t.join();
+
+  std::cout << "End example 1" << std::endl;
+}
diff --git a/testsuites/libtests/rcxx01/user-example-2.cpp 
b/testsuites/libtests/rcxx01/user-example-2.cpp
new file mode 100644
index 00..05090fc73c
--- /dev/null
+++ b/testsuites/libtests/rcxx01/user-example-2.cpp
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * C

[PATCH 1/2] librtemsc++: Add join() and detach() to the thread

2020-10-08 Thread chrisj
From: Chris Johns 

- Do not start threads detached
---
 cpukit/include/rtems/thread.hpp |  4 
 cpukit/librtemscxx/thread.cpp   | 22 ++
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/cpukit/include/rtems/thread.hpp b/cpukit/include/rtems/thread.hpp
index e90e664dfa..2c4899dc0b 100644
--- a/cpukit/include/rtems/thread.hpp
+++ b/cpukit/include/rtems/thread.hpp
@@ -321,6 +321,10 @@ namespace rtems
 
   bool joinable() const noexcept;
 
+  void join() noexcept;
+
+  void detach() noexcept;
+
   /*
* Constrain use. These are not available.
*/
diff --git a/cpukit/librtemscxx/thread.cpp b/cpukit/librtemscxx/thread.cpp
index 11bf3df230..ae13201bd4 100644
--- a/cpukit/librtemscxx/thread.cpp
+++ b/cpukit/librtemscxx/thread.cpp
@@ -346,6 +346,24 @@ namespace rtems
   return !(id_ == id());
 }
 
+void
+thread::join() noexcept
+{
+  if (!joinable())
+system_error_check (ENOMEM, "join");
+  system_error_check (::pthread_join (id_.id_, nullptr), "join");
+  id_ = id();
+}
+
+void
+thread::detach() noexcept
+{
+  if (!joinable())
+system_error_check (EINVAL, "detach");
+  system_error_check (::pthread_detach (id_.id_), "detach");
+  id_ = id();
+}
+
 thread::state_base::~state_base () = default;
 
 void
@@ -358,10 +376,6 @@ namespace rtems
   system_error_check (::pthread_attr_init (&pattr),
   "attribute init");
 
-  system_error_check (::pthread_attr_setdetachstate (&pattr,
- 
PTHREAD_CREATE_DETACHED),
-  "set detached state");
-
   struct sched_param param;
   param.sched_priority = attr.get_priority ();
   system_error_check (::pthread_attr_setschedparam (&pattr, ¶m),
-- 
2.24.1

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


[PATCH v2 1/3] librtemscxx: Add join() and detach() to the thread

2020-10-08 Thread chrisj
From: Chris Johns 

- Do not start threads detached
---
 cpukit/include/rtems/thread.hpp |  4 +++
 cpukit/librtemscxx/error.cpp|  9 ---
 cpukit/librtemscxx/thread.cpp   | 44 -
 3 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/cpukit/include/rtems/thread.hpp b/cpukit/include/rtems/thread.hpp
index e90e664dfa..fb408f60c0 100644
--- a/cpukit/include/rtems/thread.hpp
+++ b/cpukit/include/rtems/thread.hpp
@@ -321,6 +321,10 @@ namespace rtems
 
   bool joinable() const noexcept;
 
+  void join();
+
+  void detach();
+
   /*
* Constrain use. These are not available.
*/
diff --git a/cpukit/librtemscxx/error.cpp b/cpukit/librtemscxx/error.cpp
index ba46a8c2a5..8723856ac9 100644
--- a/cpukit/librtemscxx/error.cpp
+++ b/cpukit/librtemscxx/error.cpp
@@ -56,21 +56,24 @@ namespace rtems
   void
   runtime_error_check (const rtems_status_code sc)
   {
-if (sc != RTEMS_SUCCESSFUL)
+if (sc != RTEMS_SUCCESSFUL) {
   throw runtime_error (sc);
+}
   }
 
   void
   runtime_error_check (const rtems_status_code sc, const std::string& what)
   {
-if (sc != RTEMS_SUCCESSFUL)
+if (sc != RTEMS_SUCCESSFUL) {
   throw runtime_error (sc, what);
+}
   }
 
   void
   runtime_error_check (const rtems_status_code sc, const char* what)
   {
-if (sc != RTEMS_SUCCESSFUL)
+if (sc != RTEMS_SUCCESSFUL) {
   throw runtime_error (sc, what);
+}
   }
 };
diff --git a/cpukit/librtemscxx/thread.cpp b/cpukit/librtemscxx/thread.cpp
index 11bf3df230..7ef9d6ac30 100644
--- a/cpukit/librtemscxx/thread.cpp
+++ b/cpukit/librtemscxx/thread.cpp
@@ -60,8 +60,9 @@ namespace rtems
 void
 system_error_check (int ec, const char* what)
 {
-  if (ec != 0)
+  if (ec != 0) {
 throw std::system_error (ec, std::system_category(), what);
+  }
 }
 
 attributes::attributes ()
@@ -206,8 +207,9 @@ namespace rtems
   if (!scheduler.empty ()) {
 char sname[4] = { ' ', ' ', ' ', ' ' };
 for (size_t c = 0; c < sizeof (sname); ++c) {
-  if (c >= scheduler.length ())
+  if (c >= scheduler.length ()) {
 break;
+  }
   sname[c] = scheduler[c];
 }
 rtems_name scheduler_name = rtems_build_name (sname[0],
@@ -285,8 +287,9 @@ namespace rtems
   runtime_error_check (::rtems_task_get_scheduler (RTEMS_SELF, 
&scheduler_id));
 #if HAVE_GET_SCHEDULER_NAME
   char name[5];
-  if (!get_scheduler_name (scheduler_id, &name[0]))
+  if (!get_scheduler_name (scheduler_id, &name[0])) {
 system_error_check (ENOENT, "get scheduler name");
+  }
   scheduler = name;
 #endif
 }
@@ -328,8 +331,9 @@ namespace rtems
 thread&
 thread::operator= (thread&& thread_)
 {
-  if (joinable ())
+  if (joinable ()) {
 std::terminate ();
+  }
   swap(thread_);
   return *this;
 }
@@ -346,6 +350,26 @@ namespace rtems
   return !(id_ == id());
 }
 
+void
+thread::join()
+{
+  if (!joinable()) {
+system_error_check (EINVAL, "join");
+  }
+  system_error_check (::pthread_join (id_.id_, nullptr), "join");
+  id_ = id();
+}
+
+void
+thread::detach()
+{
+  if (!joinable()) {
+system_error_check (EINVAL, "detach");
+  }
+  system_error_check (::pthread_detach (id_.id_), "detach");
+  id_ = id();
+}
+
 thread::state_base::~state_base () = default;
 
 void
@@ -358,14 +382,10 @@ namespace rtems
   system_error_check (::pthread_attr_init (&pattr),
   "attribute init");
 
-  system_error_check (::pthread_attr_setdetachstate (&pattr,
- 
PTHREAD_CREATE_DETACHED),
-  "set detached state");
-
   struct sched_param param;
   param.sched_priority = attr.get_priority ();
   system_error_check (::pthread_attr_setschedparam (&pattr, ¶m),
-  "set ");
+  "set sched param");
 
   int spolicy;
   switch (attr.get_scheduler_policy ()) {
@@ -385,10 +405,12 @@ namespace rtems
   system_error_check (::pthread_attr_setschedpolicy (&pattr, spolicy),
   "set scheduler policy");
 
-  if (attr.get_scheduler_attr () == attributes::sched_inherit)
+  if (attr.get_scheduler_attr () == attributes::sched_inherit) {
 ::pthread_attr_setinheritsched (&pattr, PTHREAD_INHERIT_SCHED);
-  else
+  }
+  else {
 ::pthread_attr_setinheritsched (&pattr, PTHREAD_EXPLICIT_SCHED);
+  }
 
   system_error_check (::pthread_attr_setstacksize(&pattr,
   attr.get_stack_size ()),
-- 
2.24.1

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


[PATCH v2 3/3] testsuite/rcxx01: Add examples for use in the User manual

2020-10-08 Thread chrisj
From: Chris Johns 

---
 spec/build/testsuites/libtests/rcxx01.yml |   3 +
 testsuites/libtests/rcxx01/init.c |   2 +-
 testsuites/libtests/rcxx01/thread.cpp |  21 +++-
 testsuites/libtests/rcxx01/user-example-1.cpp |  49 
 testsuites/libtests/rcxx01/user-example-2.cpp |  68 +++
 testsuites/libtests/rcxx01/user-example-3.cpp | 113 ++
 6 files changed, 251 insertions(+), 5 deletions(-)
 create mode 100644 testsuites/libtests/rcxx01/user-example-1.cpp
 create mode 100644 testsuites/libtests/rcxx01/user-example-2.cpp
 create mode 100644 testsuites/libtests/rcxx01/user-example-3.cpp

diff --git a/spec/build/testsuites/libtests/rcxx01.yml 
b/spec/build/testsuites/libtests/rcxx01.yml
index 864ad4d9d6..49bd9cff66 100644
--- a/spec/build/testsuites/libtests/rcxx01.yml
+++ b/spec/build/testsuites/libtests/rcxx01.yml
@@ -13,6 +13,9 @@ links: []
 source:
 - testsuites/libtests/rcxx01/init.c
 - testsuites/libtests/rcxx01/thread.cpp
+- testsuites/libtests/rcxx01/user-example-1.cpp
+- testsuites/libtests/rcxx01/user-example-2.cpp
+- testsuites/libtests/rcxx01/user-example-3.cpp
 stlib: []
 target: testsuites/libtests/rcxx01.exe
 type: build
diff --git a/testsuites/libtests/rcxx01/init.c 
b/testsuites/libtests/rcxx01/init.c
index 87d3155c7f..bea71d14c7 100644
--- a/testsuites/libtests/rcxx01/init.c
+++ b/testsuites/libtests/rcxx01/init.c
@@ -72,7 +72,7 @@ rtems_task Init(
 #define CONFIGURE_MEMORY_OVERHEAD (2024)
 
 #define CONFIGURE_MAXIMUM_TASKS  1
-#define CONFIGURE_MAXIMUM_POSIX_THREADS 2
+#define CONFIGURE_MAXIMUM_POSIX_THREADS 5
 
 #define CONFIGURE_INITIAL_EXTENSIONS RTEMS_TEST_INITIAL_EXTENSION
 
diff --git a/testsuites/libtests/rcxx01/thread.cpp 
b/testsuites/libtests/rcxx01/thread.cpp
index 05a9de8c48..f977a340a9 100644
--- a/testsuites/libtests/rcxx01/thread.cpp
+++ b/testsuites/libtests/rcxx01/thread.cpp
@@ -36,6 +36,10 @@ using namespace std::chrono_literals;
 
 extern "C" void rcxx_run_test(void);
 
+void example_1();
+void example_2();
+void example_3();
+
 struct test_thread
 {
   test_thread();
@@ -96,13 +100,22 @@ bool test_thread::running()
   return finished == false;
 }
 
+void test_1()
+{
+  test_thread tt;
+  tt.start();
+  while (tt.running())
+std::this_thread::sleep_for(1s);
+}
+
 void rcxx_run_test(void)
 {
   try {
-test_thread tt;
-tt.start();
-while (tt.running())
-  std::this_thread::sleep_for(1s);
+test_1();
+/* From the user manual */
+example_1();
+example_2();
+example_3();
   } catch (...) {
 std::cout << "Thread: ouch" << std::endl;
 throw;
diff --git a/testsuites/libtests/rcxx01/user-example-1.cpp 
b/testsuites/libtests/rcxx01/user-example-1.cpp
new file mode 100644
index 00..dfc0992193
--- /dev/null
+++ b/testsuites/libtests/rcxx01/user-example-1.cpp
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * Copyright (C) 2020 Chris Johns (http://contemporary.software)
+ *
+ * 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 
+
+static void wait_for(size_t seconds)
+{
+  while (seconds--) {
+std::this_thread::sleep_for(std::chrono::seconds(1));
+std::cout << "Seconds: " << seconds << std::endl;
+  }
+}
+
+void example_1()
+{
+  std::cout << "Start example 1" << std::endl;
+
+  rtems::thread::thread t(wait_for, 5);
+  t.join();
+
+  std::cout << "End example 1" << std::endl;
+}
diff --git a/testsuites/libtests/rcxx01/user-example-2.cpp 
b/testsuites/libtests/rcxx01/user-example-2.cpp
new file mode 100644
index 00..05090fc73c
--- /dev/null
+++ b/testsuites/libtests/rcxx01/user-example-2.cpp
@@ -0,0 +1,68 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * C

[PATCH v2 2/3] librtemscxx: Fix white space to match the coding standard

2020-10-08 Thread chrisj
From: Chris Johns 

---
 cpukit/include/rtems/error.hpp  |  14 +-
 cpukit/include/rtems/thread.hpp | 144 ++--
 cpukit/librtemscxx/error.cpp|  34 ++---
 cpukit/librtemscxx/thread.cpp   | 224 
 4 files changed, 208 insertions(+), 208 deletions(-)

diff --git a/cpukit/include/rtems/error.hpp b/cpukit/include/rtems/error.hpp
index a62ee966c6..cb705826d4 100644
--- a/cpukit/include/rtems/error.hpp
+++ b/cpukit/include/rtems/error.hpp
@@ -50,19 +50,19 @@ namespace rtems
   {
 const rtems_status_code sc;
   public:
-runtime_error (const rtems_status_code sc);
-runtime_error (const rtems_status_code sc, const std::string& what);
-runtime_error (const rtems_status_code sc, const char* what);
-~runtime_error ();
+runtime_error(const rtems_status_code sc);
+runtime_error(const rtems_status_code sc, const std::string& what);
+runtime_error(const rtems_status_code sc, const char* what);
+~runtime_error();
   };
 
   /**
* Throw a rtems::runtime_error exception if the RTEMS status code is
* not RTEMS_SUCCESSFUL.
*/
-  void runtime_error_check (const rtems_status_code sc);
-  void runtime_error_check (const rtems_status_code sc, const std::string& 
what);
-  void runtime_error_check (const rtems_status_code sc, const char* what);
+  void runtime_error_check(const rtems_status_code sc);
+  void runtime_error_check(const rtems_status_code sc, const std::string& 
what);
+  void runtime_error_check(const rtems_status_code sc, const char* what);
 };
 
 #endif
diff --git a/cpukit/include/rtems/thread.hpp b/cpukit/include/rtems/thread.hpp
index fb408f60c0..cdef690740 100644
--- a/cpukit/include/rtems/thread.hpp
+++ b/cpukit/include/rtems/thread.hpp
@@ -83,14 +83,14 @@ namespace rtems
* executing thread. The stack size is set to the configured minimum
* stack size.
*/
-  attributes ();
+  attributes();
 
   /*
* Copy construct the thread attributes.
*
* @param attr The attributes to copy.
*/
-  attributes (const attributes& attr);
+  attributes(const attributes& attr);
 
   /**
* Set the name of the thread. The thread is a classic API thread and
@@ -98,7 +98,7 @@ namespace rtems
*
* @param name The name as a string.
*/
-  void set_name (const std::string& name);
+  void set_name(const std::string& name);
 
   /**
* Set the name of the thread. The thread is a classic API thread and
@@ -106,28 +106,28 @@ namespace rtems
*
* @param name The name as a string.
*/
-  void set_name (const char* name);
+  void set_name(const char* name);
 
   /**
* Get the name of the thread.
*
* @retval const std::string& The name of the thread.
*/
-  const std::string& get_name () const;
+  const std::string& get_name() const;
 
   /**
* Set the priority of the thread.
*
* @param priority The POSIX API priority of the thread.
*/
-  void set_priority (int priority);
+  void set_priority(int priority);
 
   /**
* Get the POSIX API priority of the thread.
*
* @retval int The POSIX API thread priority.
*/
-  int get_priority () const;
+  int get_priority() const;
 
   /**
* Set the stack size. If the size is less than the configured minimum
@@ -135,38 +135,38 @@ namespace rtems
*
* @param size The stack size in bytes.
*/
-  void set_stack_size (size_t size);
+  void set_stack_size(size_t size);
 
   /**
* Get the stack size.
*
* @retval size_t The stack size in bytes.
*/
-  size_t get_stack_size () const;
+  size_t get_stack_size() const;
 
   /**
* Set the scheduler name. If not set no scheduler is set.
*
* @parrm scheduler The name of the scheduler.
*/
-  void set_scheduler (const std::string& scheduler);
+  void set_scheduler(const std::string& scheduler);
 
   /**
* Set the scheduler name. If not set no scheduler is set.
*/
-  void set_scheduler (const char* scheduler);
+  void set_scheduler(const char* scheduler);
 
   /**
* Get scheduler name.
*/
-  const std::string& get_scheduler ();
+  const std::string& get_scheduler();
 
   /**
* Get the attributes' scheduler attribute for the thread.
*
* @return sched_attr The attributes' scheduler attribute
*/
-  sched_attr get_scheduler_attr () const;
+  sched_attr get_scheduler_attr() const;
 
   /**
* Set the scheduler policy for the thread. This call sets the
@@ -174,12 +174,12 @@ namespace rtems
*
* @param policy The scheduler policy.
*/
-  void set_scheduler_policy (sched_policy policy);
+  void set_scheduler_policy(sched_policy policy);
 

[PATCH] user: Add a Languages section

2020-10-08 Thread chrisj
From: Chris Johns 

---
 user/index.rst   |   2 +
 user/languages/c.rst |  14 ++
 user/languages/cpp.rst   | 312 +++
 user/languages/index.rst |  21 +++
 4 files changed, 349 insertions(+)
 create mode 100644 user/languages/c.rst
 create mode 100644 user/languages/cpp.rst
 create mode 100644 user/languages/index.rst

diff --git a/user/index.rst b/user/index.rst
index a91aa55..32667f4 100644
--- a/user/index.rst
+++ b/user/index.rst
@@ -42,6 +42,8 @@ RTEMS User Manual (|version|).
 bld/index
 bsps/index
 
+languages/index
+
 exe/index
 testing/index
 tracing/index
diff --git a/user/languages/c.rst b/user/languages/c.rst
new file mode 100644
index 000..c3965eb
--- /dev/null
+++ b/user/languages/c.rst
@@ -0,0 +1,14 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 Chris Johns 
+
+.. index:: C
+.. index:: C Programming Language
+
+C
+=
+.. index:: C
+
+RTEMS supports the C programming language.
+
+TBD.
diff --git a/user/languages/cpp.rst b/user/languages/cpp.rst
new file mode 100644
index 000..8a8cb86
--- /dev/null
+++ b/user/languages/cpp.rst
@@ -0,0 +1,312 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 Chris Johns 
+
+.. index:: C++
+.. index:: C++ Programming Language
+
+C++
+===
+.. index:: C++
+
+RTEMS supports the C++ programming language and its standard library. The
+supported language versions are C++11, C++14, and C++17.
+
+The C++ standard library provides a rich set of interfaces to support
+multi-threaded programming. The Thread support library provides
+``std::lock_guard`` as a means to manage ``std::mutex`` or similar objects
+within a code block while execution remains within that block. The
+``std::promise`` and ``std::future`` supports provides a controlled means for
+threads to end, clean-up and return a status value of some type. The Atomic
+operations library provdes a range of methods to atomically acess data as well
+as establish inter-thread synchronization and order non-atomic memory
+accesses.
+
+The Thread support library maps to the RTEMS POSIX ``pthread`` interface and
+the various sychronisation primatives such as mutual exclusion, condition
+variables, and futures map to the high performance self-contained RTEMS
+interface. These objects have a fast execution profile and their storage is
+self-contained which means it does not have to be accounted for in the
+configuration and work-space settings. C++ applications do not need to be
+concerned about the number of locks being used and can implement fine grain
+locking protocols.
+
+RTEMS Threads
+-
+
+RTEMS provides an alternative Thread interface that lets you specify the
+attributes of a thread when it is constructed. This is an extension to the
+standard and is not based on any current or pending standards efforts. The
+goal is to make the interface as close as possible to the existing standard to
+minimise the impact on code being ported to RTEMS.
+
+The following compiler option must be used as the implementation uses the
+``std::invoke`` call which is only available with C++17:
+
+.. code-block:: c++
+
+   --std=c++17
+
+The standard Thread support library specifies the thread constructor as:
+
+.. code-block:: c++
+
+   template< class Function, class... Args >
+   explicit thread( Function&& f, Args&&... args );
+
+A thread constructed using this interface will have a default set of initial
+values. An important atribute of a thread is the stack size and this cannot be
+specified or altered with this interface. On Unix systems virtual memory can
+be used to manage a thread's stack size and stack handling is more complex
+when security is considered so manually controlling the stack size of a thread
+is not needed or wanted.
+
+Attributes
+^^
+
+The ``rtems::thread::attributes`` class provides an interface to control the
+various attributes a thread has. The header file is:
+
+.. code-block:: c++
+
+   #include 
+
+The default constructor initialises the attributes to the executing thread's
+settings and the stack size is set to the configured minimum. You can then
+alter the attributes to match the requirements of the new thread. It is easy
+to set a name, stack size and priority:
+
+.. code-block:: c++
+
+   rtems::thread::attribute attr;
+   attr.set_name("blue");
+   attr.set_stack_size(16 * 1024);
+   attr.set_priority(attr.get_priority() + 1);
+
+The ``update()`` method will read the attributes of the currently executing
+thread and update the attribute instance making the call. The stack size is
+not read and updated, there is no public interface in RTEMS to obtain the
+executing thread's stack size.
+
+An attribute object can be used to start a number of threads. The thread does
+not referenced the attribute object once running.
+
+An attribute object can be used to alter an attribute of a thread after it has
+started by calling the ``commit()`` method. The ``commit()`` method

[PATCH] libfs/rfs: Check search bit map end on last bit

2020-10-14 Thread chrisj
From: Chris Johns 

- Do not write past the last location of the search bit map
  whe nit is being created.

Closes #4148
---
 cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c 
b/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c
index 7973e85083..6da555d50e 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c
@@ -34,6 +34,12 @@
 #include 
 #include 
 
+#define rtems_rfs_bitmap_check(_c, _sm) \
+   _Assert(_sm >= _c->search_bits && \
+   _sm < (_c->search_bits + \
+ rtems_rfs_bitmap_elements(rtems_rfs_bitmap_elements(_c->size
+
+
 /**
  * Test a bit in an element. If set return true else return false.
  *
@@ -220,6 +226,7 @@ rtems_rfs_bitmap_map_set (rtems_rfs_bitmap_control* control,
 index  = rtems_rfs_bitmap_map_index (bit);
 offset = rtems_rfs_bitmap_map_offset (bit);
 search_map[index] = rtems_rfs_bitmap_set (search_map[index], 1 << offset);
+rtems_rfs_bitmap_check(control, &search_map[index]);
   }
 
   return 0;
@@ -260,6 +267,7 @@ rtems_rfs_bitmap_map_clear (rtems_rfs_bitmap_control* 
control,
   index = rtems_rfs_bitmap_map_index (bit);
   offset= rtems_rfs_bitmap_map_offset(bit);
   search_map[index] = rtems_rfs_bitmap_clear (search_map[index], 1 << offset);
+  rtems_rfs_bitmap_check(control, &search_map[index]);
   rtems_rfs_buffer_mark_dirty (control->buffer);
   control->free++;
 
@@ -599,6 +607,7 @@ rtems_rfs_bitmap_create_search (rtems_rfs_bitmap_control* 
control)
   size = control->size;
   bit = 0;
 
+  rtems_rfs_bitmap_check(control, search_map);
   *search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR;
   while (size)
   {
@@ -633,8 +642,12 @@ rtems_rfs_bitmap_create_search (rtems_rfs_bitmap_control* 
control)
 if (bit == (rtems_rfs_bitmap_element_bits () - 1))
 {
   bit = 0;
-  search_map++;
-  *search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR;
+  if (size > 0)
+  {
+search_map++;
+rtems_rfs_bitmap_check(control, search_map);
+*search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR;
+  }
 }
 else
   bit++;
-- 
2.24.1

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


[PATCH 5] libfs/rfs: Check search bit map end on last bit

2020-10-14 Thread chrisj
From: Chris Johns 

- Do not write past the last location of the search bit map
  whe nit is being created.

Closes #4149
---
 cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c 
b/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c
index 7973e85083..6da555d50e 100644
--- a/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c
+++ b/cpukit/libfs/src/rfs/rtems-rfs-bitmaps.c
@@ -34,6 +34,12 @@
 #include 
 #include 
 
+#define rtems_rfs_bitmap_check(_c, _sm) \
+   _Assert(_sm >= _c->search_bits && \
+   _sm < (_c->search_bits + \
+ rtems_rfs_bitmap_elements(rtems_rfs_bitmap_elements(_c->size
+
+
 /**
  * Test a bit in an element. If set return true else return false.
  *
@@ -220,6 +226,7 @@ rtems_rfs_bitmap_map_set (rtems_rfs_bitmap_control* control,
 index  = rtems_rfs_bitmap_map_index (bit);
 offset = rtems_rfs_bitmap_map_offset (bit);
 search_map[index] = rtems_rfs_bitmap_set (search_map[index], 1 << offset);
+rtems_rfs_bitmap_check(control, &search_map[index]);
   }
 
   return 0;
@@ -260,6 +267,7 @@ rtems_rfs_bitmap_map_clear (rtems_rfs_bitmap_control* 
control,
   index = rtems_rfs_bitmap_map_index (bit);
   offset= rtems_rfs_bitmap_map_offset(bit);
   search_map[index] = rtems_rfs_bitmap_clear (search_map[index], 1 << offset);
+  rtems_rfs_bitmap_check(control, &search_map[index]);
   rtems_rfs_buffer_mark_dirty (control->buffer);
   control->free++;
 
@@ -599,6 +607,7 @@ rtems_rfs_bitmap_create_search (rtems_rfs_bitmap_control* 
control)
   size = control->size;
   bit = 0;
 
+  rtems_rfs_bitmap_check(control, search_map);
   *search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR;
   while (size)
   {
@@ -633,8 +642,12 @@ rtems_rfs_bitmap_create_search (rtems_rfs_bitmap_control* 
control)
 if (bit == (rtems_rfs_bitmap_element_bits () - 1))
 {
   bit = 0;
-  search_map++;
-  *search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR;
+  if (size > 0)
+  {
+search_map++;
+rtems_rfs_bitmap_check(control, search_map);
+*search_map = RTEMS_RFS_BITMAP_ELEMENT_CLEAR;
+  }
 }
 else
   bit++;
-- 
2.24.1

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


[PATCH v2] user: Add a Languages section

2020-10-18 Thread chrisj
From: Chris Johns 

---
 user/index.rst   |   2 +
 user/languages/c.rst |  18 +++
 user/languages/cpp.rst   | 312 +++
 user/languages/index.rst |  24 +++
 4 files changed, 356 insertions(+)
 create mode 100644 user/languages/c.rst
 create mode 100644 user/languages/cpp.rst
 create mode 100644 user/languages/index.rst

diff --git a/user/index.rst b/user/index.rst
index a91aa55..32667f4 100644
--- a/user/index.rst
+++ b/user/index.rst
@@ -42,6 +42,8 @@ RTEMS User Manual (|version|).
 bld/index
 bsps/index
 
+languages/index
+
 exe/index
 testing/index
 tracing/index
diff --git a/user/languages/c.rst b/user/languages/c.rst
new file mode 100644
index 000..cca0a4b
--- /dev/null
+++ b/user/languages/c.rst
@@ -0,0 +1,18 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 Chris Johns 
+
+.. index:: C
+.. index:: C Programming Language
+
+C
+=
+.. index:: C
+
+RTEMS supports the C programming language via the inherent C compiler
+support with the C Standard Library provided by newlib. The support
+language version is C99 and C11 including C11 threads. The RTEMS POSIX
+1003.1 Compliance Guide details the supported interfaces and standards
+the C Standard Library supports.
+
+TBD.
diff --git a/user/languages/cpp.rst b/user/languages/cpp.rst
new file mode 100644
index 000..f9e4cb9
--- /dev/null
+++ b/user/languages/cpp.rst
@@ -0,0 +1,312 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 Chris Johns 
+
+.. index:: C++
+.. index:: C++ Programming Language
+
+C++
+===
+.. index:: C++
+
+RTEMS supports the C++ programming language and its standard library. The
+supported language versions are C++11, C++14, and C++17.
+
+The C++ standard library provides a rich set of interfaces to support
+multi-threaded programming. The Thread support library provides
+``std::lock_guard`` as a means to manage ``std::mutex`` or similar objects
+within a code block while execution remains within that block. The
+``std::promise`` and ``std::future`` supports provides a controlled means for
+threads to end, clean-up and return a status value of some type. The Atomic
+operations library provides a range of methods to atomically access data as
+well as establish inter-thread synchronization and order non-atomic memory
+accesses.
+
+The Thread support library maps to the RTEMS POSIX ``pthread`` interface and
+the various synchronization primitives such as mutual exclusion, condition
+variables, and futures map to the high performance self-contained RTEMS
+interface. These objects have a fast execution profile and their storage is
+self-contained which means it does not have to be accounted for in the
+configuration and work-space settings. C++ applications do not need to be
+concerned about the number of locks being used and can implement fine grain
+locking protocols.
+
+RTEMS Threads
+-
+
+RTEMS provides an alternative Thread interface that lets you specify the
+attributes of a thread when it is constructed. This is an extension to the
+standard and is not based on any current or pending standards efforts. The
+goal is to make the interface as close as possible to the existing standard to
+minimize the impact on code being ported to RTEMS.
+
+The following compiler option must be used as the implementation uses the
+``std::invoke`` call which is only available with C++17:
+
+.. code-block:: c++
+
+   --std=c++17
+
+The standard Thread support library specifies the thread constructor as:
+
+.. code-block:: c++
+
+   template< class Function, class... Args >
+   explicit thread( Function&& f, Args&&... args );
+
+A thread constructed using this interface will have a default set of initial
+values. An important attribute of a thread is the stack size and this cannot
+be specified or altered with this interface. On Unix systems virtual memory
+can be used to manage a thread's stack size and stack handling is more complex
+when security is considered so manually controlling the stack size of a thread
+is not needed or wanted.
+
+Attributes
+^^
+
+The ``rtems::thread::attributes`` class provides an interface to control the
+various attributes a thread has. The header file is:
+
+.. code-block:: c++
+
+   #include 
+
+The default constructor initialise the attributes to the executing thread's
+settings and the stack size is set to the configured minimum. You can then
+alter the attributes to match the requirements of the new thread. It is easy
+to set a name, stack size and priority:
+
+.. code-block:: c++
+
+   rtems::thread::attribute attr;
+   attr.set_name("blue");
+   attr.set_stack_size(16 * 1024);
+   attr.set_priority(attr.get_priority() + 1);
+
+The ``update()`` method will read the attributes of the currently executing
+thread and update the attribute instance making the call. The stack size is
+not read and updated. there is no public interface in RTEMS to obtain the
+executing thread's stack size.
+
+A

[PATCH v2] User Manual languages section

2020-10-18 Thread chrisj
Hello,

Thank you for the reviews and comments of the v1 patch. I believe I have 
addressed the items raised in the review comments.

I have not added sections for languages I do not know about or use. I think
it is best those who know the language and support it should add a section.
I understand this patch maybe feel unbalanced but I would rather attempt
a start at a section with what I know thana having to wait for me to learn
and research and test Ada and Fortran.

Chris

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


[PATCH] powerpc/nexus: Add legacy PCI support to PowerPC Motorola Shared BSP family

2020-10-19 Thread chrisj
From: Chris Johns 

---
 libbsd.py | 2 +-
 rtemsbsd/include/bsp/nexus-devices.h  | 6 +-
 rtemsbsd/powerpc/include/machine/legacyvar.h  | 2 ++
 rtemsbsd/powerpc/include/machine/pci_cfgreg.h | 2 ++
 4 files changed, 10 insertions(+), 2 deletions(-)
 create mode 100644 rtemsbsd/powerpc/include/machine/legacyvar.h
 create mode 100644 rtemsbsd/powerpc/include/machine/pci_cfgreg.h

diff --git a/libbsd.py b/libbsd.py
index 7c9743cb..2dc0d0db 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -2787,7 +2787,7 @@ class pci(builder.Module):
 ]
 )
 self.addCPUDependentFreeBSDSourceFiles(
-[ 'i386' ],
+[ 'i386', "powerpc" ],
 [
 'sys/x86/x86/legacy.c',
 'sys/x86/pci/pci_bus.c',
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 94013564..125ac0c3 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -196,6 +196,10 @@ SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 RTEMS_BSD_DEFINE_NEXUS_DEVICE(fec, 0, 0, NULL);
 SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 
-#endif
+#elif defined(LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H)
+
+RTEMS_BSD_DRIVER_PC_LEGACY;
+
+#endif /* LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H */
 
 #endif
diff --git a/rtemsbsd/powerpc/include/machine/legacyvar.h 
b/rtemsbsd/powerpc/include/machine/legacyvar.h
new file mode 100644
index ..8683a0e5
--- /dev/null
+++ b/rtemsbsd/powerpc/include/machine/legacyvar.h
@@ -0,0 +1,2 @@
+/* See freebsd/sys/x86/include/machine/legacyvar.h */
+#include 
diff --git a/rtemsbsd/powerpc/include/machine/pci_cfgreg.h 
b/rtemsbsd/powerpc/include/machine/pci_cfgreg.h
new file mode 100644
index ..1bfa468e
--- /dev/null
+++ b/rtemsbsd/powerpc/include/machine/pci_cfgreg.h
@@ -0,0 +1,2 @@
+/* See freebsd/sys/x86/include/machine/pci_cfgreg.h */
+#include 
-- 
2.24.1

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


LibBSD PowerPC motorola_shared BSP PCI Support

2020-10-19 Thread chrisj
Hello,

This patch for libbsd adds PCI support to the motorola_shared BSP family.

Tested on a MVME2700 (mvme2307) BSP:

nexus0: 
pcib0 pcibus 0 on motherboard
pci0:  on pcib0
pci0:  at device 0.0 (no driver attached)
pci0:  at device 11.0 (no driver attached)
pci0:  at device 11.1 (no driver attached)
pci0:  at device 12.0 (no driver attached)
pci0:  at device 13.0 (no driver attached)
pci0:  at device 14.0 (no driver attached)

Chris


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


[PATCH] devel/qemu: Update QEMU to 5.2.0-rc1

2020-11-12 Thread chrisj
From: Chris Johns 

- This version of qemu uses meson and ninja to build. You will need
  to install ninja to build. No checks are made until meson run
---
 .../{qemu4-git-1.cfg => qemu-5.2.0-1.cfg} |  16 +-
 bare/config/devel/qemu.bset   |   2 +-
 bare/config/devel/qemu4.bset  |  25 ---
 rtems/config/tools/rtems-kernel-common.cfg| 104 -
 source-builder/config/qemu-5-1.cfg|   9 ++
 source-builder/config/qemu-common-2.cfg   | 145 ++
 6 files changed, 189 insertions(+), 112 deletions(-)
 rename bare/config/devel/{qemu4-git-1.cfg => qemu-5.2.0-1.cfg} (65%)
 delete mode 100644 bare/config/devel/qemu4.bset
 create mode 100644 source-builder/config/qemu-5-1.cfg
 create mode 100644 source-builder/config/qemu-common-2.cfg

diff --git a/bare/config/devel/qemu4-git-1.cfg 
b/bare/config/devel/qemu-5.2.0-1.cfg
similarity index 65%
rename from bare/config/devel/qemu4-git-1.cfg
rename to bare/config/devel/qemu-5.2.0-1.cfg
index ff241bb..380a953 100644
--- a/bare/config/devel/qemu4-git-1.cfg
+++ b/bare/config/devel/qemu-5.2.0-1.cfg
@@ -13,14 +13,14 @@
 #
 # Stable version. Qemu is fast moving.
 #
-%define qemu_version 4.1.0
+%define qemu_version 5.2.0-rc1
 
 #
 # Use release sources.
 #
 %source set qemu https://download.qemu.org/qemu-%{qemu_version}.tar.xz
-%hash sha512 qemu-%{qemu_version}.tar.xz \
-
gv1RcCp7mxsAsvG9O0qDK4AkkBjbuhrdCwpz59S+5FKv1FV0tNjffORHfYcR872kygcqGm3iWJXJPrIc94/Esg==
+#%hash sha512 qemu-%{qemu_version}.tar.xz \
+#
gv1RcCp7mxsAsvG9O0qDK4AkkBjbuhrdCwpz59S+5FKv1FV0tNjffORHfYcR872kygcqGm3iWJXJPrIc94/Esg==
 
 #
 # Patches from Qemu's patchworks site.
@@ -30,13 +30,13 @@
  40399fcedb44b2c1bfa1a95af482f7f335f42d713967ed2f34980a7a940c3740
 
 #
-# Patches to build qemu-4.1.0-sparc with Leon3 support
+# Patches to build qemu sparc with Leon3 support
 #
-%patch add qemu https://gaisler.se/qemu/qemu-4.1.0-leon3.patch
-%hash sha256 qemu-4.1.0-leon3.patch \
+%patch add qemu https://gaisler.se/qemu/qemu-5.2.0-leon3.patch
+%hash sha512 qemu-5.2.0-leon3.patch \
  d62ff3418903f1c5eb7f6d727af0400caeb250e23cc120111930601c9ecce02a
 
 #
-# The Qemu build instructions. We use 4.x.x Release 1.
+# The Qemu build instructions. We use 5.x.x Release 1.
 #
-%include %{_configdir}/qemu-4-1.cfg
+%include %{_configdir}/qemu-5-1.cfg
diff --git a/bare/config/devel/qemu.bset b/bare/config/devel/qemu.bset
index a8b1ebf..3a9b0d5 100644
--- a/bare/config/devel/qemu.bset
+++ b/bare/config/devel/qemu.bset
@@ -21,4 +21,4 @@ devel/gettext-0.18.3.1-1
 devel/libffi-3.0.13-1
 devel/pixman-0.40.0-1
 devel/glib-2.48.2-1
-devel/qemu-git-1
+devel/qemu-5.2.0-1
diff --git a/bare/config/devel/qemu4.bset b/bare/config/devel/qemu4.bset
deleted file mode 100644
index fa52084..000
--- a/bare/config/devel/qemu4.bset
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Build set for QEMU
-#
-
-%define release 1
-
-#
-# Name of the package.
-#
-package: qemu-%{qemu_version}-%{_host}-%{release}
-
-#
-# A magic internal path that would break if changes in the defaults.mc
-# macro file are made.
-#
-%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
-
-# I don't think these are needed anymore ...?
-#devel/autotools-internal
-devel/libiconv-1.14-1
-devel/gettext-0.18.3.1-1
-devel/libffi-3.0.13-1
-devel/pixman-0.40.0-1
-devel/glib-2.46.2-1
-devel/qemu4-git-1
diff --git a/rtems/config/tools/rtems-kernel-common.cfg 
b/rtems/config/tools/rtems-kernel-common.cfg
index 157c7a4..c34e181 100644
--- a/rtems/config/tools/rtems-kernel-common.cfg
+++ b/rtems/config/tools/rtems-kernel-common.cfg
@@ -9,7 +9,7 @@
 # and BSPs. Only after the source to download.
 #
 %if %{_dry_run} && %{defined with_download}
- %log Kenrel configuration errors ignored
+ %log Kernel configuration errors ignored
  %define rtems_kernel_error 0
 %else
  %define rtems_kernel_error 1
@@ -44,11 +44,6 @@
  %define with_tools %{_prefix}
 %endif
 
-#
-# Set the path to the tools.
-#
-%{path prepend %{with_tools}/bin}
-
 #
 # Define the package.
 #
@@ -67,62 +62,13 @@ URL: https://www.rtems.org/
 %include %{_configdir}/base.cfg
 %include %{_configdir}/versions.cfg
 
-#
-# A magic internal path that would break if changes in the defaults.mc
-# macro file are made.
-#
-%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
-
-#
-# Check the version of autoconf. Check autoreconf as it is used.
-#
-%if %{__autoreconf_ver} <= 2.68
- %if %{__autoreconf_bindir_ver} <= 2.68
-  %if %{__autoreconf_path_ver} <= 2.68
-   %error Autoconf (autoreconf) version 2.69 or higher is needed.
-  %endif
- %endif
-%endif
-
-#
-# If no tools provided use the prefix.
-#
-%ifn %{defined with_tools}
- %define with_tools %{_prefix}
-%endif
-
-#
-# Check options.
-#
-%if %{defined without_rtems_posix}
- %define rtems_posix 0
-%endif
-
-%if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
-%endif
-
-%if %{defined with_rtems_cxx}
- %define rtems_cxx 1
-%endif
-
-%if

[PATCH] Update QEMU to 5.2.0-rc1

2020-11-12 Thread chrisj
Hello,

This patch removed the previous git build of qemu and qem4 replacing it
with 5.2.0-rc1. I can build on FreeBSD and run the network tests for the
Xilinx Zynq BSP.

QEMU 5.2.0 has moved to the meson build system so you will need to make
sure you have Ninja install as meson layers on top of Ninja.

Please test on your preferred host and report any issues.

Thanks
Chris


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


[PATCH v2] devel/qemu: Update QEMU to 5.2.0-rc1

2020-11-12 Thread chrisj
From: Chris Johns 

- This version of qemu uses meson and ninja to build. You will need
  to install ninja to build. No checks are made until meson run
---
 .../{qemu4-git-1.cfg => qemu-5.2.0-1.cfg} |  18 +--
 bare/config/devel/qemu.bset   |   2 +-
 bare/config/devel/qemu4.bset  |  25 ---
 source-builder/config/qemu-5-1.cfg|   9 ++
 source-builder/config/qemu-common-2.cfg   | 145 ++
 5 files changed, 164 insertions(+), 35 deletions(-)
 rename bare/config/devel/{qemu4-git-1.cfg => qemu-5.2.0-1.cfg} (58%)
 delete mode 100644 bare/config/devel/qemu4.bset
 create mode 100644 source-builder/config/qemu-5-1.cfg
 create mode 100644 source-builder/config/qemu-common-2.cfg

diff --git a/bare/config/devel/qemu4-git-1.cfg 
b/bare/config/devel/qemu-5.2.0-1.cfg
similarity index 58%
rename from bare/config/devel/qemu4-git-1.cfg
rename to bare/config/devel/qemu-5.2.0-1.cfg
index ff241bb..8c80ffc 100644
--- a/bare/config/devel/qemu4-git-1.cfg
+++ b/bare/config/devel/qemu-5.2.0-1.cfg
@@ -13,14 +13,14 @@
 #
 # Stable version. Qemu is fast moving.
 #
-%define qemu_version 4.1.0
+%define qemu_version 5.2.0-rc1
 
 #
 # Use release sources.
 #
 %source set qemu https://download.qemu.org/qemu-%{qemu_version}.tar.xz
-%hash sha512 qemu-%{qemu_version}.tar.xz \
-
gv1RcCp7mxsAsvG9O0qDK4AkkBjbuhrdCwpz59S+5FKv1FV0tNjffORHfYcR872kygcqGm3iWJXJPrIc94/Esg==
+#%hash sha512 qemu-%{qemu_version}.tar.xz \
+#
gv1RcCp7mxsAsvG9O0qDK4AkkBjbuhrdCwpz59S+5FKv1FV0tNjffORHfYcR872kygcqGm3iWJXJPrIc94/Esg==
 
 #
 # Patches from Qemu's patchworks site.
@@ -30,13 +30,13 @@
  40399fcedb44b2c1bfa1a95af482f7f335f42d713967ed2f34980a7a940c3740
 
 #
-# Patches to build qemu-4.1.0-sparc with Leon3 support
+# Patches to build qemu sparc with Leon3 support
 #
-%patch add qemu https://gaisler.se/qemu/qemu-4.1.0-leon3.patch
-%hash sha256 qemu-4.1.0-leon3.patch \
- d62ff3418903f1c5eb7f6d727af0400caeb250e23cc120111930601c9ecce02a
+%patch add qemu https://gaisler.se/qemu/qemu-5.2.0-leon3.patch
+%hash sha512 qemu-5.2.0-leon3.patch \
+   
cQju/ja5SAM+gsXEkzSteeR+7PjG9g2w+yUb4kg1eZoOSm2MmZDjA/auINVdRax8wgtIEWnzq5/hdY7/THnowg==
 
 #
-# The Qemu build instructions. We use 4.x.x Release 1.
+# The Qemu build instructions. We use 5.x.x Release 1.
 #
-%include %{_configdir}/qemu-4-1.cfg
+%include %{_configdir}/qemu-5-1.cfg
diff --git a/bare/config/devel/qemu.bset b/bare/config/devel/qemu.bset
index a8b1ebf..3a9b0d5 100644
--- a/bare/config/devel/qemu.bset
+++ b/bare/config/devel/qemu.bset
@@ -21,4 +21,4 @@ devel/gettext-0.18.3.1-1
 devel/libffi-3.0.13-1
 devel/pixman-0.40.0-1
 devel/glib-2.48.2-1
-devel/qemu-git-1
+devel/qemu-5.2.0-1
diff --git a/bare/config/devel/qemu4.bset b/bare/config/devel/qemu4.bset
deleted file mode 100644
index fa52084..000
--- a/bare/config/devel/qemu4.bset
+++ /dev/null
@@ -1,25 +0,0 @@
-#
-# Build set for QEMU
-#
-
-%define release 1
-
-#
-# Name of the package.
-#
-package: qemu-%{qemu_version}-%{_host}-%{release}
-
-#
-# A magic internal path that would break if changes in the defaults.mc
-# macro file are made.
-#
-%define _internal_autotools_path %{_tmppath}/sb-%{_uid}/${SB_PREFIX_CLEAN}
-
-# I don't think these are needed anymore ...?
-#devel/autotools-internal
-devel/libiconv-1.14-1
-devel/gettext-0.18.3.1-1
-devel/libffi-3.0.13-1
-devel/pixman-0.40.0-1
-devel/glib-2.46.2-1
-devel/qemu4-git-1
diff --git a/source-builder/config/qemu-5-1.cfg 
b/source-builder/config/qemu-5-1.cfg
new file mode 100644
index 000..7ca58b8
--- /dev/null
+++ b/source-builder/config/qemu-5-1.cfg
@@ -0,0 +1,9 @@
+#
+# QEMU 5 Version 1.
+#
+# This configuration file configure's, make's and install's QEMU.
+#
+
+%define qemu_disables --disable-nettle
+
+%include %{_configdir}/qemu-common-2.cfg
diff --git a/source-builder/config/qemu-common-2.cfg 
b/source-builder/config/qemu-common-2.cfg
new file mode 100644
index 000..1dbaf05
--- /dev/null
+++ b/source-builder/config/qemu-common-2.cfg
@@ -0,0 +1,145 @@
+#
+# QEMU Common Version 1.
+#
+# This configuration file configure's, make's and install's QEMU.
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+#
+# Select Snapshot Macro Maps
+#
+%select qemu-snapshot
+
+#
+# The description.
+#
+Name:  qemu-%{qemu_version}-%{_host}-%{release}
+Summary:   Qemu is a simulator of various processors.
+Version:   %{qemu_version}
+Release:   %{release}
+URL:  http://www.qemu.org/
+
+#
+# Source
+#
+%source set qemu 
http://wiki.qemu-project.org/download/qemu-%{qemu_version}.tar.bz2
+
+
+#
+# QEMU Disable component list.
+#
+# We are not interested in the VM use case for qemu and most of that
+# functionality carries host platform baggage which complicates building on a
+# range of host platforms.
+#
+# You can specialise before including this config file.
+#
+#
+%define qemu_std_disables --disable-werror
+%define qemu_std_disables %{qemu_std_disables} --disable-tools
+%define qemu_std_disables %{qemu_std_dis

[PATCH v2] Update QEMU 5.2.0-rc1

2020-11-12 Thread chrisj
Hello,

This patch removed the previous git build of qemu and qem4 replacing it
with 5.2.0-rc1. I can build on FreeBSD and run the network tests for the
Xilinx Zynq BSP.

QEMU 5.2.0 has moved to the meson build system so you will need to make
sure you have Ninja install as meson layers on top of Ninja.

Please test on your preferred host and report any issues.

Thanks
Chris

ps: Removed the waf kernel work in progress


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


[PATCH] cpukit: Merge FreeBSD values for the priorities

2020-12-23 Thread chrisj
From: Chris Johns 

It seems we need valid values or assumptions in the FreeBSD about
these values breaks some of the code.

Closes #4207
---
 cpukit/include/sys/priority.h | 102 --
 1 file changed, 85 insertions(+), 17 deletions(-)

diff --git a/cpukit/include/sys/priority.h b/cpukit/include/sys/priority.h
index 025de6290c..855edb63c2 100644
--- a/cpukit/include/sys/priority.h
+++ b/cpukit/include/sys/priority.h
@@ -1,5 +1,7 @@
-/*
- * Copyright (c) 2015 embedded brains GmbH
+/*-
+ * SPDX-License-Identifier: BSD-4-Clause
+ *
+ * Copyright (c) 1994, Henrik Vestergaard Draboel
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -10,6 +12,11 @@
  * 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.
+ * 3. All advertising materials mentioning features or use of this software
+ *must display the following acknowledgement:
+ *  This product includes software developed by Henrik Vestergaard Draboel.
+ * 4. The name of the author may not be used to endorse or promote products
+ *derived from this software without specific prior written permission.
  *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
@@ -22,23 +29,84 @@
  * 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$
  */
 
 #ifndef _SYS_PRIORITY_H_
-#define_SYS_PRIORITY_H_
-
-/* Dummy values to make the libbsd happy */
-#definePRI_MAX_ITHD0
-#definePI_NET  0
-#definePI_DISK 0
-#definePI_SOFT 0
-#definePI_SWI(x)   0
-#definePRI_MIN_KERN0
-#definePVM 0
-#definePRIBIO  0
-#definePZERO   0
-#definePSOCK   0
-#definePWAIT   0
-#definePPAUSE  0
+#define _SYS_PRIORITY_H_
+
+/*
+ * Process priority specifications.
+ */
+
+/*
+ * Priority classes.
+ */
+
+#define PRI_ITHD1   /* Interrupt thread. */
+#define PRI_REALTIME2   /* Real time process. */
+#define PRI_TIMESHARE   3   /* Time sharing process. */
+#define PRI_IDLE4   /* Idle process. */
+
+/*
+ * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ)
+ * are insignificant.  Ranges are as follows:
+ *
+ * Interrupt threads:   0 - 47
+ * Realtime user threads:   48 - 79
+ * Top half kernel threads: 80 - 119
+ * Time sharing user threads:   120 - 223
+ * Idle user threads:   224 - 255
+ *
+ * XXX If/When the specific interrupt thread and top half thread ranges
+ * disappear, a larger range can be used for user processes.
+ */
+
+#define PRI_MIN (0) /* Highest priority. */
+#define PRI_MAX (255)   /* Lowest priority. */
+
+#define PRI_MIN_ITHD(PRI_MIN)
+#define PRI_MAX_ITHD(PRI_MIN_REALTIME - 1)
+
+#define PI_REALTIME (PRI_MIN_ITHD + 0)
+#define PI_AV   (PRI_MIN_ITHD + 4)
+#define PI_NET  (PRI_MIN_ITHD + 8)
+#define PI_DISK (PRI_MIN_ITHD + 12)
+#define PI_TTY  (PRI_MIN_ITHD + 16)
+#define PI_DULL (PRI_MIN_ITHD + 20)
+#define PI_SOFT (PRI_MIN_ITHD + 24)
+#define PI_SWI(x)   (PI_SOFT + (x) * RQ_PPQ)
+
+#define PRI_MIN_REALTIME(48)
+#define PRI_MAX_REALTIME(PRI_MIN_KERN - 1)
+
+#define PRI_MIN_KERN(80)
+#define PRI_MAX_KERN(PRI_MIN_TIMESHARE - 1)
+
+#define PSWP(PRI_MIN_KERN + 0)
+#define PVM (PRI_MIN_KERN + 4)
+#define PINOD   (PRI_MIN_KERN + 8)
+#define PRIBIO  (PRI_MIN_KERN + 12)
+#define PVFS(PRI_MIN_KERN + 16)
+#define PZERO   (PRI_MIN_KERN + 20)
+#define PSOCK   (PRI_MIN_KERN + 24)
+#define PWAIT   (PRI_MIN_KERN + 28)
+#define PLOCK   (PRI_MIN_KERN + 32)
+#define PPAUSE  (PRI_MIN_KERN + 36)
+
+#define PRI_MIN_TIMESHARE   (120)
+#define PRI_MAX_TIMESHARE   (PRI_MIN_IDLE - 1)
+
+#define PUSER   (PRI_MIN_TIMESHARE)
+
+#define PRI_MIN_IDLE(224)
+#define PRI_MAX_IDLE(PRI_MAX)
+
+#ifdef _KERNEL
+/* Other arguments for kern_yield(9). */
+#define PRI_USER-2  /* Change to current user priority. */
+#define PRI_UNCHANGED   -1  /* Do not change priority. */
+#endif
 
 #endif /* !_

[PATCH] libcsupport: Add no_reg_make_node as a mount option to the mount table

2021-01-24 Thread chrisj
From: Chris Johns 

- Add the bool flag no_reg_make_mode to the mount table so a file
  system can indicate creating regular files is not done by
  use the mknod handler. The file system will handle creating a
  file node in the open handler.

- Note, the mount option is an enum which means there is only one
  exclusive option supported. As a result no encapsulation is
  provided and file systems need to set no_reg_make_node directly.

Closes #4222
---
 cpukit/include/rtems/libio.h  |  1 +
 cpukit/libcsupport/src/open.c | 13 -
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/cpukit/include/rtems/libio.h b/cpukit/include/rtems/libio.h
index 18141c3d3c..d4042691c8 100644
--- a/cpukit/include/rtems/libio.h
+++ b/cpukit/include/rtems/libio.h
@@ -1613,6 +1613,7 @@ struct rtems_filesystem_mount_table_entry_tt {
   rtems_filesystem_global_location_t*mt_fs_root;
   bool   mounted;
   bool   writeable;
+  bool   no_reg_make_node;
   const rtems_filesystem_limits_and_options_t *pathconf_limits_and_options;
 
   /*
diff --git a/cpukit/libcsupport/src/open.c b/cpukit/libcsupport/src/open.c
index bdb50240b4..c238dce5f7 100644
--- a/cpukit/libcsupport/src/open.c
+++ b/cpukit/libcsupport/src/open.c
@@ -34,7 +34,7 @@ static void create_regular_file(
 )
 {
   int rv = 0;
-  const rtems_filesystem_location_info_t *currentloc = 
+  const rtems_filesystem_location_info_t *currentloc =
 rtems_filesystem_eval_path_get_currentloc( ctx );
   const char *token = rtems_filesystem_eval_path_get_token( ctx );
   size_t tokenlen = rtems_filesystem_eval_path_get_tokenlen( ctx );
@@ -85,10 +85,15 @@ static int do_open(
 | (make ? RTEMS_FS_MAKE : 0)
 | (exclusive ?  RTEMS_FS_EXCLUSIVE : 0);
   rtems_filesystem_eval_path_context_t ctx;
+  const rtems_filesystem_location_info_t *currentloc;
+  bool create_reg_file;
 
   rtems_filesystem_eval_path_start( &ctx, path, eval_flags );
 
-  if ( rtems_filesystem_eval_path_has_token( &ctx ) ) {
+  currentloc = rtems_filesystem_eval_path_get_currentloc( &ctx );
+  create_reg_file = !currentloc->mt_entry->no_reg_make_node;
+
+  if ( create_reg_file && rtems_filesystem_eval_path_has_token( &ctx ) ) {
 create_regular_file( &ctx, mode );
   }
 
@@ -99,11 +104,9 @@ static int do_open(
 #endif
 
   if ( write_access || open_dir ) {
-const rtems_filesystem_location_info_t *currentloc =
-  rtems_filesystem_eval_path_get_currentloc( &ctx );
 mode_t type = rtems_filesystem_location_type( currentloc );
 
-if ( write_access && S_ISDIR( type ) ) {
+if ( create_reg_file && write_access && S_ISDIR( type ) ) {
   rtems_filesystem_eval_path_error( &ctx, EISDIR );
 }
 
-- 
2.24.1

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


[PATCH] powerpc/shared: ISA bus bridge fails to enable the openpic irq

2021-02-06 Thread chrisj
From: Chris Johns 

- The call to enable the openpic irq for the ISA bridge falls
  because the IRQ used is offset by the ISA bus signals and
  the openpic call expects an IRA relative to it's signals.

- Add the MVME 2600/2700 to the list is an ISA bridge.

Closes #4231
---
 bsps/powerpc/shared/irq/irq_init.c  | 2 +-
 bsps/powerpc/shared/irq/openpic_i8259_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsps/powerpc/shared/irq/irq_init.c 
b/bsps/powerpc/shared/irq/irq_init.c
index 1a44992a5b..1042c9d1a8 100644
--- a/bsps/powerpc/shared/irq/irq_init.c
+++ b/bsps/powerpc/shared/irq/irq_init.c
@@ -310,7 +310,7 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
 #endif
 known_cpi_isa_bridge = 1;
   }
-  if ( currentBoard == MVME_2300 ) {
+  if ( currentBoard == MVME_2300 || currentBoard == MVME_2600_2700_W_MVME761 ) 
{
 /* nothing to do for W83C553 bridge */
 known_cpi_isa_bridge = 1;
   }
diff --git a/bsps/powerpc/shared/irq/openpic_i8259_irq.c 
b/bsps/powerpc/shared/irq/openpic_i8259_irq.c
index 4a9c393f7f..513b9ac3e0 100644
--- a/bsps/powerpc/shared/irq/openpic_i8259_irq.c
+++ b/bsps/powerpc/shared/irq/openpic_i8259_irq.c
@@ -214,7 +214,7 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
/*
  * Must enable PCI/ISA bridge IRQ
  */
-   openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ);
+openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ - BSP_PCI_IRQ_LOWEST_OFFSET);
 #endif
 #endif
 
-- 
2.27.0

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


[RTEMS 5 PATCH] powerpc/shared: ISA bus bridge fails to enable the openpic irq

2021-02-07 Thread chrisj
From: Chris Johns 

- The call to enable the openpic irq for the ISA bridge falls
  because the IRQ used is offset by the ISA bus signals and
  the openpic call expects an IRA relative to it's signals.

- Add the MVME 2600/2700 to the list is an ISA bridge.

Closes #4233
---
 bsps/powerpc/shared/irq/irq_init.c  | 2 +-
 bsps/powerpc/shared/irq/openpic_i8259_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsps/powerpc/shared/irq/irq_init.c 
b/bsps/powerpc/shared/irq/irq_init.c
index 1a44992a5b..1042c9d1a8 100644
--- a/bsps/powerpc/shared/irq/irq_init.c
+++ b/bsps/powerpc/shared/irq/irq_init.c
@@ -310,7 +310,7 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
 #endif
 known_cpi_isa_bridge = 1;
   }
-  if ( currentBoard == MVME_2300 ) {
+  if ( currentBoard == MVME_2300 || currentBoard == MVME_2600_2700_W_MVME761 ) 
{
 /* nothing to do for W83C553 bridge */
 known_cpi_isa_bridge = 1;
   }
diff --git a/bsps/powerpc/shared/irq/openpic_i8259_irq.c 
b/bsps/powerpc/shared/irq/openpic_i8259_irq.c
index 4a9c393f7f..513b9ac3e0 100644
--- a/bsps/powerpc/shared/irq/openpic_i8259_irq.c
+++ b/bsps/powerpc/shared/irq/openpic_i8259_irq.c
@@ -214,7 +214,7 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
/*
  * Must enable PCI/ISA bridge IRQ
  */
-   openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ);
+openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ - BSP_PCI_IRQ_LOWEST_OFFSET);
 #endif
 #endif
 
-- 
2.24.1

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


[RTEMS 5 PATCH] bsp/motorola_powerp: Print RTEMS_VERSION from the bootloader

2021-02-07 Thread chrisj
From: Chris Johns 

Close #4234
---
 bsps/powerpc/motorola_powerpc/bootloader/misc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/bsps/powerpc/motorola_powerpc/bootloader/misc.c 
b/bsps/powerpc/motorola_powerpc/bootloader/misc.c
index 587bcffcff..ff2e3ff590 100644
--- a/bsps/powerpc/motorola_powerpc/bootloader/misc.c
+++ b/bsps/powerpc/motorola_powerpc/bootloader/misc.c
@@ -23,6 +23,8 @@
 #include 
 #include 
 
+#include 
+
 /* to align the pointer to the (next) page boundary */
 #define PAGE_ALIGN(addr)   (((addr) + PAGE_MASK) & ~PAGE_MASK)
 
@@ -401,7 +403,7 @@ setup_hw(void)
}
 #endif
 
-   printk("\nRTEMS 4.x/PPC load: ");
+   printk("\nRTEMS " RTEMS_VERSION "/PPC load: ");
timer = 0;
cp = bd->cmd_line+strlen(bd->cmd_line);
while (timer++ < 5*1000) {
-- 
2.24.1

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


[RTEMS 5 PATCH v2] powerpc/shared: ISA bus bridge fails to enable the openpic irq

2021-02-07 Thread chrisj
From: Chris Johns 

- The call to enable the openpic irq for the ISA bridge fails
  because the IRQ used is offset by the ISA bus signals and
  the openpic call expects an IRQ relative to its signals.

- Add the MVME 2600/2700 to the list of boards with an ISA bridge.

Closes #4233
---
 bsps/powerpc/shared/irq/irq_init.c  | 2 +-
 bsps/powerpc/shared/irq/openpic_i8259_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/bsps/powerpc/shared/irq/irq_init.c 
b/bsps/powerpc/shared/irq/irq_init.c
index 1a44992a5b..1042c9d1a8 100644
--- a/bsps/powerpc/shared/irq/irq_init.c
+++ b/bsps/powerpc/shared/irq/irq_init.c
@@ -310,7 +310,7 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
 #endif
 known_cpi_isa_bridge = 1;
   }
-  if ( currentBoard == MVME_2300 ) {
+  if ( currentBoard == MVME_2300 || currentBoard == MVME_2600_2700_W_MVME761 ) 
{
 /* nothing to do for W83C553 bridge */
 known_cpi_isa_bridge = 1;
   }
diff --git a/bsps/powerpc/shared/irq/openpic_i8259_irq.c 
b/bsps/powerpc/shared/irq/openpic_i8259_irq.c
index 4a9c393f7f..513b9ac3e0 100644
--- a/bsps/powerpc/shared/irq/openpic_i8259_irq.c
+++ b/bsps/powerpc/shared/irq/openpic_i8259_irq.c
@@ -214,7 +214,7 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
/*
  * Must enable PCI/ISA bridge IRQ
  */
-   openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ);
+openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ - BSP_PCI_IRQ_LOWEST_OFFSET);
 #endif
 #endif
 
-- 
2.24.1

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


[RTEMS 4.11 PATCH] powerpc/shared: ISA bus bridge fails to enable the openpic irq

2021-02-07 Thread chrisj
From: Chris Johns 

- The call to enable the openpic irq for the ISA bridge fails
  because the IRQ used is offset by the ISA bus signals and
  the openpic call expects an IRQ relative to its signals.

- Add the MVME 2600/2700 to the list of boards with an ISA bridge.

Closes #4235
---
 c/src/lib/libbsp/powerpc/shared/irq/irq_init.c  | 2 +-
 c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c 
b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
index a58cd246c4..6e71ec4a67 100644
--- a/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
+++ b/c/src/lib/libbsp/powerpc/shared/irq/irq_init.c
@@ -310,7 +310,7 @@ void BSP_rtems_irq_mng_init(unsigned cpuId)
 #endif
 known_cpi_isa_bridge = 1;
   }
-  if ( currentBoard == MVME_2300 ) {
+  if ( currentBoard == MVME_2300 || MVME_2600_2700_W_MVME761 ) {
 /* nothing to do for W83C553 bridge */
 known_cpi_isa_bridge = 1;
   }
diff --git a/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c 
b/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c
index 80901223b8..f324b56752 100644
--- a/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c
+++ b/c/src/lib/libbsp/powerpc/shared/irq/openpic_i8259_irq.c
@@ -214,7 +214,7 @@ int BSP_setup_the_pic(rtems_irq_global_settings* config)
/*
  * Must enable PCI/ISA bridge IRQ
  */
-   openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ);
+openpic_enable_irq (BSP_PCI_ISA_BRIDGE_IRQ - BSP_PCI_IRQ_LOWEST_OFFSET);
 #endif
 #endif
 
-- 
2.24.1

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


[PATCH] libcsupport: Have greedy allocations use consume extended memory

2021-02-07 Thread chrisj
From: Chris Johns 

- Call the heap extend handler until all memory has been
  requested.

Closes #3982
---
 cpukit/libcsupport/src/rtems_heap_greedy.c | 12 
 1 file changed, 12 insertions(+)

diff --git a/cpukit/libcsupport/src/rtems_heap_greedy.c 
b/cpukit/libcsupport/src/rtems_heap_greedy.c
index 4dda39873f..2361f17d2e 100644
--- a/cpukit/libcsupport/src/rtems_heap_greedy.c
+++ b/cpukit/libcsupport/src/rtems_heap_greedy.c
@@ -30,8 +30,20 @@ void *rtems_heap_greedy_allocate(
   size_t block_count
 )
 {
+  Heap_Control *heap = RTEMS_Malloc_Heap;
+  size_t size = 128 * 1024 * 1024;
   void *opaque;
 
+  while (size > 0) {
+opaque = (*rtems_malloc_extend_handler)( heap, size );
+if (opaque == NULL) {
+  size >>= 1;
+} else {
+  if ( rtems_malloc_dirty_helper != NULL )
+   (*rtems_malloc_dirty_helper)( opaque, size );
+}
+  }
+
   _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate( RTEMS_Malloc_Heap, block_sizes, block_count 
);
   _RTEMS_Unlock_allocator();
-- 
2.24.1

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


[PATCH] libcsupport: Add sbrk greedy support to consume all sbrk memory

2021-02-08 Thread chrisj
From: Chris Johns 

- Move the heap sbrk code into a separate routnine.

- Update heap and workspace greedy allocators to use the common
  sbrk greedy support.

Closes #3982
---
 cpukit/Makefile.am|  1 +
 cpukit/include/rtems/malloc.h | 13 +++
 cpukit/libcsupport/src/rtems_heap_greedy.c| 19 --
 .../libcsupport/src/rtems_heap_sbrk_greedy.c  | 37 +++
 cpukit/rtems/src/workspacegreedy.c| 12 +-
 spec/build/cpukit/librtemscpu.yml |  1 +
 6 files changed, 69 insertions(+), 14 deletions(-)
 create mode 100644 cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 565aa66ce1..14abc8bb6a 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -217,6 +217,7 @@ librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_extend.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_extend_via_sbrk.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_greedy.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_null_extend.c
+librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_sbrk_greedy.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_memalign.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_mkdir.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_putc.c
diff --git a/cpukit/include/rtems/malloc.h b/cpukit/include/rtems/malloc.h
index 13e94ac38a..ec6473a703 100644
--- a/cpukit/include/rtems/malloc.h
+++ b/cpukit/include/rtems/malloc.h
@@ -68,6 +68,19 @@ void *rtems_heap_extend_via_sbrk(
   size_t alloc_size
 );
 
+/**
+ * @brief Greedy allocate that empties the sbrk memory
+ *
+ * Afterwards all the sbrk avialable memory will have been allocated
+ * to the provided heap.
+ *
+ * @see rtems_heap_extend_via_sbrk().
+ */
+void rtems_heap_sbrk_greedy_allocate(
+  Heap_Control *heap,
+  size_t alloc_size
+);
+
 void *rtems_heap_null_extend(
   Heap_Control *heap,
   size_t alloc_size
diff --git a/cpukit/libcsupport/src/rtems_heap_greedy.c 
b/cpukit/libcsupport/src/rtems_heap_greedy.c
index c02e48d962..94c28d7f16 100644
--- a/cpukit/libcsupport/src/rtems_heap_greedy.c
+++ b/cpukit/libcsupport/src/rtems_heap_greedy.c
@@ -25,25 +25,17 @@
 
 #include "malloc_p.h"
 
+#define SBRK_ALLOC_SIZE (128 * 1024UL * 1024UL)
+
 void *rtems_heap_greedy_allocate(
   const uintptr_t *block_sizes,
   size_t block_count
 )
 {
   Heap_Control *heap = RTEMS_Malloc_Heap;
-  size_t size = 128 * 1024 * 1024;
   void *opaque;
 
-  while ( size > 0 ) {
-opaque = (*rtems_malloc_extend_handler)( heap, size );
-if ( opaque == NULL ) {
-  size >>= 1;
-} else {
-  if ( rtems_malloc_dirty_helper != NULL ) {
-   (*rtems_malloc_dirty_helper)( opaque, size );
-  }
-}
-  }
+  rtems_heap_sbrk_greedy_allocate( heap, SBRK_ALLOC_SIZE );
 
   _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate( RTEMS_Malloc_Heap, block_sizes, block_count 
);
@@ -56,11 +48,14 @@ void *rtems_heap_greedy_allocate_all_except_largest(
   uintptr_t *allocatable_size
 )
 {
+  Heap_Control *heap = RTEMS_Malloc_Heap;
   void *opaque;
 
+  rtems_heap_sbrk_greedy_allocate( heap, SBRK_ALLOC_SIZE );
+
   _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate_all_except_largest(
-RTEMS_Malloc_Heap,
+heap,
 allocatable_size
   );
   _RTEMS_Unlock_allocator();
diff --git a/cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c 
b/cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c
new file mode 100644
index 00..1fd82eed4f
--- /dev/null
+++ b/cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c
@@ -0,0 +1,37 @@
+/**
+ *  @file
+ *
+ *  @brief Greedy Allocate that Empties the sbrk system call
+ *  @ingroup MallocSupport
+ */
+
+/*
+ * Copyright (c) 2021 Chris Johns.  All rights reserved.
+ *
+ * The license and distribution terms for this file may be
+ * found in the file LICENSE in this distribution or at
+ * http://www.rtems.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "malloc_p.h"
+
+void rtems_heap_sbrk_greedy_allocate(
+  Heap_Control *heap,
+  size_t alloc_size
+)
+{
+  while ( alloc_size > 0 ) {
+void *p = (*rtems_malloc_extend_handler)( heap, alloc_size );
+if ( p == NULL ) {
+  alloc_size >>= 1;
+} else {
+  if ( rtems_malloc_dirty_helper != NULL ) {
+   (*rtems_malloc_dirty_helper)( p, alloc_size );
+  }
+}
+  }
+}
diff --git a/cpukit/rtems/src/workspacegreedy.c 
b/cpukit/rtems/src/workspacegreedy.c
index 09204c2833..5ddf004787 100644
--- a/cpukit/rtems/src/workspacegreedy.c
+++ b/cpukit/rtems/src/workspacegreedy.c
@@ -33,15 +33,20 @@
 #include 
 #include 
 
+#define SBRK_ALLOC_SIZE (128 * 1024UL * 1024UL)
+
 void *rtems_workspace_greedy_allocate(
   const uintptr_t *block_sizes,
   size_t block_count
 )
 {
+  Heap_Control *heap = &_Workspace_Area;
   void *opaque;
 
+  rtems_heap_sbrk_greedy_allocate( heap, SBRK_ALLOC_SIZE );
+
   _RTEMS_Lock_allocator();
-  opaque = _Heap_Greedy_allocate( &_Workspace_Area, block

[PATCH v2] libcsupport: Add sbrk greedy support to consume all sbrk memory

2021-02-08 Thread chrisj
From: Chris Johns 

- Move the heap sbrk code into a separate routnine.

- Update heap and workspace greedy allocators to use the common
  sbrk greedy support.

Closes #3982
---
 cpukit/Makefile.am|  1 +
 cpukit/include/rtems/malloc.h | 13 
 cpukit/libcsupport/src/rtems_heap_greedy.c| 19 +++---
 .../libcsupport/src/rtems_heap_sbrk_greedy.c  | 63 +++
 cpukit/rtems/src/workspacegreedy.c| 12 +++-
 spec/build/cpukit/librtemscpu.yml |  1 +
 6 files changed, 95 insertions(+), 14 deletions(-)
 create mode 100644 cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c

diff --git a/cpukit/Makefile.am b/cpukit/Makefile.am
index 565aa66ce1..14abc8bb6a 100644
--- a/cpukit/Makefile.am
+++ b/cpukit/Makefile.am
@@ -217,6 +217,7 @@ librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_extend.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_extend_via_sbrk.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_greedy.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_null_extend.c
+librtemscpu_a_SOURCES += libcsupport/src/rtems_heap_sbrk_greedy.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_memalign.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_mkdir.c
 librtemscpu_a_SOURCES += libcsupport/src/rtems_putc.c
diff --git a/cpukit/include/rtems/malloc.h b/cpukit/include/rtems/malloc.h
index 13e94ac38a..ec6473a703 100644
--- a/cpukit/include/rtems/malloc.h
+++ b/cpukit/include/rtems/malloc.h
@@ -68,6 +68,19 @@ void *rtems_heap_extend_via_sbrk(
   size_t alloc_size
 );
 
+/**
+ * @brief Greedy allocate that empties the sbrk memory
+ *
+ * Afterwards all the sbrk avialable memory will have been allocated
+ * to the provided heap.
+ *
+ * @see rtems_heap_extend_via_sbrk().
+ */
+void rtems_heap_sbrk_greedy_allocate(
+  Heap_Control *heap,
+  size_t alloc_size
+);
+
 void *rtems_heap_null_extend(
   Heap_Control *heap,
   size_t alloc_size
diff --git a/cpukit/libcsupport/src/rtems_heap_greedy.c 
b/cpukit/libcsupport/src/rtems_heap_greedy.c
index c02e48d962..94c28d7f16 100644
--- a/cpukit/libcsupport/src/rtems_heap_greedy.c
+++ b/cpukit/libcsupport/src/rtems_heap_greedy.c
@@ -25,25 +25,17 @@
 
 #include "malloc_p.h"
 
+#define SBRK_ALLOC_SIZE (128 * 1024UL * 1024UL)
+
 void *rtems_heap_greedy_allocate(
   const uintptr_t *block_sizes,
   size_t block_count
 )
 {
   Heap_Control *heap = RTEMS_Malloc_Heap;
-  size_t size = 128 * 1024 * 1024;
   void *opaque;
 
-  while ( size > 0 ) {
-opaque = (*rtems_malloc_extend_handler)( heap, size );
-if ( opaque == NULL ) {
-  size >>= 1;
-} else {
-  if ( rtems_malloc_dirty_helper != NULL ) {
-   (*rtems_malloc_dirty_helper)( opaque, size );
-  }
-}
-  }
+  rtems_heap_sbrk_greedy_allocate( heap, SBRK_ALLOC_SIZE );
 
   _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate( RTEMS_Malloc_Heap, block_sizes, block_count 
);
@@ -56,11 +48,14 @@ void *rtems_heap_greedy_allocate_all_except_largest(
   uintptr_t *allocatable_size
 )
 {
+  Heap_Control *heap = RTEMS_Malloc_Heap;
   void *opaque;
 
+  rtems_heap_sbrk_greedy_allocate( heap, SBRK_ALLOC_SIZE );
+
   _RTEMS_Lock_allocator();
   opaque = _Heap_Greedy_allocate_all_except_largest(
-RTEMS_Malloc_Heap,
+heap,
 allocatable_size
   );
   _RTEMS_Unlock_allocator();
diff --git a/cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c 
b/cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c
new file mode 100644
index 00..aad3188ac5
--- /dev/null
+++ b/cpukit/libcsupport/src/rtems_heap_sbrk_greedy.c
@@ -0,0 +1,63 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief Greedy Allocate that Empties the sbrk system call
+ *
+ * @ingroup MallocSupport
+ *
+ * @brief Greedy allocation os sbrk system call memory
+ *
+ * The call consumes all the avialable sbrk memory extending
+ * the supplied heap with it. There is free as sbrk memory is
+ * only ever allocated.
+ */
+
+/*
+ * Copyright (c) 2021 Chris Johns.  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 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 O

[PATCH] Update motorola_power to irq-generic interrupt management

2021-02-12 Thread chrisj
From: Chris Johns 

- Add support to the BSP to enable irq-generic management

- Update the powerpc shared irq code to support irq-generic. This
  is an option in option for existing powerpc bsps. This change
  should be simpler now

- Fix a number of issues in ISA IRQ controller handling by porting
  fixes from the i386 (PC) BSP

Closes #4238
Closes #4239
---
 bsps/powerpc/include/bsp/irq_supp.h   |   5 +
 .../motorola_powerpc/include/bsp/irq.h|  15 +-
 .../powerpc/motorola_powerpc/start/bspstart.c |   9 +-
 bsps/powerpc/shared/irq/i8259.c   | 155 ++
 bsps/powerpc/shared/irq/irq_init.c|  15 +-
 bsps/powerpc/shared/irq/openpic_i8259_irq.c   |  27 ++-
 bsps/powerpc/shared/irq/ppc-irq-generic.c | 118 +
 .../bsps/powerpc/motorola_powerpc/grp.yml |   2 +-
 .../bsps/powerpc/motorola_powerpc/obj.yml |   3 +-
 9 files changed, 291 insertions(+), 58 deletions(-)
 create mode 100644 bsps/powerpc/shared/irq/ppc-irq-generic.c

diff --git a/bsps/powerpc/include/bsp/irq_supp.h 
b/bsps/powerpc/include/bsp/irq_supp.h
index 65af48c87f..fbb16d6211 100644
--- a/bsps/powerpc/include/bsp/irq_supp.h
+++ b/bsps/powerpc/include/bsp/irq_supp.h
@@ -50,6 +50,11 @@ extern int  BSP_disable_irq_at_pic(const rtems_irq_number 
irqLine);
  */
 extern int  BSP_setup_the_pic(rtems_irq_global_settings* config);
 
+/*
+ * Set up for the irq-generic.h interface.
+ */
+int BSP_rtems_irq_generic_set(rtems_irq_global_settings* config);
+
 /* IRQ dispatcher to be defined by the PIC driver; note that it MUST
  * implement shared interrupts.
  * Note also that the exception frame passed to this handler is not very
diff --git a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h 
b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
index 3690dbbff7..cbb6ff69cf 100644
--- a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
+++ b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
@@ -19,9 +19,17 @@
 #ifndef BSP_POWERPC_IRQ_H
 #define BSP_POWERPC_IRQ_H
 
+#ifndef BSP_SHARED_HANDLER_SUPPORT
 #define BSP_SHARED_HANDLER_SUPPORT  1
+#endif
+
 #include 
-#include 
+
+/*
+ * Switch to using the generic support. Remove this when all BSPs have
+ * been converted.
+ */
+#define BSP_POWERPC_IRQ_GENERIC_SUPPORT 1
 
 /*
  * 8259 edge/level control definitions at VIA
@@ -107,6 +115,8 @@ extern "C" {
 #define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1)
 #define BSP_LOWEST_OFFSET  (BSP_ISA_IRQ_LOWEST_OFFSET)
 #define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET)
+#define BSP_INTERRUPT_VECTOR_MIN   (BSP_LOWEST_OFFSET)
+#define BSP_INTERRUPT_VECTOR_MAX   (BSP_MAX_OFFSET)
 /*
  * Some ISA IRQ symbolic name definition
  */
@@ -191,6 +201,9 @@ int BSP_irq_ack_at_i8259s   (const 
rtems_irq_number irqLine);
  */
 int BSP_irq_enabled_at_i8259s  (const rtems_irq_number irqLine);
 
+unsigned short BSP_irq_suspend_i8259s(unsigned short mask);
+void BSP_irq_resume_i8259s(unsigned short in_progress_save);
+
 extern void BSP_rtems_irq_mng_init(unsigned cpuId);
 extern void BSP_i8259s_init(void);
 
diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c 
b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index e74b02c446..ab48858c46 100644
--- a/bsps/powerpc/motorola_powerpc/start/bspstart.c
+++ b/bsps/powerpc/motorola_powerpc/start/bspstart.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -334,10 +335,8 @@ static void bsp_early( void )
*/
   bsp_clicks_per_usec   = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
 
-  /*
-   * Initalize RTEMS IRQ system
-   */
-  BSP_rtems_irq_mng_init(0);
+  /* Initalize interrupt support */
+  bsp_interrupt_initialize();
 
   /* Activate the page table mappings only after
* initializing interrupts because the irq_mng_init()
@@ -360,7 +359,6 @@ static void bsp_early( void )
   printk("Exit from bspstart\n");
 #endif
 }
-
 RTEMS_SYSINIT_ITEM(
   bsp_early,
   RTEMS_SYSINIT_BSP_EARLY,
@@ -370,6 +368,7 @@ RTEMS_SYSINIT_ITEM(
 void bsp_start( void )
 {
   /* Initialization was done by bsp_early() */
+
 }
 
 RTEMS_SYSINIT_ITEM(
diff --git a/bsps/powerpc/shared/irq/i8259.c b/bsps/powerpc/shared/irq/i8259.c
index 7363e87ba0..6a0b855981 100644
--- a/bsps/powerpc/shared/irq/i8259.c
+++ b/bsps/powerpc/shared/irq/i8259.c
@@ -12,6 +12,19 @@
 #include 
 #include 
 
+#define PIC_EOSI0x60///< End of Specific Interrupt (EOSI)
+#define PIC_EOI 0x20///< Generic End of Interrupt (EOI)
+
+/* Operation control word type 3.  Bit 3 (0x08) must be set. Even address. */
+#define PIC_OCW3_RIS0x01/* 1 = read IS, 0 = read IR */
+#define PIC_OCW3_RR 0x02/* register read */
+#define PIC_OCW3_P  0x04/* poll mode command */
+/* 0x08 must be 1 to select OCW3 vs OCW2 */
+#define PIC_OCW3_SEL0x08/* must be 1 */
+/* 0x10 must be 0 to select OCW3 vs ICW1 */
+#define PIC_OCW3_SMM

[PATCH v2] Update motorola_power to irq-generic interrupt management

2021-02-12 Thread chrisj
From: Chris Johns 

- Add support to the BSP to enable irq-generic management

- Update the powerpc shared irq code to support irq-generic. This
  is an option in option for existing powerpc bsps. This change
  should be simpler now

- Fix a number of issues in ISA IRQ controller handling by porting
  fixes from the i386 (PC) BSP

Closes #4238
Closes #4239
---
 bsps/powerpc/include/bsp/irq_supp.h   |   5 +
 .../motorola_powerpc/include/bsp/irq.h|  15 +-
 .../powerpc/motorola_powerpc/start/bspstart.c |   7 +-
 bsps/powerpc/shared/irq/i8259.c   | 152 ++
 bsps/powerpc/shared/irq/irq_init.c|  15 +-
 bsps/powerpc/shared/irq/openpic_i8259_irq.c   |  27 ++--
 bsps/powerpc/shared/irq/ppc-irq-generic.c | 117 ++
 .../bsps/powerpc/motorola_powerpc/grp.yml |   2 +-
 .../bsps/powerpc/motorola_powerpc/obj.yml |   3 +-
 9 files changed, 286 insertions(+), 57 deletions(-)
 create mode 100644 bsps/powerpc/shared/irq/ppc-irq-generic.c

diff --git a/bsps/powerpc/include/bsp/irq_supp.h 
b/bsps/powerpc/include/bsp/irq_supp.h
index 65af48c87f..fbb16d6211 100644
--- a/bsps/powerpc/include/bsp/irq_supp.h
+++ b/bsps/powerpc/include/bsp/irq_supp.h
@@ -50,6 +50,11 @@ extern int  BSP_disable_irq_at_pic(const rtems_irq_number 
irqLine);
  */
 extern int  BSP_setup_the_pic(rtems_irq_global_settings* config);
 
+/*
+ * Set up for the irq-generic.h interface.
+ */
+int BSP_rtems_irq_generic_set(rtems_irq_global_settings* config);
+
 /* IRQ dispatcher to be defined by the PIC driver; note that it MUST
  * implement shared interrupts.
  * Note also that the exception frame passed to this handler is not very
diff --git a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h 
b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
index 3690dbbff7..cbb6ff69cf 100644
--- a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
+++ b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
@@ -19,9 +19,17 @@
 #ifndef BSP_POWERPC_IRQ_H
 #define BSP_POWERPC_IRQ_H
 
+#ifndef BSP_SHARED_HANDLER_SUPPORT
 #define BSP_SHARED_HANDLER_SUPPORT  1
+#endif
+
 #include 
-#include 
+
+/*
+ * Switch to using the generic support. Remove this when all BSPs have
+ * been converted.
+ */
+#define BSP_POWERPC_IRQ_GENERIC_SUPPORT 1
 
 /*
  * 8259 edge/level control definitions at VIA
@@ -107,6 +115,8 @@ extern "C" {
 #define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1)
 #define BSP_LOWEST_OFFSET  (BSP_ISA_IRQ_LOWEST_OFFSET)
 #define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET)
+#define BSP_INTERRUPT_VECTOR_MIN   (BSP_LOWEST_OFFSET)
+#define BSP_INTERRUPT_VECTOR_MAX   (BSP_MAX_OFFSET)
 /*
  * Some ISA IRQ symbolic name definition
  */
@@ -191,6 +201,9 @@ int BSP_irq_ack_at_i8259s   (const 
rtems_irq_number irqLine);
  */
 int BSP_irq_enabled_at_i8259s  (const rtems_irq_number irqLine);
 
+unsigned short BSP_irq_suspend_i8259s(unsigned short mask);
+void BSP_irq_resume_i8259s(unsigned short in_progress_save);
+
 extern void BSP_rtems_irq_mng_init(unsigned cpuId);
 extern void BSP_i8259s_init(void);
 
diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c 
b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index e74b02c446..ef8418e2c6 100644
--- a/bsps/powerpc/motorola_powerpc/start/bspstart.c
+++ b/bsps/powerpc/motorola_powerpc/start/bspstart.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -334,10 +335,8 @@ static void bsp_early( void )
*/
   bsp_clicks_per_usec   = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
 
-  /*
-   * Initalize RTEMS IRQ system
-   */
-  BSP_rtems_irq_mng_init(0);
+  /* Initialize interrupt support */
+  bsp_interrupt_initialize();
 
   /* Activate the page table mappings only after
* initializing interrupts because the irq_mng_init()
diff --git a/bsps/powerpc/shared/irq/i8259.c b/bsps/powerpc/shared/irq/i8259.c
index 7363e87ba0..6a80e24946 100644
--- a/bsps/powerpc/shared/irq/i8259.c
+++ b/bsps/powerpc/shared/irq/i8259.c
@@ -12,6 +12,19 @@
 #include 
 #include 
 
+#define PIC_EOSI0x60///< End of Specific Interrupt (EOSI)
+#define PIC_EOI 0x20///< Generic End of Interrupt (EOI)
+
+/* Operation control word type 3.  Bit 3 (0x08) must be set. Even address. */
+#define PIC_OCW3_RIS0x01/* 1 = read IS, 0 = read IR */
+#define PIC_OCW3_RR 0x02/* register read */
+#define PIC_OCW3_P  0x04/* poll mode command */
+/* 0x08 must be 1 to select OCW3 vs OCW2 */
+#define PIC_OCW3_SEL0x08/* must be 1 */
+/* 0x10 must be 0 to select OCW3 vs ICW1 */
+#define PIC_OCW3_SMM0x20/* special mode mask */
+#define PIC_OCW3_ESMM   0x40/* enable SMM */
+
 /*-+
 | Cache for 1st and 2nd PIC IRQ line's status (enabled or disabled) register.
 +--

[PATCH 1/3] score: Fix warning in thread queue ops

2021-02-12 Thread chrisj
From: Chris Johns 

---
 cpukit/score/src/threadqops.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/cpukit/score/src/threadqops.c b/cpukit/score/src/threadqops.c
index ef20431178..d6ba9dad57 100644
--- a/cpukit/score/src/threadqops.c
+++ b/cpukit/score/src/threadqops.c
@@ -604,9 +604,9 @@ static Thread_Control *_Thread_queue_Priority_first(
   const Thread_queue_Heads *heads
 )
 {
-  Thread_queue_Priority_queue *priority_queue;
-  Priority_Node   *first;
-  Scheduler_Node  *scheduler_node;
+  const Thread_queue_Priority_queue *priority_queue;
+  Priority_Node *first;
+  Scheduler_Node*scheduler_node;
 
 #if defined(RTEMS_SMP)
   _Assert( !_Chain_Is_empty( &heads->Heads.Fifo ) );
-- 
2.24.1

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


[PATCH 2/3] powerpc/motorola_powerpc: Fix tm27 warnings

2021-02-12 Thread chrisj
From: Chris Johns 

---
 bsps/powerpc/motorola_powerpc/include/tm27.h | 24 +---
 1 file changed, 16 insertions(+), 8 deletions(-)

diff --git a/bsps/powerpc/motorola_powerpc/include/tm27.h 
b/bsps/powerpc/motorola_powerpc/include/tm27.h
index 4d616cb3ed..15e66f2a81 100644
--- a/bsps/powerpc/motorola_powerpc/include/tm27.h
+++ b/bsps/powerpc/motorola_powerpc/include/tm27.h
@@ -25,15 +25,23 @@
 
 #define MUST_WAIT_FOR_INTERRUPT 1
 
-void nullFunc(void) {}
-static rtems_irq_connect_data clockIrqData = {BSP_DECREMENTER,
- 0,
- (rtems_irq_enable) nullFunc,
- (rtems_irq_disable) nullFunc,
- (rtems_irq_is_enabled) nullFunc};
-static void Install_tm27_vector(void (*_handler)(void))
+static void null_irq_enable(const rtems_irq_connect_data* a) { (void) a; }
+static void null_irq_disable(const rtems_irq_connect_data* a) { (void) a; }
+static int null_irq_is_enabled(const rtems_irq_connect_data* a) { (void) a; 
return 0; }
+
+static rtems_irq_connect_data clockIrqData =
+{
+ .name = BSP_DECREMENTER,
+ .hdl = 0,
+ .handle = 0,
+ .on = null_irq_enable,
+ .off = null_irq_disable,
+ .isOn = null_irq_is_enabled
+};
+
+static void Install_tm27_vector(rtems_isr (*_handler)(rtems_vector_number))
 {
-  clockIrqData.hdl = _handler;
+  clockIrqData.hdl = (rtems_irq_hdl) _handler;
   if (!BSP_install_rtems_irq_handler (&clockIrqData)) {
printk("Error installing clock interrupt handler!\n");
rtems_fatal_error_occurred(1);
-- 
2.24.1

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


[PATCH 3/3] powerpc/shared: Fix warnings

2021-02-12 Thread chrisj
From: Chris Johns 

---
 bsps/powerpc/shared/vme/bspVmeDmaList.c |  3 ++-
 bsps/powerpc/shared/vme/vmeTsi148.c | 15 +--
 bsps/powerpc/shared/vme/vmeUniverse.c   |  8 +---
 3 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/bsps/powerpc/shared/vme/bspVmeDmaList.c 
b/bsps/powerpc/shared/vme/bspVmeDmaList.c
index 73b398dda1..fb552acdab 100644
--- a/bsps/powerpc/shared/vme/bspVmeDmaList.c
+++ b/bsps/powerpc/shared/vme/bspVmeDmaList.c
@@ -47,6 +47,7 @@
  * -- SLAC Software Notices, Set 4 OTT.002a, 2004 FEB 03
  */
 
+#include 
 #include 
 #include 
 #include 
@@ -71,7 +72,7 @@ typedef struct VMEDmaListNodeRec_ {
 static void
 lprint(VMEDmaListNode d)
 {
-   printf("n 0x%08lx, p: 0x%08lx, n: 0x%08lx d: 0x%08lx\n",
+   printf("n 0x%08" PRIu32", p: 0x%08" PRIu32 ", n: 0x%08" PRIu32 " d: 
0x%08" PRIu32 "\n",
(uint32_t)d, (uint32_t)d->p, (uint32_t)d->n, (uint32_t)d->d);
 }
 #endif
diff --git a/bsps/powerpc/shared/vme/vmeTsi148.c 
b/bsps/powerpc/shared/vme/vmeTsi148.c
index 4e1893b593..3cb3f94e75 100644
--- a/bsps/powerpc/shared/vme/vmeTsi148.c
+++ b/bsps/powerpc/shared/vme/vmeTsi148.c
@@ -46,6 +46,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -2352,8 +2353,10 @@ static uint32_t
 vme_attr(uint32_t xfer_mode)
 {
 uint32_t vme_mode;
-   if ( am2omode(xfer_mode, &vme_mode) )
+unsigned long ul;
+   if ( am2omode(xfer_mode, &ul) )
return BSP_VMEDMA_STATUS_UNSUP;
+   vme_mode = (uint32_t) ul;
 
/* am2omode may set prefetch and other bits */
vme_mode &= TSI_DXAT_OTAT_MSK;
@@ -2405,11 +2408,11 @@ static void
 tsi_desc_dump(DmaDescriptor p)
 {
 VmeTsi148DmaListDescriptor d = p;
-   printf("   DSA: 0x%08lx%08lx\n", ld_be32(&d->dsau),  
ld_be32(&d->dsal));
-   printf("   DDA: 0x%08lx%08lx\n", ld_be32(&d->ddau),  
ld_be32(&d->ddal));
-   printf("   NLA: 0x%08lx%08lx\n", ld_be32(&d->dnlau), 
ld_be32(&d->dnlal));
-   printf("   SAT: 0x%08lx  DAT: 0x%08lx\n", 
ld_be32(&d->dsat), ld_be32(&d->ddat));
-   printf("   CNT: 0x%08lx\n",  ld_be32(&d->dcnt));
+   printf("   DSA: 0x%08" PRIx32 "%08" PRIx32 "\n", 
ld_be32(&d->dsau),  ld_be32(&d->dsal));
+   printf("   DDA: 0x%08" PRIx32 "%08" PRIx32 "\n", 
ld_be32(&d->ddau),  ld_be32(&d->ddal));
+   printf("   NLA: 0x%08" PRIx32 "%08" PRIx32 "\n", 
ld_be32(&d->dnlau), ld_be32(&d->dnlal));
+   printf("   SAT: 0x%08" PRIx32 "  DAT: 0x%08" PRIx32 
"\n", ld_be32(&d->dsat), ld_be32(&d->ddat));
+   printf("   CNT: 0x%08" PRIx32 "\n",  ld_be32(&d->dcnt));
 }
 
 
diff --git a/bsps/powerpc/shared/vme/vmeUniverse.c 
b/bsps/powerpc/shared/vme/vmeUniverse.c
index c7373b4e51..18fe61f7c4 100644
--- a/bsps/powerpc/shared/vme/vmeUniverse.c
+++ b/bsps/powerpc/shared/vme/vmeUniverse.c
@@ -1301,6 +1301,7 @@ static uint32_t
 xfer_mode2dctl(uint32_t xfer_mode)
 {
 uint32_t dctl;
+unsigned long ul;
 
/* Check requested bus mode */
 
@@ -1323,8 +1324,9 @@ uint32_t dctl;
return BSP_VMEDMA_STATUS_UNSUP;
 
/* Luckily DCTL bits match MCTL bits so we can use am2mode */
-   if ( am2mode( 1, xfer_mode, &dctl ) )
+   if ( am2mode( 1, xfer_mode, &ul ) )
return BSP_VMEDMA_STATUS_UNSUP;
+   dctl = (uint32_t) ul;
 
/* However, the book says that for DMA VAS==5 [which would
 * be a CSR access] is reserved. Tests indicate that
@@ -1959,7 +1961,7 @@ unsigned long linten;
 #else
vmeUniverseIntDisable(lvl);
 #endif
-   printk("vmeUniverse ISR: error read from STATID 
register; (level: %i) STATID: 0x%08" PRIx32 " -- DISABLING\n", lvl, status);
+   printk("vmeUniverse ISR: error read from STATID 
register; (level: %i) STATID: 0x%08lx -- DISABLING\n", lvl, status);
} else if (!(ip=universeHdlTbl[status & 
UNIV_VIRQ_STATID_MASK])) {
 #ifdef BSP_PIC_DO_EOI
linten &= ~msk;
@@ -1967,7 +1969,7 @@ unsigned long linten;
vmeUniverseIntDisable(lvl);
 #endif
/* TODO: log error message - RTEMS has no 
logger :-( */
-   printk("vmeUniverse ISR: no handler installed for this 
vector; (level: %i) STATID: 0x%08" PRIx32 " -- DISABLING\n", lvl, status);
+   printk("vmeUniverse ISR: no handler installed for this 
vector; (level: %i) STATID: 0x%08lx -- DISABLING\n", lvl, status);
} else {
/* dispatch handler, it must clear the IRQ at 
the device */
ip->isr(ip->usrData, 
status&UNIV_VIRQ_STATID_MASK);
-- 
2.24.1

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


[PATCH 1/4] powerpc/shared: Fix warnings in i8259 PIC code.

2021-02-15 Thread chrisj
From: Chris Johns 

---
 bsps/powerpc/shared/irq/i8259.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/bsps/powerpc/shared/irq/i8259.c b/bsps/powerpc/shared/irq/i8259.c
index 6a80e24946..37cbc360de 100644
--- a/bsps/powerpc/shared/irq/i8259.c
+++ b/bsps/powerpc/shared/irq/i8259.c
@@ -125,8 +125,6 @@ int BSP_irq_enable_at_i8259s(const rtems_irq_number irqLine)
 {
   rtems_interrupt_level level;
   unsigned shortmask;
-  uint8_t   isr;
-  uint8_t   irr;
 
   if (!BSP_i8259s_irq_valid(irqLine))
 return 1;
@@ -138,14 +136,10 @@ int BSP_irq_enable_at_i8259s(const rtems_irq_number 
irqLine)
 
   if (irqLine < 8)
   {
-isr = BSP_i8259s_irq_in_service_reg(PIC_MASTER_COMMAND_IO_PORT);
-irr = BSP_i8259s_irq_int_request_reg(PIC_MASTER_COMMAND_IO_PORT);
 BSP_i8259s_irq_update_master_imr();
   }
   else
   {
-isr = BSP_i8259s_irq_in_service_reg(PIC_SLAVE_COMMAND_IO_PORT);
-irr = BSP_i8259s_irq_int_request_reg(PIC_SLAVE_COMMAND_IO_PORT);
 BSP_i8259s_irq_update_slave_imr();
   }
 
-- 
2.24.1

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


[PATCH 4/4] powerpc/motorola_powerpc: Add cache coherent memory to the allocator

2021-02-15 Thread chrisj
From: Chris Johns 

Updates #4245
Updates #4243
---
 bsps/powerpc/motorola_powerpc/start/bspstart.c | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c 
b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index ef8418e2c6..a781297565 100644
--- a/bsps/powerpc/motorola_powerpc/start/bspstart.c
+++ b/bsps/powerpc/motorola_powerpc/start/bspstart.c
@@ -44,6 +44,9 @@ extern void set_L2CR(unsigned);
 extern Triv121PgTbl BSP_pgtbl_setup(unsigned int *);
 extern voidBSP_pgtbl_activate(Triv121PgTbl);
 
+#define PPC_MIN_BAT_SIZE (128 * 1024)
+static char cc_memory[PPC_MIN_BAT_SIZE] RTEMS_ALIGNED(PPC_MIN_BAT_SIZE);
+
 SPR_RW(SPRG1)
 
 #if defined(DEBUG_BATS)
@@ -351,6 +354,9 @@ static void bsp_early( void )
 setdbat(3, 0, 0, 0, 0);
   }
 
+  setdbat(3, (intptr_t) &cc_memory[0], (intptr_t) &cc_memory[0], 
PPC_MIN_BAT_SIZE, IO_PAGE);
+  rtems_cache_coherent_add_area(&cc_memory[0], PPC_MIN_BAT_SIZE);
+
 #if defined(DEBUG_BATS)
   ShowBATS();
 #endif
-- 
2.24.1

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


[PATCH 2/4] powerpc/io: Make [out/in] le and be calls conditional

2021-02-15 Thread chrisj
From: Chris Johns 

- These calls clash with the Linux IO header in LibBSD. Making these
  conditional here means BSPs build and the imported Linux header is
  untouched.

Updates #4245
---
 bsps/powerpc/include/libcpu/io.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/bsps/powerpc/include/libcpu/io.h b/bsps/powerpc/include/libcpu/io.h
index 521c97801d..c4e529f4d5 100644
--- a/bsps/powerpc/include/libcpu/io.h
+++ b/bsps/powerpc/include/libcpu/io.h
@@ -107,6 +107,7 @@ static inline void out_be16(volatile uint16_t *addr, 
uint16_t val)
__asm__ __volatile__("sth%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" 
(val));
 }
 
+#ifndef in_le32
 static inline uint32_t in_le32(const volatile uint32_t *addr)
 {
uint32_t ret;
@@ -115,7 +116,9 @@ static inline uint32_t in_le32(const volatile uint32_t 
*addr)
 "r" (addr), "m" (*addr));
return ret;
 }
+#endif
 
+#ifndef in_be32
 static inline uint32_t in_be32(const volatile uint32_t *addr)
 {
uint32_t ret;
@@ -123,17 +126,22 @@ static inline uint32_t in_be32(const volatile uint32_t 
*addr)
__asm__ __volatile__("lwz%U1%X1 %0,%1; eieio" : "=r" (ret) : "m" 
(*addr));
return ret;
 }
+#endif
 
+#ifndef out_le32
 static inline void out_le32(volatile uint32_t *addr, uint32_t val)
 {
__asm__ __volatile__("stwbrx %1,0,%2; eieio" : "=m" (*addr) :
 "r" (val), "r" (addr));
 }
+#endif
 
+#ifndef out_be32
 static inline void out_be32(volatile uint32_t *addr, uint32_t val)
 {
__asm__ __volatile__("stw%U0%X0 %1,%0; eieio" : "=m" (*addr) : "r" 
(val));
 }
+#endif
 
 #endif /* ASM */
 #endif /* _LIBCPU_IO_H */
-- 
2.24.1

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


[PATCH 3/4] powerpc/motorola_powerpc: Enable bus PCI support in LibBSD

2021-02-15 Thread chrisj
From: Chris Johns 

Updates #4245
---
 bsps/powerpc/motorola_powerpc/include/bsp.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/bsps/powerpc/motorola_powerpc/include/bsp.h 
b/bsps/powerpc/motorola_powerpc/include/bsp.h
index 62e740272a..af0e71471e 100644
--- a/bsps/powerpc/motorola_powerpc/include/bsp.h
+++ b/bsps/powerpc/motorola_powerpc/include/bsp.h
@@ -115,6 +115,10 @@ extern "C" {
 #endif
 #endif
 
+/*
+ * The BSP has PCI devices. Enable support in LibBSD.
+ */
+#define BSP_HAS_PCI
 
 /*
  *  Base address definitions for several devices
-- 
2.24.1

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


[6-freebsd-12 PATCH 2/2] bsp/motorola_powerpc: Add dc and ukphy support

2021-02-15 Thread chrisj
From: Chris Johns 

- Add the dc net dev to the BSP

- Add the ukphy support

Closes # 4246
---
 freebsd/sys/dev/dc/if_dc.c| 10 --
 freebsd/sys/dev/dc/if_dcreg.h |  7 
 rtemsbsd/include/bsp/nexus-devices.h  |  4 +++
 .../include/machine/rtems-bsd-nexus-bus.h | 32 +++
 4 files changed, 50 insertions(+), 3 deletions(-)

diff --git a/freebsd/sys/dev/dc/if_dc.c b/freebsd/sys/dev/dc/if_dc.c
index 7fc0ef54..4cb61fa5 100644
--- a/freebsd/sys/dev/dc/if_dc.c
+++ b/freebsd/sys/dev/dc/if_dc.c
@@ -156,6 +156,10 @@ MODULE_DEPEND(dc, miibus, 1, 1, 1);
  * Various supported device vendors/types and their names.
  */
 static const struct dc_type dc_devs[] = {
+#ifdef __rtems__
+   { DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A), 0,
+   "Intel 21140A 10/100BaseTX" },
+#endif /* __rtems__ */
{ DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143), 0,
"Intel 21143 10/100BaseTX" },
{ DC_DEVID(DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009), 0,
@@ -2076,6 +2080,9 @@ dc_attach(device_t dev)
dc_eeprom_width(sc);
 
switch (sc->dc_info->dc_devid) {
+#ifdef __rtems__
+   case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A):
+#endif /* __rtems__ */
case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143):
sc->dc_type = DC_TYPE_21143;
sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
@@ -2449,7 +2456,6 @@ dc_attach(device_t dev)
 
error = mii_attach(dev, &sc->dc_miibus, ifp, dc_ifmedia_upd,
dc_ifmedia_sts, BMSR_DEFCAPMASK, phy, MII_OFFSET_ANY, 0);
-
if (error && DC_IS_INTEL(sc)) {
sc->dc_pmode = tmp;
if (sc->dc_pmode != DC_PMODE_SIA)
@@ -2503,7 +2509,6 @@ dc_attach(device_t dev)
/* Hook interrupt last to avoid having to lock softc */
error = bus_setup_intr(dev, sc->dc_irq, INTR_TYPE_NET | INTR_MPSAFE,
NULL, dc_intr, sc, &sc->dc_intrhand);
-
if (error) {
device_printf(dev, "couldn't set up irq\n");
ether_ifdetach(ifp);
@@ -2602,7 +2607,6 @@ dc_list_tx_init(struct dc_softc *sc)
ld->dc_tx_list[i].dc_next = htole32(DC_TXDESC(sc, nexti));
cd->dc_tx_chain[i] = NULL;
}
-
cd->dc_tx_prod = cd->dc_tx_cons = cd->dc_tx_cnt = 0;
cd->dc_tx_pkts = 0;
bus_dmamap_sync(sc->dc_tx_ltag, sc->dc_tx_lmap,
diff --git a/freebsd/sys/dev/dc/if_dcreg.h b/freebsd/sys/dev/dc/if_dcreg.h
index 9ae26cc6..836e70f8 100644
--- a/freebsd/sys/dev/dc/if_dcreg.h
+++ b/freebsd/sys/dev/dc/if_dcreg.h
@@ -824,6 +824,13 @@ struct dc_softc {
  */
 #defineDC_VENDORID_DEC 0x1011
 
+#ifdef __rtems__
+/*
+ * DEC/Intel 21140 PCI device ID
+ */
+#defineDC_DEVICEID_21140A  0x0009
+#endif /* __rtems__ */
+
 /*
  * DEC/Intel 21143 PCI device ID
  */
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index c3c43dc9..d813addd 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -199,6 +199,8 @@ RTEMS_BSD_DRIVER_PCI_IGB;
 RTEMS_BSD_DRIVER_PCI_EM;
 RTEMS_BSD_DRIVER_PCI_RE;
 RTEMS_BSD_DRIVER_REPHY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_DCPHY;
 
 #elif defined(LIBBSP_POWERPC_QORIQ_BSP_H)
 
@@ -240,6 +242,8 @@ SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 #elif defined(LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H)
 
 RTEMS_BSD_DRIVER_PC_LEGACY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_UKPHY;
 
 #endif /* LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H */
 
diff --git a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h 
b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
index 5c95d2c3..752bc559 100644
--- a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
+++ b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
@@ -486,10 +486,26 @@ extern "C" {
 SYSINIT_DRIVER_REFERENCE(re, pci);
 #endif /* RTEMS_BSD_DRIVER_PCI_RE */
 
+/*
+ * DEC Tulip Driver
+ */
+#if !defined(RTEMS_BSD_DRIVER_PCI_DC)
+  #define RTEMS_BSD_DRIVER_PCI_DC \
+SYSINIT_DRIVER_REFERENCE(dc, pci);
+#endif /* RTEMS_BSD_DRIVER_PCI_DC */
+
 /**
  ** MMI Physical Layer Support.
  **/
 
+/*
+ * UK PHY (for unknown PHY devices)
+ */
+#if !defined(RTEMS_BSD_DRIVER_UKPHY)
+  #define RTEMS_BSD_DRIVER_UKPHY   \
+SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_UKPHY */
+
 /*
  * E1000 PHY
  */
@@ -522,6 +538,22 @@ extern "C" {
 SYSINIT_DRIVER_REFERENCE(micphy, miibus);
 #endif /* RTEMS_BSD_DRIVER_PHY_MIC */
 
+/*
+ * DC PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_DCPHY)
+  #define RTEMS_BSD_DRIVER_DCPHY  \
+SYSINIT_DRIVER_REFERENCE(dcphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_DCPHY */
+
+/*
+ * PN PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_PNPHY)
+  #define RTEMS_BSD_DRIVER_PNPHY  \
+SYSINIT_DRIVER_REFERENCE(pnphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_PNPHY */
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-- 
2

[6-freebsd-12 PATCH 1/2] rtemsbsd/bus: Add PCI support to the nexus bus

2021-02-15 Thread chrisj
From: Chris Johns 

- Add PCI IO region support

- Add support map buffers to PCI address space

Closes #4245
---
 rtemsbsd/include/machine/bus.h| 124 ++
 rtemsbsd/rtems/rtems-kernel-bus-dma.c |   5 +-
 rtemsbsd/rtems/rtems-kernel-nexus.c   |  23 +++--
 3 files changed, 126 insertions(+), 26 deletions(-)

diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h
index 2f0e7ad6..8b313f37 100644
--- a/rtemsbsd/include/machine/bus.h
+++ b/rtemsbsd/include/machine/bus.h
@@ -6,9 +6,13 @@
  * @brief TODO.
  *
  * File origin from FreeBSD 'sys/amd64/include/bus.h'.
+ *
+ * Conditionally supports PCI IO regions (IO Ports).
  */
 
 /*-
+ * Copyright (c) 2021 Chris Johns.  All rights reserved.
+ *
  * Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
@@ -25,7 +29,7 @@
  * 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 as
  *the first lines of this file unmodified.
@@ -34,7 +38,7 @@
  *documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
  *derived from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
@@ -126,6 +130,38 @@
   #error "your include paths are wrong"
 #endif
 
+/*
+ * Values for the bus space tag, not to be used directly by MI code.
+ */
+#defineBSP_BUS_SPACE_IO0   /* space is i/o space */
+#defineBSP_BUS_SPACE_MEM   1   /* space is mem space */
+
+/*
+ * BSP PCI Support
+ *
+ * The RTEMS Nexus bus support can optionaly support PCI spaces that
+ * mapped to BSP speciic address spaces. Add the following define to
+ * the BSP header file to enable this support:
+ *
+ *  #define BSP_HAS_PCI
+ *
+ * If enabled a BSP must the following IO region calls:
+ *
+ * inb  : read 8 bits
+ * outb : write 8 bits
+ * inw  : read 16 bits
+ * outw : write 16 bits
+ * inl  : read 32 bits
+ * outl : write 32 bits
+ *
+ * The BSP needs to provide the DRAM address space offset
+ * PCI_DRAM_OFFSET. This is the base address of the DRAM as seen by a
+ * PCI master.
+ *
+ * i386 BSPs have a special bus.h file and do not use this file.
+ */
+#include 
+
 /*
  * Bus address alignment.
  */
@@ -144,6 +180,7 @@
 /*
  * Bus access.
  */
+#define BUS_SPACE_INVALID_DATA (~0)
 #define BUS_SPACE_UNRESTRICTED (~0U)
 
 /*
@@ -228,29 +265,52 @@ bus_space_barrier(bus_space_tag_t bst __unused, 
bus_space_handle_t bsh, bus_size
  * data is returned.
  */
 static __inline uint8_t
-bus_space_read_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO) {
+#ifdef BSP_HAS_PCI
+   return inb(bsh + ofs);
+#else
+   return BUS_SPACE_INVALID_DATA;
+#endif
+   }
uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs);
return (*bsp);
 }
 
 static __inline uint16_t
-bus_space_read_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO) {
+#ifdef BSP_HAS_PCI
+   return inw(bsh + ofs);
+#else
+   return BUS_SPACE_INVALID_DATA;
+#endif
+   }
uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs);
return (*bsp);
 }
 
 static __inline uint32_t
-bus_space_read_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO) {
+#ifdef BSP_HAS_PCI
+   return inl(bsh + ofs);
+#else
+   return BUS_SPACE_INVALID_DATA;
+#endif
+   }
uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs);
return (*bsp);
 }
 
 static __inline uint64_t
-bus_space_read_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO)
+   return BUS_SPACE_INVALID_DATA;
uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs);
return (*bsp);
 }
@@ -262,35 +322,63 @@ bus_space_read_8(bus_space_tag_t bst __unused, 
bus_space_handle_t bsh, bus_size_
  * data is passed by value.
  */
 static __inline void
-bus_space_write_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
b

[6-freebsd-12 PATCH v2 1/2] rtemsbsd/bus: Add PCI support to the nexus bus

2021-02-15 Thread chrisj
From: Chris Johns 

- Add PCI IO region support

- Add support map buffers to PCI address space

Closes #4245
---
 rtemsbsd/include/machine/bus.h| 124 ++
 rtemsbsd/rtems/rtems-kernel-bus-dma.c |   5 +-
 rtemsbsd/rtems/rtems-kernel-nexus.c   |  23 +++--
 3 files changed, 126 insertions(+), 26 deletions(-)

diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h
index 2f0e7ad6..8b313f37 100644
--- a/rtemsbsd/include/machine/bus.h
+++ b/rtemsbsd/include/machine/bus.h
@@ -6,9 +6,13 @@
  * @brief TODO.
  *
  * File origin from FreeBSD 'sys/amd64/include/bus.h'.
+ *
+ * Conditionally supports PCI IO regions (IO Ports).
  */
 
 /*-
+ * Copyright (c) 2021 Chris Johns.  All rights reserved.
+ *
  * Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
@@ -25,7 +29,7 @@
  * 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 as
  *the first lines of this file unmodified.
@@ -34,7 +38,7 @@
  *documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
  *derived from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
@@ -126,6 +130,38 @@
   #error "your include paths are wrong"
 #endif
 
+/*
+ * Values for the bus space tag, not to be used directly by MI code.
+ */
+#defineBSP_BUS_SPACE_IO0   /* space is i/o space */
+#defineBSP_BUS_SPACE_MEM   1   /* space is mem space */
+
+/*
+ * BSP PCI Support
+ *
+ * The RTEMS Nexus bus support can optionaly support PCI spaces that
+ * mapped to BSP speciic address spaces. Add the following define to
+ * the BSP header file to enable this support:
+ *
+ *  #define BSP_HAS_PCI
+ *
+ * If enabled a BSP must the following IO region calls:
+ *
+ * inb  : read 8 bits
+ * outb : write 8 bits
+ * inw  : read 16 bits
+ * outw : write 16 bits
+ * inl  : read 32 bits
+ * outl : write 32 bits
+ *
+ * The BSP needs to provide the DRAM address space offset
+ * PCI_DRAM_OFFSET. This is the base address of the DRAM as seen by a
+ * PCI master.
+ *
+ * i386 BSPs have a special bus.h file and do not use this file.
+ */
+#include 
+
 /*
  * Bus address alignment.
  */
@@ -144,6 +180,7 @@
 /*
  * Bus access.
  */
+#define BUS_SPACE_INVALID_DATA (~0)
 #define BUS_SPACE_UNRESTRICTED (~0U)
 
 /*
@@ -228,29 +265,52 @@ bus_space_barrier(bus_space_tag_t bst __unused, 
bus_space_handle_t bsh, bus_size
  * data is returned.
  */
 static __inline uint8_t
-bus_space_read_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_1(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO) {
+#ifdef BSP_HAS_PCI
+   return inb(bsh + ofs);
+#else
+   return BUS_SPACE_INVALID_DATA;
+#endif
+   }
uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs);
return (*bsp);
 }
 
 static __inline uint16_t
-bus_space_read_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_2(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO) {
+#ifdef BSP_HAS_PCI
+   return inw(bsh + ofs);
+#else
+   return BUS_SPACE_INVALID_DATA;
+#endif
+   }
uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs);
return (*bsp);
 }
 
 static __inline uint32_t
-bus_space_read_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_4(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO) {
+#ifdef BSP_HAS_PCI
+   return inl(bsh + ofs);
+#else
+   return BUS_SPACE_INVALID_DATA;
+#endif
+   }
uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs);
return (*bsp);
 }
 
 static __inline uint64_t
-bus_space_read_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
+bus_space_read_8(bus_space_tag_t bst, bus_space_handle_t bsh, bus_size_t ofs)
 {
+   if (bst == BSP_BUS_SPACE_IO)
+   return BUS_SPACE_INVALID_DATA;
uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs);
return (*bsp);
 }
@@ -262,35 +322,63 @@ bus_space_read_8(bus_space_tag_t bst __unused, 
bus_space_handle_t bsh, bus_size_
  * data is passed by value.
  */
 static __inline void
-bus_space_write_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
b

[6-freebsd-12 PATCH v2 2/2] bsp/motorola_powerpc: Add dc and ukphy support

2021-02-15 Thread chrisj
From: Chris Johns 

- Add the dc net dev to the BSP

- Add the ukphy support

Closes # 4246
---
 freebsd/sys/dev/dc/if_dc.c|  7 
 freebsd/sys/dev/dc/if_dcreg.h |  7 
 rtemsbsd/include/bsp/nexus-devices.h  |  4 +++
 .../include/machine/rtems-bsd-nexus-bus.h | 32 +++
 4 files changed, 50 insertions(+)

diff --git a/freebsd/sys/dev/dc/if_dc.c b/freebsd/sys/dev/dc/if_dc.c
index 7fc0ef54..b36967da 100644
--- a/freebsd/sys/dev/dc/if_dc.c
+++ b/freebsd/sys/dev/dc/if_dc.c
@@ -156,6 +156,10 @@ MODULE_DEPEND(dc, miibus, 1, 1, 1);
  * Various supported device vendors/types and their names.
  */
 static const struct dc_type dc_devs[] = {
+#ifdef __rtems__
+   { DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A), 0,
+   "Intel 21140A 10/100BaseTX" },
+#endif /* __rtems__ */
{ DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143), 0,
"Intel 21143 10/100BaseTX" },
{ DC_DEVID(DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009), 0,
@@ -2076,6 +2080,9 @@ dc_attach(device_t dev)
dc_eeprom_width(sc);
 
switch (sc->dc_info->dc_devid) {
+#ifdef __rtems__
+   case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A):
+#endif /* __rtems__ */
case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143):
sc->dc_type = DC_TYPE_21143;
sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
diff --git a/freebsd/sys/dev/dc/if_dcreg.h b/freebsd/sys/dev/dc/if_dcreg.h
index 9ae26cc6..836e70f8 100644
--- a/freebsd/sys/dev/dc/if_dcreg.h
+++ b/freebsd/sys/dev/dc/if_dcreg.h
@@ -824,6 +824,13 @@ struct dc_softc {
  */
 #defineDC_VENDORID_DEC 0x1011
 
+#ifdef __rtems__
+/*
+ * DEC/Intel 21140 PCI device ID
+ */
+#defineDC_DEVICEID_21140A  0x0009
+#endif /* __rtems__ */
+
 /*
  * DEC/Intel 21143 PCI device ID
  */
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index c3c43dc9..d813addd 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -199,6 +199,8 @@ RTEMS_BSD_DRIVER_PCI_IGB;
 RTEMS_BSD_DRIVER_PCI_EM;
 RTEMS_BSD_DRIVER_PCI_RE;
 RTEMS_BSD_DRIVER_REPHY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_DCPHY;
 
 #elif defined(LIBBSP_POWERPC_QORIQ_BSP_H)
 
@@ -240,6 +242,8 @@ SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 #elif defined(LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H)
 
 RTEMS_BSD_DRIVER_PC_LEGACY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_UKPHY;
 
 #endif /* LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H */
 
diff --git a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h 
b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
index 5c95d2c3..752bc559 100644
--- a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
+++ b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
@@ -486,10 +486,26 @@ extern "C" {
 SYSINIT_DRIVER_REFERENCE(re, pci);
 #endif /* RTEMS_BSD_DRIVER_PCI_RE */
 
+/*
+ * DEC Tulip Driver
+ */
+#if !defined(RTEMS_BSD_DRIVER_PCI_DC)
+  #define RTEMS_BSD_DRIVER_PCI_DC \
+SYSINIT_DRIVER_REFERENCE(dc, pci);
+#endif /* RTEMS_BSD_DRIVER_PCI_DC */
+
 /**
  ** MMI Physical Layer Support.
  **/
 
+/*
+ * UK PHY (for unknown PHY devices)
+ */
+#if !defined(RTEMS_BSD_DRIVER_UKPHY)
+  #define RTEMS_BSD_DRIVER_UKPHY   \
+SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_UKPHY */
+
 /*
  * E1000 PHY
  */
@@ -522,6 +538,22 @@ extern "C" {
 SYSINIT_DRIVER_REFERENCE(micphy, miibus);
 #endif /* RTEMS_BSD_DRIVER_PHY_MIC */
 
+/*
+ * DC PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_DCPHY)
+  #define RTEMS_BSD_DRIVER_DCPHY  \
+SYSINIT_DRIVER_REFERENCE(dcphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_DCPHY */
+
+/*
+ * PN PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_PNPHY)
+  #define RTEMS_BSD_DRIVER_PNPHY  \
+SYSINIT_DRIVER_REFERENCE(pnphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_PNPHY */
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-- 
2.24.1

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


[5 PATCH] Update motorola_power to irq-generic interrupt management

2021-02-15 Thread chrisj
From: Chris Johns 

- Add support to the BSP to enable irq-generic management

- Update the powerpc shared irq code to support irq-generic. This
  is an opt in option for existing powerpc bsps. This change
  should be simpler now

- Fix a number of issues in ISA IRQ controller handling by porting
  fixes from the i386 (PC) BSP

Closes #4247
Closes #4248
---
 bsps/powerpc/include/bsp/irq_supp.h   |   5 +
 .../motorola_powerpc/include/bsp/irq.h|  15 +-
 .../powerpc/motorola_powerpc/start/bspstart.c |   7 +-
 bsps/powerpc/shared/irq/i8259.c   | 152 ++
 bsps/powerpc/shared/irq/irq_init.c|  15 +-
 bsps/powerpc/shared/irq/openpic_i8259_irq.c   |  27 ++--
 bsps/powerpc/shared/irq/ppc-irq-generic.c | 117 ++
 .../powerpc/motorola_powerpc/Makefile.am  |   5 +-
 8 files changed, 286 insertions(+), 57 deletions(-)
 create mode 100644 bsps/powerpc/shared/irq/ppc-irq-generic.c

diff --git a/bsps/powerpc/include/bsp/irq_supp.h 
b/bsps/powerpc/include/bsp/irq_supp.h
index 65af48c87f..fbb16d6211 100644
--- a/bsps/powerpc/include/bsp/irq_supp.h
+++ b/bsps/powerpc/include/bsp/irq_supp.h
@@ -50,6 +50,11 @@ extern int  BSP_disable_irq_at_pic(const rtems_irq_number 
irqLine);
  */
 extern int  BSP_setup_the_pic(rtems_irq_global_settings* config);
 
+/*
+ * Set up for the irq-generic.h interface.
+ */
+int BSP_rtems_irq_generic_set(rtems_irq_global_settings* config);
+
 /* IRQ dispatcher to be defined by the PIC driver; note that it MUST
  * implement shared interrupts.
  * Note also that the exception frame passed to this handler is not very
diff --git a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h 
b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
index 3690dbbff7..cbb6ff69cf 100644
--- a/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
+++ b/bsps/powerpc/motorola_powerpc/include/bsp/irq.h
@@ -19,9 +19,17 @@
 #ifndef BSP_POWERPC_IRQ_H
 #define BSP_POWERPC_IRQ_H
 
+#ifndef BSP_SHARED_HANDLER_SUPPORT
 #define BSP_SHARED_HANDLER_SUPPORT  1
+#endif
+
 #include 
-#include 
+
+/*
+ * Switch to using the generic support. Remove this when all BSPs have
+ * been converted.
+ */
+#define BSP_POWERPC_IRQ_GENERIC_SUPPORT 1
 
 /*
  * 8259 edge/level control definitions at VIA
@@ -107,6 +115,8 @@ extern "C" {
 #define BSP_IRQ_NUMBER (BSP_MISC_IRQ_MAX_OFFSET + 1)
 #define BSP_LOWEST_OFFSET  (BSP_ISA_IRQ_LOWEST_OFFSET)
 #define BSP_MAX_OFFSET (BSP_MISC_IRQ_MAX_OFFSET)
+#define BSP_INTERRUPT_VECTOR_MIN   (BSP_LOWEST_OFFSET)
+#define BSP_INTERRUPT_VECTOR_MAX   (BSP_MAX_OFFSET)
 /*
  * Some ISA IRQ symbolic name definition
  */
@@ -191,6 +201,9 @@ int BSP_irq_ack_at_i8259s   (const 
rtems_irq_number irqLine);
  */
 int BSP_irq_enabled_at_i8259s  (const rtems_irq_number irqLine);
 
+unsigned short BSP_irq_suspend_i8259s(unsigned short mask);
+void BSP_irq_resume_i8259s(unsigned short in_progress_save);
+
 extern void BSP_rtems_irq_mng_init(unsigned cpuId);
 extern void BSP_i8259s_init(void);
 
diff --git a/bsps/powerpc/motorola_powerpc/start/bspstart.c 
b/bsps/powerpc/motorola_powerpc/start/bspstart.c
index e74b02c446..ef8418e2c6 100644
--- a/bsps/powerpc/motorola_powerpc/start/bspstart.c
+++ b/bsps/powerpc/motorola_powerpc/start/bspstart.c
@@ -27,6 +27,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -334,10 +335,8 @@ static void bsp_early( void )
*/
   bsp_clicks_per_usec   = BSP_bus_frequency/(BSP_time_base_divisor * 1000);
 
-  /*
-   * Initalize RTEMS IRQ system
-   */
-  BSP_rtems_irq_mng_init(0);
+  /* Initialize interrupt support */
+  bsp_interrupt_initialize();
 
   /* Activate the page table mappings only after
* initializing interrupts because the irq_mng_init()
diff --git a/bsps/powerpc/shared/irq/i8259.c b/bsps/powerpc/shared/irq/i8259.c
index 7363e87ba0..6a80e24946 100644
--- a/bsps/powerpc/shared/irq/i8259.c
+++ b/bsps/powerpc/shared/irq/i8259.c
@@ -12,6 +12,19 @@
 #include 
 #include 
 
+#define PIC_EOSI0x60///< End of Specific Interrupt (EOSI)
+#define PIC_EOI 0x20///< Generic End of Interrupt (EOI)
+
+/* Operation control word type 3.  Bit 3 (0x08) must be set. Even address. */
+#define PIC_OCW3_RIS0x01/* 1 = read IS, 0 = read IR */
+#define PIC_OCW3_RR 0x02/* register read */
+#define PIC_OCW3_P  0x04/* poll mode command */
+/* 0x08 must be 1 to select OCW3 vs OCW2 */
+#define PIC_OCW3_SEL0x08/* must be 1 */
+/* 0x10 must be 0 to select OCW3 vs ICW1 */
+#define PIC_OCW3_SMM0x20/* special mode mask */
+#define PIC_OCW3_ESMM   0x40/* enable SMM */
+
 /*-+
 | Cache for 1st and 2nd PIC IRQ line's status (enabled or disabled) register.
 +--*/
@@ -19,91 +3

[libbsd PATCH v2 2/2] bsp/motorola_powerpc: Add dc and ukphy support

2021-02-16 Thread chrisj
From: Chris Johns 

- Add the dc net dev to the BSP

- Add the ukphy support

Closes # 4246
---
 freebsd/sys/dev/dc/if_dc.c|  7 
 freebsd/sys/dev/dc/if_dcreg.h |  7 
 rtemsbsd/include/bsp/nexus-devices.h  |  4 +++
 .../include/machine/rtems-bsd-nexus-bus.h | 32 +++
 4 files changed, 50 insertions(+)

diff --git a/freebsd/sys/dev/dc/if_dc.c b/freebsd/sys/dev/dc/if_dc.c
index 7fc0ef54..b36967da 100644
--- a/freebsd/sys/dev/dc/if_dc.c
+++ b/freebsd/sys/dev/dc/if_dc.c
@@ -156,6 +156,10 @@ MODULE_DEPEND(dc, miibus, 1, 1, 1);
  * Various supported device vendors/types and their names.
  */
 static const struct dc_type dc_devs[] = {
+#ifdef __rtems__
+   { DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A), 0,
+   "Intel 21140A 10/100BaseTX" },
+#endif /* __rtems__ */
{ DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143), 0,
"Intel 21143 10/100BaseTX" },
{ DC_DEVID(DC_VENDORID_DAVICOM, DC_DEVICEID_DM9009), 0,
@@ -2076,6 +2080,9 @@ dc_attach(device_t dev)
dc_eeprom_width(sc);
 
switch (sc->dc_info->dc_devid) {
+#ifdef __rtems__
+   case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21140A):
+#endif /* __rtems__ */
case DC_DEVID(DC_VENDORID_DEC, DC_DEVICEID_21143):
sc->dc_type = DC_TYPE_21143;
sc->dc_flags |= DC_TX_POLL | DC_TX_USE_TX_INTR;
diff --git a/freebsd/sys/dev/dc/if_dcreg.h b/freebsd/sys/dev/dc/if_dcreg.h
index 9ae26cc6..1c5d39a0 100644
--- a/freebsd/sys/dev/dc/if_dcreg.h
+++ b/freebsd/sys/dev/dc/if_dcreg.h
@@ -824,6 +824,13 @@ struct dc_softc {
  */
 #defineDC_VENDORID_DEC 0x1011
 
+#ifdef __rtems__
+/*
+ * DEC/Intel 21140 PCI device ID
+ */
+#defineDC_DEVICEID_21140A  0x0009
+
+#endif /* __rtems__ */
 /*
  * DEC/Intel 21143 PCI device ID
  */
diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index c3c43dc9..d813addd 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -199,6 +199,8 @@ RTEMS_BSD_DRIVER_PCI_IGB;
 RTEMS_BSD_DRIVER_PCI_EM;
 RTEMS_BSD_DRIVER_PCI_RE;
 RTEMS_BSD_DRIVER_REPHY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_DCPHY;
 
 #elif defined(LIBBSP_POWERPC_QORIQ_BSP_H)
 
@@ -240,6 +242,8 @@ SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
 #elif defined(LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H)
 
 RTEMS_BSD_DRIVER_PC_LEGACY;
+RTEMS_BSD_DRIVER_PCI_DC;
+RTEMS_BSD_DRIVER_UKPHY;
 
 #endif /* LIBBSP_POWERPC_MOTOROLA_POWERPC_BSP_H */
 
diff --git a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h 
b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
index 5c95d2c3..752bc559 100644
--- a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
+++ b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
@@ -486,10 +486,26 @@ extern "C" {
 SYSINIT_DRIVER_REFERENCE(re, pci);
 #endif /* RTEMS_BSD_DRIVER_PCI_RE */
 
+/*
+ * DEC Tulip Driver
+ */
+#if !defined(RTEMS_BSD_DRIVER_PCI_DC)
+  #define RTEMS_BSD_DRIVER_PCI_DC \
+SYSINIT_DRIVER_REFERENCE(dc, pci);
+#endif /* RTEMS_BSD_DRIVER_PCI_DC */
+
 /**
  ** MMI Physical Layer Support.
  **/
 
+/*
+ * UK PHY (for unknown PHY devices)
+ */
+#if !defined(RTEMS_BSD_DRIVER_UKPHY)
+  #define RTEMS_BSD_DRIVER_UKPHY   \
+SYSINIT_DRIVER_REFERENCE(ukphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_UKPHY */
+
 /*
  * E1000 PHY
  */
@@ -522,6 +538,22 @@ extern "C" {
 SYSINIT_DRIVER_REFERENCE(micphy, miibus);
 #endif /* RTEMS_BSD_DRIVER_PHY_MIC */
 
+/*
+ * DC PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_DCPHY)
+  #define RTEMS_BSD_DRIVER_DCPHY  \
+SYSINIT_DRIVER_REFERENCE(dcphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_DCPHY */
+
+/*
+ * PN PHY.
+ */
+#if !defined(RTEMS_BSD_DRIVER_PNPHY)
+  #define RTEMS_BSD_DRIVER_PNPHY  \
+SYSINIT_DRIVER_REFERENCE(pnphy, miibus);
+#endif /* RTEMS_BSD_DRIVER_PNPHY */
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
-- 
2.27.0

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


[libbsd PATCH v2 1/2] rtemsbsd/bus: Add PCI support to the nexus bus

2021-02-16 Thread chrisj
From: Chris Johns 

- Add PCI IO region support

- Add support map buffers to PCI address space

Closes #4245
---
 rtemsbsd/include/machine/bus.h| 282 --
 rtemsbsd/rtems/rtems-kernel-bus-dma.c |   5 +-
 rtemsbsd/rtems/rtems-kernel-nexus.c   |  50 -
 3 files changed, 222 insertions(+), 115 deletions(-)

diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h
index 2f0e7ad6..42148ee3 100644
--- a/rtemsbsd/include/machine/bus.h
+++ b/rtemsbsd/include/machine/bus.h
@@ -6,9 +6,13 @@
  * @brief TODO.
  *
  * File origin from FreeBSD 'sys/amd64/include/bus.h'.
+ *
+ * Conditionally supports PCI IO regions (IO Ports).
  */
 
 /*-
+ * Copyright (c) 2021 Chris Johns.  All rights reserved.
+ *
  * Copyright (c) 2009, 2015 embedded brains GmbH.  All rights reserved.
  *
  *  embedded brains GmbH
@@ -25,7 +29,7 @@
  * 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 as
  *the first lines of this file unmodified.
@@ -34,7 +38,7 @@
  *documentation and/or other materials provided with the distribution.
  * 3. The name of the author may not be used to endorse or promote products
  *derived from this software without specific prior written permission.
- * 
+ *
  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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.
@@ -123,7 +127,7 @@
 #endif
 
 #ifdef __i386__
-  #error "your include paths are wrong"
+  #error "x86 has its own bus.h; check your include paths are correct"
 #endif
 
 /*
@@ -144,6 +148,7 @@
 /*
  * Bus access.
  */
+#define BUS_SPACE_INVALID_DATA (~0)
 #define BUS_SPACE_UNRESTRICTED (~0U)
 
 /*
@@ -222,6 +227,93 @@ bus_space_barrier(bus_space_tag_t bst __unused, 
bus_space_handle_t bsh, bus_size
/* Do nothing */
 }
 
+
+/*
+ * BSP or linear inline memory access.
+ */
+#include 
+
+static __inline uint8_t
+bsp_bus_space_read_1(const uint8_t __volatile *bsp)
+{
+#if defined(RTEMS_BSP_READ_1)
+   return RTEMS_BSP_READ_1(bsp);
+#else
+   return (*bsp);
+#endif
+}
+
+static __inline uint16_t
+bsp_bus_space_read_2(const uint16_t __volatile *bsp)
+{
+#if defined(RTEMS_BSP_READ_2)
+   return RTEMS_BSP_READ_2(bsp);
+#else
+   return (*bsp);
+#endif
+}
+
+static __inline uint32_t
+bsp_bus_space_read_4(const uint32_t __volatile *bsp)
+{
+#if defined(RTEMS_BSP_READ_4)
+   return RTEMS_BSP_READ_4(bsp);
+#else
+   return (*bsp);
+#endif
+}
+
+static __inline uint64_t
+bsp_bus_space_read_8(const uint64_t __volatile *bsp)
+{
+#if defined(RTEMS_BSP_READ_8)
+   return RTEMS_BSP_READ_8(bsp);
+#else
+   return (*bsp);
+#endif
+}
+
+static __inline void
+bsp_bus_space_write_1(uint8_t __volatile *bsp, uint8_t val)
+{
+#if defined(RTEMS_BSP_WRITE_1)
+   RTEMS_BSP_WRITE_1(bsp, val);
+#else
+   *bsp = val;
+#endif
+}
+
+static __inline void
+bsp_bus_space_write_2(uint16_t __volatile *bsp, uint16_t val)
+{
+#if defined(RTEMS_BSP_WRITE_2)
+   RTEMS_BSP_WRITE_2(bsp, val);
+#else
+   *bsp = val;
+#endif
+}
+
+static __inline void
+bsp_bus_space_write_4(uint32_t __volatile *bsp, uint32_t val)
+{
+#if defined(RTEMS_BSP_WRITE_4)
+   RTEMS_BSP_WRITE_4(bsp, val);
+#else
+   *bsp = val;
+#endif
+}
+
+static __inline void
+bsp_bus_space_write_8(uint64_t __volatile *bsp, uint64_t val)
+{
+#if defined(RTEMS_BSP_WRITE_8)
+   RTEMS_BSP_WRITE_8(bsp, val);
+#else
+   *bsp = val;
+#endif
+}
+
+
 /*
  * Read 1 unit of data from bus space described by the tag, handle and ofs
  * tuple. A unit of data can be 1 byte, 2 bytes, 4 bytes or 8 bytes. The
@@ -231,28 +323,28 @@ static __inline uint8_t
 bus_space_read_1(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
 {
uint8_t __volatile *bsp = (uint8_t __volatile *)(bsh + ofs);
-   return (*bsp);
+   return bsp_bus_space_read_1(bsp);
 }
 
 static __inline uint16_t
 bus_space_read_2(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
 {
uint16_t __volatile *bsp = (uint16_t __volatile *)(bsh + ofs);
-   return (*bsp);
+   return bsp_bus_space_read_2(bsp);
 }
 
 static __inline uint32_t
 bus_space_read_4(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
 {
uint32_t __volatile *bsp = (uint32_t __volatile *)(bsh + ofs);
-   return (*bsp);
+   return bsp_bus_space_read_4(bsp);
 }
 
 static __inline uint64_t
 bus_space_read_8(bus_space_tag_t bst __unused, bus_space_handle_t bsh, 
bus_size_t ofs)
 {
uint64_t __volatile *bsp = (uint64_t __volatile *)(bsh + ofs);
-   return (*bsp);
+   return bsp_bus_space_read_8(bsp);
 }
 
 
@@ -266,7 +358,7 @@

[5 PATCH] powerpc/motorola_power: Link all text sections into the executable image

2021-02-23 Thread chrisj
From: Chris Johns 

- The change to building all code with code and data sections means
  we have a section per function. Make sure all functions are
  placed in the text section.

Closes #4266
---
 bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds 
b/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
index 0ee7447546..a87a07cfd7 100644
--- a/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
+++ b/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
@@ -38,6 +38,7 @@ SECTIONS
 BYTE(0x75); BYTE(0x78); /* Partition name */
 . = 0x400;
 *(.text)
+*(.text*)
 *(.sdata2)
 *(.rodata)
 *(.rodata*)
@@ -98,4 +99,3 @@ SECTIONS
 *(.comment)
   }
 }
-
-- 
2.24.1

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


[5 PATCH] powerpc/motorola_power: Place any common data in the .bss section

2021-02-26 Thread chrisj
From: Chris Johns 

- It seems the compiler how defaults to -fcommon and this means
  some uninitialised data is ignored.

Closes #4266
---
 bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds 
b/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
index a87a07cfd7..501acc40dc 100644
--- a/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
+++ b/bsps/powerpc/motorola_powerpc/bootloader/ppcboot.lds
@@ -40,6 +40,7 @@ SECTIONS
 *(.text)
 *(.text*)
 *(.sdata2)
+*(.sdata2*)
 *(.rodata)
 *(.rodata*)
   }
@@ -72,13 +73,17 @@ SECTIONS
 *(.data)
 *(.data*)
 *(.sdata)
+*(.sdata*)
 . = ALIGN(4);
 _data_end = .;
   }
   .bss :
   {
 *(.sbss)
+*(.sbss*)
 *(.bss)
+*(.bss*)
+*(COMMON)
 . = ALIGN(4);
 _bss_end = .;
   }
@@ -96,6 +101,7 @@ SECTIONS
 
   /DISCARD/ : 
   {
-*(.comment)
+*(.comment*)
+*(.debug*)
   }
 }
-- 
2.27.0

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


[PATCH 1/2] Fix the linux specific include

2021-05-10 Thread chrisj
From: Chris Johns 

---
 common/latex.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/latex.py b/common/latex.py
index a1b3917..17d3015 100644
--- a/common/latex.py
+++ b/common/latex.py
@@ -4,10 +4,6 @@
 
 import os
 import re
-try:
-from distro import linux_distribution
-except:
-from platform import linux_distribution
 
 package_test_preamble = ['\\newif\\ifsphinxKeepOldNames 
\\sphinxKeepOldNamestrue',
  '\documentclass[a4paper,11pt,english]{report}']
@@ -85,6 +81,10 @@ def tex_test(test):
 def host_name():
 uname = os.uname()
 if uname[0] == 'Linux':
+try:
+from distro import linux_distribution
+except:
+from platform import linux_distribution
 distro = linux_distribution()
 name = '%s/%s' % (uname[0], distro[0])
 version = distro[1]
-- 
2.24.3 (Apple Git-128)

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


[PATCH 2/2] Fix the bibtex extension configure test

2021-05-10 Thread chrisj
From: Chris Johns 

---
 common/waf.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/waf.py b/common/waf.py
index 3806209..fa9aecb 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -181,10 +181,12 @@ def check_sphinx_extension(ctx, extension):
 def run_sphinx(bld):
 rst_node = bld.srcnode.make_node('testbuild/contents.rst')
 rst_node.parent.mkdir()
-rst_node.write('.. COMMENT test sphinx\n')
+rst_node.write('.. COMMENT test sphinx' + os.linesep)
 bib_node = bld.srcnode.make_node('testbuild/refs.bib')
+bib_node.write(os.linesep)
 conf_node = bld.srcnode.make_node('testbuild/conf.py')
-conf_node.write("bibtex_bibfiles = ['refs.bib']\n")
+conf_node.write(os.linesep.join(["master_doc='contents'",
+ "bibtex_bibfiles = ['refs.bib']"]))
 bld(rule = bld.kw['rule'], source = rst_node)
 
 ctx.start_msg("Checking for '%s'" % (extension))
-- 
2.24.3 (Apple Git-128)

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


[PATCH 1/2] Fix the linux specific include

2021-05-20 Thread chrisj
From: Chris Johns 

---
 common/latex.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/common/latex.py b/common/latex.py
index a1b3917..17d3015 100644
--- a/common/latex.py
+++ b/common/latex.py
@@ -4,10 +4,6 @@
 
 import os
 import re
-try:
-from distro import linux_distribution
-except:
-from platform import linux_distribution
 
 package_test_preamble = ['\\newif\\ifsphinxKeepOldNames 
\\sphinxKeepOldNamestrue',
  '\documentclass[a4paper,11pt,english]{report}']
@@ -85,6 +81,10 @@ def tex_test(test):
 def host_name():
 uname = os.uname()
 if uname[0] == 'Linux':
+try:
+from distro import linux_distribution
+except:
+from platform import linux_distribution
 distro = linux_distribution()
 name = '%s/%s' % (uname[0], distro[0])
 version = distro[1]
-- 
2.24.3 (Apple Git-128)

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


[PATCH 2/2] Fix the bibtex extension configure test

2021-05-20 Thread chrisj
From: Chris Johns 

---
 common/waf.py | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/waf.py b/common/waf.py
index 3806209..fa9aecb 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -181,10 +181,12 @@ def check_sphinx_extension(ctx, extension):
 def run_sphinx(bld):
 rst_node = bld.srcnode.make_node('testbuild/contents.rst')
 rst_node.parent.mkdir()
-rst_node.write('.. COMMENT test sphinx\n')
+rst_node.write('.. COMMENT test sphinx' + os.linesep)
 bib_node = bld.srcnode.make_node('testbuild/refs.bib')
+bib_node.write(os.linesep)
 conf_node = bld.srcnode.make_node('testbuild/conf.py')
-conf_node.write("bibtex_bibfiles = ['refs.bib']\n")
+conf_node.write(os.linesep.join(["master_doc='contents'",
+ "bibtex_bibfiles = ['refs.bib']"]))
 bld(rule = bld.kw['rule'], source = rst_node)
 
 ctx.start_msg("Checking for '%s'" % (extension))
-- 
2.24.3 (Apple Git-128)

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


[PATCH] defaults.mc: Remove any checks for objdump and objcopy

2021-06-30 Thread chrisj
From: Chris Johns 

- FreeBSD is removing any dependence on binutils and release 13
  has remove objdump. This is fine as we build our own version.
---
 source-builder/defaults.mc | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/source-builder/defaults.mc b/source-builder/defaults.mc
index 8ed7003..98775e8 100644
--- a/source-builder/defaults.mc
+++ b/source-builder/defaults.mc
@@ -184,13 +184,12 @@ __mkdir: exe, required, '/bin/mkdir'
 __mkdir_p:   exe, none, '/bin/mkdir -p'
 __mv:exe, required, '/bin/mv'
 __nm:exe, required, '/usr/bin/nm'
-__objcopy:   exe, optional, '/usr/bin/objcopy'
-__objdump:   exe, optional, '/usr/bin/objdump'
+__objcopy:   exe, none, '/usr/bin/objcopy'
+__objdump:   exe, none, '/usr/bin/objdump'
 __patch_bin: exe, required, '/usr/bin/patch'
 __patch_opts:none,none, '%{nil}'
 __patch: exe, none, '%{__patch_bin} %{__patch_opts}'
 __perl:  exe, optional, 'perl'
-__svn:   exe, optional, '/usr/bin/svn'
 __ranlib:exe, required, 'ranlib'
 __rm:exe, required, '/bin/rm'
 __rmfile:exe, none, '%{__rm} -f'
-- 
2.31.1

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


[PATCH] covoar: Fix errors building on FreeBSD and clang

2021-06-30 Thread chrisj
From: Chris Johns 

- The member variable `path_` cannot be a reference and initialised to
  a const char* type input. To do so would require there is a temporary with
  an unspecified life time.
---
 tester/covoar/AddressToLineMapper.h | 2 +-
 tester/covoar/Target_aarch64.h  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tester/covoar/AddressToLineMapper.h 
b/tester/covoar/AddressToLineMapper.h
index 88bf475..c78aef7 100644
--- a/tester/covoar/AddressToLineMapper.h
+++ b/tester/covoar/AddressToLineMapper.h
@@ -84,7 +84,7 @@ namespace Coverage {
  *  An iterator pointing to the location in the set that contains the
  *  source file path of the address.
  */
-const std::string& path_;
+const std::string path_;
 
 /*!
  *  The source line number of the address.
diff --git a/tester/covoar/Target_aarch64.h b/tester/covoar/Target_aarch64.h
index 08bd1fb..1502df4 100644
--- a/tester/covoar/Target_aarch64.h
+++ b/tester/covoar/Target_aarch64.h
@@ -44,7 +44,7 @@ namespace Target {
 bool isNopLine(
   const char* const line,
   int&  size
-);
+) override;
 
 /*!
  *  This method determines if the specified line from an
-- 
2.24.1

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


[PATCH] tester: Add Versal VCK190 eval board TFTP support

2021-06-30 Thread chrisj
From: Chris Johns 

---
 .../testing/bsps/xilinx_versal_vck190.ini | 43 +++
 1 file changed, 43 insertions(+)
 create mode 100644 tester/rtems/testing/bsps/xilinx_versal_vck190.ini

diff --git a/tester/rtems/testing/bsps/xilinx_versal_vck190.ini 
b/tester/rtems/testing/bsps/xilinx_versal_vck190.ini
new file mode 100644
index 000..3bdd6be
--- /dev/null
+++ b/tester/rtems/testing/bsps/xilinx_versal_vck190.ini
@@ -0,0 +1,43 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2021 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# 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 HOLDER 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.
+#
+
+#
+# The Xilinx Zynq Zedboard and Microzed board connected via TFTP. The console
+# is connected to a telnet tty device.
+#
+[xilinx_versal_vck190]
+bsp= xilinx_versal_vck190
+arch   = aarch64
+tester = %{_rtscripts}/tftp.cfg
+jobs   = 1
+test_restarts  = 3
+target_reset_regex = ^No ethernet found.*|^BOOTP broadcast 6.*|^.+complete\.+ 
TIMEOUT.*
+target_start_regex = .* PSCI Power Domain Map:$|^U-Boot .*
+requires   = target_on_command, target_off_command, 
target_reset_command, bsp_tty_dev
-- 
2.24.1

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


[PATCH v2] build: Use BSP family for options

2021-07-13 Thread chrisj
From: Chris Johns 

- Optionally add support for 'default-by-family' to allow
  option to be set by a family and so all related BSPs

Close #4468
---
 wscript | 36 +++-
 1 file changed, 23 insertions(+), 13 deletions(-)

diff --git a/wscript b/wscript
index 6626fafb74..61253b4a0b 100755
--- a/wscript
+++ b/wscript
@@ -592,9 +592,6 @@ class BSPItem(Item):
 arch_bsps = bsps.setdefault(data["arch"].strip(), {})
 arch_bsps[data["bsp"].strip()] = self
 
-def prepare_configure(self, conf, cic):
-conf.env.BSP_FAMILY = self.data["family"]
-
 def prepare_build(self, bld, bic):
 return BuildItemContext(
 bic.includes + bld.env.BSP_INCLUDES.split(), [], [], []
@@ -695,12 +692,18 @@ class OptionItem(Item):
 return True
 return False
 
-def default_value(self, variant):
+def default_value(self, variant, family):
 value = self.data["default"]
 for default in self.data["default-by-variant"]:
 if OptionItem._is_variant(default["variants"], variant):
 value = default["value"]
 break
+if 'default-by-family' in self.data:
+for default in self.data["default-by-family"]:
+if 'families' in default:
+if OptionItem._is_variant(default["families"], family):
+value = default["value"]
+break
 if value is None:
 return value
 if isinstance(value, list):
@@ -709,8 +712,8 @@ class OptionItem(Item):
 return value
 return self.data["format"].format(value)
 
-def do_defaults(self, variant):
-value = self.default_value(variant)
+def do_defaults(self, variant, family):
+value = self.default_value(variant, family)
 if value is None:
 return
 description = self.data["description"]
@@ -917,7 +920,7 @@ class OptionItem(Item):
 value = cic.cp.getboolean(conf.variant, name)
 cic.add_option(name)
 except configparser.NoOptionError:
-value = self.default_value(conf.env.ARCH_BSP)
+value = self.default_value(conf.env.ARCH_BSP, conf.env.ARCH_FAMILY)
 except ValueError as ve:
 conf.fatal(
 "Invalid value for configuration option {}: {}".format(name, 
ve)
@@ -933,7 +936,7 @@ class OptionItem(Item):
 value = cic.cp.get(conf.variant, name)
 cic.add_option(name)
 except configparser.NoOptionError:
-value = self.default_value(conf.env.ARCH_BSP)
+value = self.default_value(conf.env.ARCH_BSP, conf.env.ARCH_FAMILY)
 if value is None:
 return value
 try:
@@ -952,7 +955,7 @@ class OptionItem(Item):
 cic.add_option(name)
 value = no_unicode(value)
 except configparser.NoOptionError:
-value = self.default_value(conf.env.ARCH_BSP)
+value = self.default_value(conf.env.ARCH_BSP, conf.env.ARCH_FAMILY)
 return value
 
 def _script(self, conf, cic, value, arg):
@@ -1365,12 +1368,23 @@ def configure_variant(conf, cp, bsp_map, path_list, 
top_group, variant):
 conf.setenv(variant)
 arch, bsp_name = variant.split("/")
 bsp_base = bsp_map.get(bsp_name, bsp_name)
+
+try:
+bsp_item = bsps[arch][bsp_base]
+except KeyError:
+conf.fatal("No such base BSP: '{}'".format(variant))
+
+family = bsp_item.data['family']
+
 arch_bsp = arch + "/" + bsp_base
+arch_family = arch + "/" + family
 
 conf.env["ARCH"] = arch
 conf.env["ARCH_BSP"] = arch_bsp
+conf.env["ARCH_FAMILY"] = arch_family
 conf.env["BSP_BASE"] = bsp_base
 conf.env["BSP_NAME"] = bsp_name
+conf.env["BSP_FAMILY"] = family
 conf.env["DEST_OS"] = "rtems"
 
 # For the enabled-by evaluation we have to use the base BSP defined by the
@@ -1385,10 +1399,6 @@ def configure_variant(conf, cp, bsp_map, path_list, 
top_group, variant):
 
 items[conf.env.TOPGROUP].configure(conf, cic)
 
-try:
-bsp_item = bsps[arch][bsp_base]
-except KeyError:
-conf.fatal("No such base BSP: '{}'".format(variant))
 bsp_item.configure(conf, cic)
 
 options = set([o[0].upper() for o in cp.items(variant)])
-- 
2.24.1

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


[PATCH v3 2/2] build: Fix the motorola_powerpc default baudrate

2021-07-14 Thread chrisj
From: Chris Johns 

---
 spec/build/bsps/optconsolebaud.yml | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/spec/build/bsps/optconsolebaud.yml 
b/spec/build/bsps/optconsolebaud.yml
index 2658abbff8..4b0869beca 100644
--- a/spec/build/bsps/optconsolebaud.yml
+++ b/spec/build/bsps/optconsolebaud.yml
@@ -6,7 +6,10 @@ build-type: option
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
 default: 115200
-default-by-family: []
+default-by-family:
+- value: 9600
+  families:
+  - powerpc/motorola_powerpc
 default-by-variant:
 - value: 9600
   variants:
@@ -14,7 +17,6 @@ default-by-variant:
   - powerpc/hsc_cm01
   - powerpc/beatnik
   - powerpc/haleakala
-  - powerpc/motorola_powerpc
   - powerpc/mvme3100
   - powerpc/mvme5500
 - value: 19200
-- 
2.24.1

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


[PATCH] rtems-bsps: Add markdown support

2020-05-01 Thread chrisj
From: Chris Johns 

- Convert to python for better performance
---
 rtems-bsps | 369 ++---
 1 file changed, 320 insertions(+), 49 deletions(-)

diff --git a/rtems-bsps b/rtems-bsps
index 133009046c..82c5150969 100755
--- a/rtems-bsps
+++ b/rtems-bsps
@@ -1,49 +1,320 @@
-#! /bin/sh
-
-top=$(dirname $0)
-base="${top}/bsps"
-base_e=$(echo ${base} | sed -e 's/\//\\\//g')
-
-last_arch=""
-
-cfg_list=$(LANG=C LC_COLLATE=C find ${base} -mindepth 3 -name \*.cfg | sort)
-
-max_bsp_len=0
-arch_count=0
-bsp_count=0
-
-for bsp_path in ${cfg_list};
-do
-  arch=$(echo ${bsp_path} | sed -e "s/${base_e}*\///" -e 's/\/.*//')
-  bsp=$(echo ${bsp_path} | sed -e "s/.*\///" -e 's/\.cfg//')
-  len=${#bsp}
-  if test "${last_arch}" != "${arch}"; then
-arch_count=$(expr ${arch_count} + 1)
-last_arch=${arch}
-  fi
-  if [ $len -gt $max_bsp_len ]; then
-max_bsp_len=$len
-  fi
-  bsp_count=$(expr ${bsp_count} + 1)
-done
-
-max_bsp_len=$(expr ${max_bsp_len} + 2)
-last_arch=""
-
-echo "RTEMS 5"
-echo " Architectures: ${arch_count}"
-echo " BSP Count: ${bsp_count}"
-for bsp_path in ${cfg_list};
-do
- arch=$(echo ${bsp_path} | sed -e "s/${base_e}*\///" -e 's/\/.*//')
- bsp=$(echo ${bsp_path} | sed -e "s/.*\///" -e 's/\.cfg//')
- path=$(echo ${bsp_path} | sed -e "s/\/config.*//")
- if test "${last_arch}" != "${arch}"; then
-   echo "${arch}:"
-   last_arch=${arch}
- fi
- spaces=$(echo ${bsp} | awk '{ printf("%*s", '${max_bsp_len}' -length(), " "); 
}')
- echo " ${bsp}${spaces}${path}"
-done
-
-exit 0
+#! /usr/bin/env python
+#
+# RTEMS (http://www.rtems.org/)
+# Copyright 2020 Chris Johns (chr...@rtems.org)
+# 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 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 HOLDER 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.
+#
+
+from __future__ import print_function
+
+import argparse
+import os
+import os.path
+import sys
+
+rtems_version = 5
+
+
+class ArchBsps:
+"""Collects and processes the BSPs for a range of architectures
+creating output in text, markdown and HTML ir pandoc is installed"""
+def __init__(self, path='.', trace=False):
+self.trace = trace
+self._output = []
+self.top = os.path.realpath(path)
+self.base = os.path.join(self.top, 'bsps')
+self.configs = []
+self.archs = {}
+self._collect('.cfg')
+self._process()
+
+def _clear(self):
+"""Clears the output."""
+self._output = []
+
+def _out(self, line=''):
+"""Output a line to the output buffer."""
+self._output += [line]
+
+def _collect(self, ext):
+"""Collect the config files from the source tree."""
+self.configs = []
+for root, dirs, files in os.walk(self.base, topdown=True):
+for f in files:
+if os.path.splitext(f)[1] == ext:
+self.configs += [os.path.join(root, f)]
+
+def _process(self):
+"""Process the collected list of config files."""
+self.archs = {}
+for cfg in self.configs:
+config_path = cfg[len(self.base) + 1:]
+config_parts = config_path.split(os.sep)
+if len(config_parts) == 4:
+arch = config_parts[0]
+family = config_parts[1]
+bsp = os.path.splitext(config_parts[3])[0]
+if arch not in self.archs:
+self.archs[arch] = {}
+if family not in self.archs[arch]:
+self.archs[arch][family] = {}
+self.archs[arch][family][bsp] = config_path
+
+def _max_arch_len(self):
+"""Finds the longest arch label"""
+maxlen = 0
+for arch in self.archs:
+if len(arch) > maxlen:
+maxlen = len(arch)
+   

[PATCH 6/7] libdl/rap: Correctly check the return enum from rela calls

2020-05-04 Thread chrisj
From: Chris Johns 

- The change from bool to an enum did not trip a compiler warning
  and only the rel path was changed. The rela path was missed so
  archs like SPARC failed.

Updates #3969
---
 cpukit/libdl/rtl-rap.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdl/rtl-rap.c b/cpukit/libdl/rtl-rap.c
index 4e4540c156..32f4bd6ff5 100644
--- a/cpukit/libdl/rtl-rap.c
+++ b/cpukit/libdl/rtl-rap.c
@@ -326,6 +326,7 @@ rtems_rtl_rap_relocate (rtems_rtl_rap* rap, rtems_rtl_obj* 
obj)
 if (!symsect)
 {
   free (symname_buffer);
+  rtems_rtl_set_error (EINVAL, "symsect not found: %d", info >> 8);
   return false;
 }
 
@@ -389,8 +390,12 @@ rtems_rtl_rap_relocate (rtems_rtl_rap* rap, rtems_rtl_obj* 
obj)
   r, (int) type, offset, (int) addend,
   symname, (uintmax_t) symtype, (uintmax_t) symvalue);
 
-if (!rtems_rtl_elf_relocate_rela (obj, &rela, targetsect,
-  symname, symtype, symvalue))
+if (rtems_rtl_elf_relocate_rela (obj,
+ &rela,
+ targetsect,
+ symname,
+ symtype,
+ symvalue) == 
rtems_rtl_elf_rel_failure)
 {
   free (symname_buffer);
   return false;
@@ -409,8 +414,12 @@ rtems_rtl_rap_relocate (rtems_rtl_rap* rap, rtems_rtl_obj* 
obj)
   r, (int) type, offset,
   symname, (uintmax_t) symtype, (uintmax_t) symvalue);
 
-if (rtems_rtl_elf_relocate_rel (obj, &rel, targetsect,
- symname, symtype, symvalue) == 
rtems_rtl_elf_rel_failure)
+if (rtems_rtl_elf_relocate_rel (obj,
+&rel,
+targetsect,
+symname,
+symtype,
+symvalue) == rtems_rtl_elf_rel_failure)
 {
   free (symname_buffer);
   return false;
-- 
2.24.1

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


[PATCH 2/7] libdl/sparc: Print trace message of reloc failture path

2020-05-04 Thread chrisj
From: Chris Johns 

Updates #3969
---
 cpukit/libdl/rtl-mdreloc-sparc.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/cpukit/libdl/rtl-mdreloc-sparc.c b/cpukit/libdl/rtl-mdreloc-sparc.c
index 548c24132b..f8a4312a8a 100644
--- a/cpukit/libdl/rtl-mdreloc-sparc.c
+++ b/cpukit/libdl/rtl-mdreloc-sparc.c
@@ -232,8 +232,11 @@ rtems_rtl_elf_relocate_rela (rtems_rtl_obj*obj,
* We use the fact that relocation types are an `enum'
* Note: R_SPARC_6 is currently numerically largest.
*/
-  if (type > R_TYPE(6))
+  if (type > R_TYPE(TLS_TPOFF64)) {
+if (rtems_rtl_trace (RTEMS_RTL_TRACE_RELOC))
+  printf("rtl: invalid reloc type: %d\n", (int) type);
 return rtems_rtl_elf_rel_failure;
+  }
 
   value = rela->r_addend;
 
-- 
2.24.1

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


[PATCH 5/7] libdl/obj-comp: Add trace prints when decompressing

2020-05-04 Thread chrisj
From: Chris Johns 

Updates #3969
---
 cpukit/include/rtems/rtl/rtl-trace.h |  2 ++
 cpukit/libdl/rtl-obj-comp.c  | 31 
 2 files changed, 33 insertions(+)

diff --git a/cpukit/include/rtems/rtl/rtl-trace.h 
b/cpukit/include/rtems/rtl/rtl-trace.h
index 06c72c8992..196b4ff42e 100644
--- a/cpukit/include/rtems/rtl/rtl-trace.h
+++ b/cpukit/include/rtems/rtl/rtl-trace.h
@@ -54,7 +54,9 @@ typedef uint32_t rtems_rtl_trace_mask;
 #define RTEMS_RTL_TRACE_ARCHIVE_SYMS   (1UL << 13)
 #define RTEMS_RTL_TRACE_DEPENDENCY (1UL << 14)
 #define RTEMS_RTL_TRACE_BIT_ALLOC  (1UL << 15)
+#define RTEMS_RTL_TRACE_COMP   (1UL << 16)
 #define RTEMS_RTL_TRACE_ALL(0xUL & 
~(RTEMS_RTL_TRACE_CACHE | \
+ 
RTEMS_RTL_TRACE_COMP | \
  
RTEMS_RTL_TRACE_GLOBAL_SYM | \
  
RTEMS_RTL_TRACE_ARCHIVE_SYMS))
 
diff --git a/cpukit/libdl/rtl-obj-comp.c b/cpukit/libdl/rtl-obj-comp.c
index 36825baebe..4608a41bf4 100644
--- a/cpukit/libdl/rtl-obj-comp.c
+++ b/cpukit/libdl/rtl-obj-comp.c
@@ -21,10 +21,13 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 #include 
 #include "rtl-error.h"
+#include 
 
 #include "fastlz.h"
 
@@ -91,6 +94,13 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
 return false;
   }
 
+  if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+printf ("rtl:  comp: %2d: fd=%d length=%zu level=%u offset=%" PRIdoff_t " 
area=[%"
+PRIdoff_t ",%" PRIdoff_t "] read=%" PRIu32 " size=%zu\n",
+comp->fd, comp->cache->fd, length, comp->level, comp->offset,
+comp->offset, comp->offset + length,
+comp->read, comp->size);
+
   if (comp->fd != comp->cache->fd)
   {
 comp->level = 0;
@@ -104,10 +114,18 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
 
 if (buffer_level)
 {
+  if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+printf ("rtl:  comp: copy: length=%zu\n",
+buffer_level);
+
   memcpy (bin, comp->buffer, buffer_level);
 
   if ((comp->level - buffer_level) != 0)
   {
+if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+  printf ("rtl:  comp: copy-down: level=%u length=%zu\n",
+  comp->level, comp->level - buffer_level);
+
 memmove (comp->buffer,
  comp->buffer + buffer_level,
  comp->level - buffer_level);
@@ -126,6 +144,10 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
   size_t   in_length = sizeof (block_size);
   int  decompressed;
 
+  if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+printf ("rtl:  comp: read block-size: offset=%" PRIdoff_t "\n",
+comp->offset);
+
   if (!rtems_rtl_obj_cache_read (comp->cache, comp->fd, comp->offset,
  (void**) &input, &in_length))
 return false;
@@ -136,6 +158,10 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
 
   in_length = block_size;
 
+  if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+printf ("rtl:  comp: read block: offset=%" PRIdoff_t " size=%u\n",
+comp->offset, block_size);
+
   if (!rtems_rtl_obj_cache_read (comp->cache, comp->fd, comp->offset,
  (void**) &input, &in_length))
 return false;
@@ -172,6 +198,11 @@ rtems_rtl_obj_comp_read (rtems_rtl_obj_comp* comp,
   comp->offset += block_size;
 
   comp->level = decompressed;
+
+  if (rtems_rtl_trace (RTEMS_RTL_TRACE_COMP))
+printf ("rtl:  comp: expand: offset=%" PRIdoff_t \
+" level=%u read=%" PRIu32 "\n",
+comp->offset, comp->level, comp->read);
 }
   }
 
-- 
2.24.1

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


[PATCH 4/7] libdl/obj-cache: Fail if the read offset is past the file length

2020-05-04 Thread chrisj
From: Chris Johns 

- The check was for greater than and not equal or greater

Updates #3969
---
 cpukit/libdl/rtl-obj-cache.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdl/rtl-obj-cache.c b/cpukit/libdl/rtl-obj-cache.c
index 28d3b02a16..8791e2b1d5 100644
--- a/cpukit/libdl/rtl-obj-cache.c
+++ b/cpukit/libdl/rtl-obj-cache.c
@@ -80,7 +80,7 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache* cache,
   struct stat sb;
 
   if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
-printf ("rtl: cache: %2d: fd=%d offset=%" PRIdoff_t "length=%zu area=[%"
+printf ("rtl: cache: %2d: fd=%d offset=%" PRIdoff_t " length=%zu area=[%"
 PRIdoff_t ",%" PRIdoff_t "] cache=[%" PRIdoff_t ",%" PRIdoff_t "] 
size=%zu\n",
 fd, cache->fd, offset, *length,
 offset, offset + *length,
@@ -95,7 +95,7 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache* cache,
 
   if (cache->fd == fd)
   {
-if (offset > cache->file_size)
+if (offset >= cache->file_size)
 {
   rtems_rtl_set_error (EINVAL, "offset past end of file: offset=%i 
size=%i",
(int) offset, (int) cache->file_size);
@@ -110,6 +110,7 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache* cache,
   *length = cache->file_size - offset;
   if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
 printf ("rtl: cache: %2d: truncate length=%d\n", fd, (int) *length);
+
 }
   }
 
@@ -175,8 +176,8 @@ rtems_rtl_obj_cache_read (rtems_rtl_obj_cache* cache,
 }
 
 if (rtems_rtl_trace (RTEMS_RTL_TRACE_CACHE))
-  printf ("rtl: cache: %2d: seek: offset=%" PRIdoff_t "buffer_offset=%zu"
-  "read=%zu cache=[%" PRIdoff_t ",%" PRIdoff_t "] "
+  printf ("rtl: cache: %2d: seek: offset=%" PRIdoff_t " buffer_offset=%zu"
+  " read=%zu cache=[%" PRIdoff_t ",%" PRIdoff_t "] "
   "dist=%" PRIdoff_t "\n",
   fd, offset + buffer_offset, buffer_offset, buffer_read,
   offset, offset + buffer_read,
-- 
2.24.1

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


[PATCH 1/7] libdl: Fix comment.

2020-05-04 Thread chrisj
From: Chris Johns 

Updates #3969
---
 cpukit/libdl/rtl-elf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c
index 9370f36989..75b3d9c953 100644
--- a/cpukit/libdl/rtl-elf.c
+++ b/cpukit/libdl/rtl-elf.c
@@ -1717,7 +1717,7 @@ rtems_rtl_elf_file_load (rtems_rtl_obj* obj, int fd)
* 1. See if there are any common variables and if there are add a
*common section.
* 2. Add up the common.
-   * 3.
+   * 3. The load the symbols.
*/
   if (!rtems_rtl_obj_load_symbols (obj, fd, rtems_rtl_elf_common, &common))
 return false;
-- 
2.24.1

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


[PATCH 3/7] libdl/obj: Fix RAP format call table.

2020-05-04 Thread chrisj
From: Chris Johns 

Updates #3969
---
 cpukit/libdl/rtl-obj.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/cpukit/libdl/rtl-obj.c b/cpukit/libdl/rtl-obj.c
index 0c4a624c18..a7dd740549 100644
--- a/cpukit/libdl/rtl-obj.c
+++ b/cpukit/libdl/rtl-obj.c
@@ -60,7 +60,6 @@ static const rtems_rtl_loader_table 
loaders[RTEMS_RTL_LOADERS] =
   { .check = rtems_rtl_rap_file_check,
 .load  = rtems_rtl_rap_file_load,
 .unload= rtems_rtl_rap_file_unload,
-.unload= rtems_rtl_rap_file_unload,
 .signature = rtems_rtl_rap_file_sig },
 #endif
 #if RTEMS_RTL_ELF_LOADER
-- 
2.24.1

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


[PATCH 7/7] testsuite/dl06: Add a local define to control tracing

2020-05-04 Thread chrisj
From: Chris Johns 

Closes #3969
---
 testsuites/libtests/dl06/dl-load.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/testsuites/libtests/dl06/dl-load.c 
b/testsuites/libtests/dl06/dl-load.c
index d78e9d1ef8..211c05cd3c 100644
--- a/testsuites/libtests/dl06/dl-load.c
+++ b/testsuites/libtests/dl06/dl-load.c
@@ -6,6 +6,8 @@
  * http://www.rtems.org/license/LICENSE.
  */
 
+#define DL06_DEBUG_TRACING 0
+
 #include 
 
 #include 
-- 
2.24.1

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


[PATCH 6/6] testsuite: Add expected-fail to beagleboneblack

2020-05-06 Thread chrisj
From: Chris Johns 

Updates #2962
---
 .../config/beagleboneblack-testsuite.tcfg   | 17 +
 1 file changed, 17 insertions(+)
 create mode 100644 bsps/arm/beagle/config/beagleboneblack-testsuite.tcfg

diff --git a/bsps/arm/beagle/config/beagleboneblack-testsuite.tcfg 
b/bsps/arm/beagle/config/beagleboneblack-testsuite.tcfg
new file mode 100644
index 00..b4f720e2f4
--- /dev/null
+++ b/bsps/arm/beagle/config/beagleboneblack-testsuite.tcfg
@@ -0,0 +1,17 @@
+#
+# Beagleboneblack RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+expected-fail: dl06
+expected-fail: i2c01
+expected-fail: psxfenv01
+expected-fail: spcache01
+expected-fail: spintrcritical05
+expected-fail: spintrcritical10
+expected-fail: spintrcritical20
+expected-fail: spintrcritical21
+expected-fail: spsysinit01
+expected-fail: tmcontext01
+expected-fail: tmtimer01
-- 
2.24.1

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


[PATCH 2/6] testsuite: Add expected-fail to erc32, leon2, and leon3 BSPs

2020-05-06 Thread chrisj
From: Chris Johns 

Updates #2962
---
 bsps/sparc/erc32/config/erc32-testsuite.tcfg | 7 +++
 bsps/sparc/leon2/config/leon2-testsuite.tcfg | 7 +++
 bsps/sparc/leon3/config/leon3-testsuite.tcfg | 7 +++
 bsps/sparc/sparc-testsuite.tcfg  | 7 +++
 4 files changed, 28 insertions(+)
 create mode 100644 bsps/sparc/erc32/config/erc32-testsuite.tcfg
 create mode 100644 bsps/sparc/leon2/config/leon2-testsuite.tcfg
 create mode 100644 bsps/sparc/leon3/config/leon3-testsuite.tcfg
 create mode 100644 bsps/sparc/sparc-testsuite.tcfg

diff --git a/bsps/sparc/erc32/config/erc32-testsuite.tcfg 
b/bsps/sparc/erc32/config/erc32-testsuite.tcfg
new file mode 100644
index 00..1c89c7e229
--- /dev/null
+++ b/bsps/sparc/erc32/config/erc32-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# ERC32 RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: sparc-testsuite.tcfg
diff --git a/bsps/sparc/leon2/config/leon2-testsuite.tcfg 
b/bsps/sparc/leon2/config/leon2-testsuite.tcfg
new file mode 100644
index 00..750573ca6a
--- /dev/null
+++ b/bsps/sparc/leon2/config/leon2-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# LEON2 RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: sparc-testsuite.tcfg
diff --git a/bsps/sparc/leon3/config/leon3-testsuite.tcfg 
b/bsps/sparc/leon3/config/leon3-testsuite.tcfg
new file mode 100644
index 00..0067d16369
--- /dev/null
+++ b/bsps/sparc/leon3/config/leon3-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# LEON3 RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: sparc-testsuite.tcfg
diff --git a/bsps/sparc/sparc-testsuite.tcfg b/bsps/sparc/sparc-testsuite.tcfg
new file mode 100644
index 00..d8bdacdbfe
--- /dev/null
+++ b/bsps/sparc/sparc-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# SPARC RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+expected-fail: psxfenv01
-- 
2.24.1

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


[PATCH 3/6] libdl: Add allocator check script

2020-05-06 Thread chrisj
From: Chris Johns 

Use with the trace outout to check for allocation leaks.
---
 cpukit/libdl/rtl-alloc-check.py | 96 +
 1 file changed, 96 insertions(+)
 create mode 100644 cpukit/libdl/rtl-alloc-check.py

diff --git a/cpukit/libdl/rtl-alloc-check.py b/cpukit/libdl/rtl-alloc-check.py
new file mode 100644
index 00..c2145a768e
--- /dev/null
+++ b/cpukit/libdl/rtl-alloc-check.py
@@ -0,0 +1,96 @@
+#
+# Copyright (c) 2019 Chris Johns .
+# All rights reserved.
+#
+# The license and distribution terms for this file may be
+# found in the file LICENSE in this distribution or at
+# http://www.rtems.org/license/LICENSE.
+#
+# Check the allocations for libdl:
+#
+#  1. Turn on the allocation trace.
+#
+#  2. Load and unload object files.
+#
+#  3. Capture the trace output and feed to this tool
+#
+
+from __future__ import print_function
+
+import argparse
+
+
+class libdl_trace(object):
+def __init__(self, name):
+self.name = name
+self.trace = {'alloc': []}
+
+def load(self):
+with open(self.name, 'r') as f:
+lc = 0
+for line in f:
+line = line[:-1]
+lc += 1
+if line.startswith('rtl: '):
+if line.startswith('rtl: alloc: '):
+self.trace['alloc'] += [(lc, line)]
+
+def check_allocs(self):
+allocs = {}
+locks = 0
+wr_enable = False
+for lc, line in self.trace['alloc']:
+ls = line.split(' ')
+if len(ls) > 3:
+if ls[2] == 'new:':
+addr = ls[4].split('=')[1]
+size = ls[5].split('=')[1]
+count = 0
+if addr in allocs:
+alc, alloced, asize, count = allocs[addr]
+if alloced:
+print(
+'%5d: already alloced: %5d: addr=%-9s 
size=%-9s count=%d'
+% (lc, alc, addr, asize, count))
+allocs[addr] = (lc, True, size, count + 1)
+elif ls[2] == 'del:':
+addr = ls[4].split('=')[1]
+if addr != '0':
+if addr not in allocs:
+print('%5d: delete never alloced: addr=%s' %
+  (lc, addr))
+else:
+alc, alloced, size, count = allocs[addr]
+if not alloced:
+print(
+'%5d: delete not alloced: %5d: addr=%-9s 
size=%-9s count=%d'
+% (lc, alc, addr, size, count))
+allocs[addr] = (lc, False, size, count)
+alloced_remaiing = 0
+addresses = sorted(list(allocs.keys()))
+for addr in addresses:
+lc, alloced, size, count = allocs[addr]
+if alloced:
+print('%5d: never deleted: addr=%-9s size=%-9s count=%d' %
+  (lc, addr, size, count))
+alloced_remaiing += int(size)
+if alloced_remaiing != 0:
+print("Amount alloced: %d" % (alloced_remaiing))
+
+
+def run(args):
+argsp = argparse.ArgumentParser(prog='rtl-alloc-check',
+description='Audit libdl allocations')
+argsp.add_argument('traces', help='libdl trace files', nargs='+')
+
+opts = argsp.parse_args(args[1:])
+
+for t in opts.traces:
+trace = libdl_trace(t)
+trace.load()
+trace.check_allocs()
+
+
+if __name__ == "__main__":
+import sys
+run(sys.argv)
-- 
2.24.1

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


[PATCH 5/6] testsuite: Add expected-fail to xilinx's zedboard, a9_qemu, zc702 and zc706

2020-05-06 Thread chrisj
From: Chris Johns 

Updates #2962
---
 .../xilinx-zynq/config/xilinx_zynq-testsuite.tcfg| 12 
 .../config/xilinx_zynq_a9_qemu-testsuite.tcfg|  7 +++
 .../config/xilinx_zynq_zc702-testsuite.tcfg  |  7 +++
 .../config/xilinx_zynq_zc706-testsuite.tcfg  |  7 +++
 .../config/xilinx_zynq_zedboard-testsuite.tcfg   |  7 +++
 5 files changed, 40 insertions(+)
 create mode 100644 bsps/arm/xilinx-zynq/config/xilinx_zynq-testsuite.tcfg
 create mode 100644 
bsps/arm/xilinx-zynq/config/xilinx_zynq_a9_qemu-testsuite.tcfg
 create mode 100644 bsps/arm/xilinx-zynq/config/xilinx_zynq_zc702-testsuite.tcfg
 create mode 100644 bsps/arm/xilinx-zynq/config/xilinx_zynq_zc706-testsuite.tcfg
 create mode 100644 
bsps/arm/xilinx-zynq/config/xilinx_zynq_zedboard-testsuite.tcfg

diff --git a/bsps/arm/xilinx-zynq/config/xilinx_zynq-testsuite.tcfg 
b/bsps/arm/xilinx-zynq/config/xilinx_zynq-testsuite.tcfg
new file mode 100644
index 00..ac6cdf5236
--- /dev/null
+++ b/bsps/arm/xilinx-zynq/config/xilinx_zynq-testsuite.tcfg
@@ -0,0 +1,12 @@
+#
+# Xilinx Zynq RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+
+expected-fail: dl06
+expected-fail: ttest01
+expected-fail: psxfenv01
+expected-fail: spconsole01
+expected-fail: spcpucounter01
diff --git a/bsps/arm/xilinx-zynq/config/xilinx_zynq_a9_qemu-testsuite.tcfg 
b/bsps/arm/xilinx-zynq/config/xilinx_zynq_a9_qemu-testsuite.tcfg
new file mode 100644
index 00..ba80faab99
--- /dev/null
+++ b/bsps/arm/xilinx-zynq/config/xilinx_zynq_a9_qemu-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# Xilinx Zedboard RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: xilinx_zynq-testsuite.tcfg
diff --git a/bsps/arm/xilinx-zynq/config/xilinx_zynq_zc702-testsuite.tcfg 
b/bsps/arm/xilinx-zynq/config/xilinx_zynq_zc702-testsuite.tcfg
new file mode 100644
index 00..ba80faab99
--- /dev/null
+++ b/bsps/arm/xilinx-zynq/config/xilinx_zynq_zc702-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# Xilinx Zedboard RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: xilinx_zynq-testsuite.tcfg
diff --git a/bsps/arm/xilinx-zynq/config/xilinx_zynq_zc706-testsuite.tcfg 
b/bsps/arm/xilinx-zynq/config/xilinx_zynq_zc706-testsuite.tcfg
new file mode 100644
index 00..ba80faab99
--- /dev/null
+++ b/bsps/arm/xilinx-zynq/config/xilinx_zynq_zc706-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# Xilinx Zedboard RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: xilinx_zynq-testsuite.tcfg
diff --git a/bsps/arm/xilinx-zynq/config/xilinx_zynq_zedboard-testsuite.tcfg 
b/bsps/arm/xilinx-zynq/config/xilinx_zynq_zedboard-testsuite.tcfg
new file mode 100644
index 00..ba80faab99
--- /dev/null
+++ b/bsps/arm/xilinx-zynq/config/xilinx_zynq_zedboard-testsuite.tcfg
@@ -0,0 +1,7 @@
+#
+# Xilinx Zedboard RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+include: xilinx_zynq-testsuite.tcfg
-- 
2.24.1

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


[PATCH 4/6] testsuite: Add expected-fail to psim

2020-05-06 Thread chrisj
From: Chris Johns 

Updates #2962
---
 bsps/powerpc/psim/config/psim-testsuite.tcfg | 22 
 1 file changed, 22 insertions(+)
 create mode 100644 bsps/powerpc/psim/config/psim-testsuite.tcfg

diff --git a/bsps/powerpc/psim/config/psim-testsuite.tcfg 
b/bsps/powerpc/psim/config/psim-testsuite.tcfg
new file mode 100644
index 00..b0d2a05086
--- /dev/null
+++ b/bsps/powerpc/psim/config/psim-testsuite.tcfg
@@ -0,0 +1,22 @@
+#
+# PSIM RTEMS Test Database.
+#
+# Format is one line per test that is _NOT_ built.
+#
+
+expected-fail: fsimfsgeneric01
+expected-fail: block11
+expected-fail: rbheap01
+expected-fail: termios01
+expected-fail: ttest01
+expected-fail: psx12
+expected-fail: psxchroot01
+expected-fail: psxfenv01
+expected-fail: psximfs02
+expected-fail: psxpipe01
+expected-fail: spextensions01
+expected-fail: spfatal31
+expected-fail: spfifo02
+expected-fail: spmountmgr01
+expected-fail: spprivenv01
+expected-fail: spstdthreads01
-- 
2.24.1

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


[PATCH 1/6] testsuite: Add the BSP architecture to the include path

2020-05-06 Thread chrisj
From: Chris Johns 

Updates #2962
---
 testsuites/aclocal/rtems-test-check.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testsuites/aclocal/rtems-test-check.m4 
b/testsuites/aclocal/rtems-test-check.m4
index a0feee5e15..99b3e31244 100644
--- a/testsuites/aclocal/rtems-test-check.m4
+++ b/testsuites/aclocal/rtems-test-check.m4
@@ -7,7 +7,7 @@ AC_DEFUN([RTEMS_TEST_CHECK],
  AC_MSG_CHECKING([${RTEMS_CPU}/${RTEMS_BSP} $1 test])
  tcheck="${RTEMS_SOURCE_ROOT}/testsuites/rtems-test-check"
  tdata="${RTEMS_BSP}-testsuite.tcfg"
- 
tincludes="${RTEMS_SOURCE_ROOT}/bsps/${RTEMS_CPU}/${RTEMS_BSP_FAMILY}/config:${RTEMS_SOURCE_ROOT}/testsuites"
+ 
tincludes="${RTEMS_SOURCE_ROOT}/bsps/${RTEMS_CPU}:${RTEMS_SOURCE_ROOT}/bsps/${RTEMS_CPU}/${RTEMS_BSP_FAMILY}:${RTEMS_SOURCE_ROOT}/bsps/${RTEMS_CPU}/${RTEMS_BSP_FAMILY}/config:${RTEMS_SOURCE_ROOT}/testsuites"
  if test -f $tcheck; then
   check_result=`$tcheck exclude ${RTEMS_BSP} $tdata $tincludes $1`
  else
-- 
2.24.1

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


Test threaded log module for rtems-tools

2020-05-08 Thread chrisj
Hello,

This is a test patch of a threading logger. My testing with qemu
on a multi-core box gave me an average time of 800msec with
a number of timeouts for the xilinx_zynq_a9_qemu BSP.

I will try this code in the RSB to see if it works there.

Anders, have a look as a possible start of a solution.

Thanks
Chris


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


[PATCH] rtemstoolkit: Rework the log locking adding an output thread.

2020-05-08 Thread chrisj
From: Chris Johns 

---
 rtemstoolkit/log.py | 76 +
 1 file changed, 49 insertions(+), 27 deletions(-)

diff --git a/rtemstoolkit/log.py b/rtemstoolkit/log.py
index 00fdb05..2e73e72 100755
--- a/rtemstoolkit/log.py
+++ b/rtemstoolkit/log.py
@@ -34,8 +34,11 @@
 
 from __future__ import print_function
 
+import atexit
 import os
+import queue
 import sys
+import time
 import threading
 
 from rtemstoolkit import error
@@ -57,9 +60,47 @@ tracing = False
 quiet = False
 
 #
-# Global output lock to keep output together when working with threads
+# Run the output from a separate thread to avoid blocking with a
+# lock. We want the outout to be blocks.
 #
-lock = threading.Lock()
+_output_queue = queue.SimpleQueue()
+
+def _output_worker(timeout=None):
+try:
+is_write, is_flush, handle, out = _output_queue.get(timeout=timeout)
+except queue.Empty:
+return timeout is None
+except KeyboardInterrupt:
+return False
+except:
+return False
+if is_write:
+handle.write(out)
+else:
+for l in out.replace(chr(13), '').splitlines():
+print(l, file=handle)
+if is_flush:
+handle.flush()
+return True
+
+def _output_put(is_write, is_flush, handle, out):
+_output_queue.put((is_write, is_flush, handle, out))
+while not _output_queue.empty():
+time.sleep(0.001)
+
+def _output_exiting():
+while _output_worker(timeout=0.100):
+pass
+
+def _output_thread():
+while _output_worker():
+pass
+
+_outputter = threading.Thread(target=_output_thread,
+  daemon=True,
+  name='log_outputter')
+_outputter.start()
+atexit.register(_output_exiting)
 
 def info(args):
 s = [' Command Line: %s' % (' '.join(args))]
@@ -92,20 +133,12 @@ def _output(text = os.linesep, log = None):
 elif default is not None:
 default.output(text)
 else:
-lock.acquire()
-for l in text.replace(chr(13), '').splitlines():
-print(l)
-lock.release()
+_output_put(False, False, sys.stdout, text)
 if capture is not None:
-lock.acquire()
 capture(text)
-lock.release()
 
 def stderr(text = os.linesep, log = None):
-lock.acquire()
-for l in text.replace(chr(13), '').splitlines():
-print(l, file = sys.stderr)
-lock.release()
+_output_put(False, False, sys.stderr, text)
 
 def output(text = os.linesep, log = None):
 if not quiet:
@@ -114,10 +147,7 @@ def output(text = os.linesep, log = None):
 def notice(text = os.linesep, log = None, stdout_only = False):
 if not quiet and \
 (default is not None and not default.has_stdout() or stdout_only):
-lock.acquire()
-for l in text.replace(chr(13), '').splitlines():
-print(l)
-lock.release()
+_output_put(False, False, sys.stdout, text)
 if not stdout_only:
 _output(text, log)
 
@@ -138,7 +168,6 @@ def flush(log = None):
 class log:
 """Log output to stdout or a file."""
 def __init__(self, streams = None, tail_size = 100):
-self.lock = threading.Lock()
 self.tail = []
 self.tail_size = tail_size
 self.fhs = [None, None]
@@ -186,16 +215,9 @@ class log:
 out = os.linesep.join(text) + os.linesep
 if isinstance(out, bytes):
 out = out.decode('utf-8', 'ignore')
-self.lock.acquire()
-try:
-for f in range(0, len(self.fhs)):
-if self.fhs[f] is not None:
-self.fhs[f].write(out)
-self.flush()
-except:
-raise
-finally:
-self.lock.release()
+for f in range(0, len(self.fhs)):
+if self.fhs[f] is not None:
+_output_put(True, True, self.fhs[f], out)
 
 def flush(self):
 """Flush the output."""
-- 
2.24.1

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


[PATCH] i386/pc: Initialise the printk serial port on first use

2020-06-16 Thread chrisj
From: Chris Johns 

---
 bsps/i386/pc386/console/conscfg.c|  7 ++--
 bsps/i386/pc386/console/printk_support.c | 42 +++-
 2 files changed, 37 insertions(+), 12 deletions(-)

diff --git a/bsps/i386/pc386/console/conscfg.c 
b/bsps/i386/pc386/console/conscfg.c
index a4ae88626f..8aa8ab5c2a 100644
--- a/bsps/i386/pc386/console/conscfg.c
+++ b/bsps/i386/pc386/console/conscfg.c
@@ -46,15 +46,14 @@
 
   #define CLOCK_RATE(115200 * 16)
 
-  static uint8_t com_get_register(uint32_t addr, uint8_t i)
+  static uint8_t com_get_register(uintptr_t addr, uint8_t i)
   {
-register uint8_t val;
-
+uint8_t val;
 inport_byte( (addr + i), val );
 return val;
   }
 
-  static void com_set_register(uint32_t addr, uint8_t i, uint8_t val)
+  static void com_set_register(uintptr_t addr, uint8_t i, uint8_t val)
   {
 outport_byte( (addr + i), val );
   }
diff --git a/bsps/i386/pc386/console/printk_support.c 
b/bsps/i386/pc386/console/printk_support.c
index d7bc329868..c9e003dab0 100644
--- a/bsps/i386/pc386/console/printk_support.c
+++ b/bsps/i386/pc386/console/printk_support.c
@@ -29,6 +29,28 @@
 
 rtems_device_minor_number BSPPrintkPort = 0;
 
+static bool serialInit;
+static bool serialOK;
+
+static bool serialValid(console_tbl *port)
+{
+  if (port->pDeviceFns) {
+if (!serialInit) {
+  serialOK = true;
+  if (port->pDeviceFns->deviceProbe != NULL) {
+if (!port->pDeviceFns->deviceProbe( BSPPrintkPort ))
+  serialOK = false;
+else if (port->pDeviceFns->deviceInitialize != NULL)
+  port->pDeviceFns->deviceInitialize( BSPPrintkPort );
+else
+  serialOK = false;
+  }
+  serialInit = true;
+}
+  }
+  return serialOK;
+}
+
 void BSP_outch(char ch);
 int BSP_inch(void);
 
@@ -42,10 +64,12 @@ void BSP_outch(char ch)
 
   if ( !isVga ) {
 console_tbl *port = Console_Port_Tbl[BSPPrintkPort];
-if (port->pDeviceFns && port->pDeviceFns->deviceWritePolled) {
-  port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
+if (serialValid(port)) {
+  if (port->pDeviceFns->deviceWritePolled) {
+port->pDeviceFns->deviceWritePolled( BSPPrintkPort, ch );
+  }
+  return;
 }
-return;
   }
 
   #if BSP_ENABLE_VGA
@@ -65,11 +89,13 @@ int BSP_inch(void)
 
   if ( !isVga ) {
 console_tbl *port = Console_Port_Tbl[BSPPrintkPort];
-if (port->pDeviceFns && port->pDeviceFns->deviceRead) {
-  do {
-result = port->pDeviceFns->deviceRead( BSPPrintkPort );
-  } while (result == -1);
-  return result;
+if (serialValid(port)) {
+  if (port->pDeviceFns->deviceRead) {
+do {
+  result = port->pDeviceFns->deviceRead( BSPPrintkPort );
+} while (result == -1);
+return result;
+  }
 }
   }
 
-- 
2.24.1

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


[PATCH] powerpc/io: The eieio() function clashes with FreeBSD. Change.

2020-07-26 Thread chrisj
From: Chris Johns 

---
 bsps/powerpc/include/libcpu/io.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bsps/powerpc/include/libcpu/io.h b/bsps/powerpc/include/libcpu/io.h
index 841df81f47..521c97801d 100644
--- a/bsps/powerpc/include/libcpu/io.h
+++ b/bsps/powerpc/include/libcpu/io.h
@@ -50,7 +50,7 @@
  * Acts as a barrier to ensure all previous I/O accesses have
  * completed before any further ones are issued.
  */
-static inline void eieio(void)
+static inline void io_eieio(void)
 {
__asm__ __volatile__ ("eieio");
 }
@@ -59,9 +59,9 @@ static inline void eieio(void)
 /* Enforce in-order execution of data I/O.
  * No distinction between read/write on PPC; use eieio for all three.
  */
-#define iobarrier_rw() eieio()
-#define iobarrier_r()  eieio()
-#define iobarrier_w()  eieio()
+#define iobarrier_rw() io_eieio()
+#define iobarrier_r()  io_eieio()
+#define iobarrier_w()  io_eieio()
 
 /*
  * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
-- 
2.27.0

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


[PATCH 5] powerpc/io: The eieio() function clashes with FreeBSD. Change.

2020-07-26 Thread chrisj
From: Chris Johns 

Closes #4021
---
 bsps/powerpc/include/libcpu/io.h | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bsps/powerpc/include/libcpu/io.h b/bsps/powerpc/include/libcpu/io.h
index 841df81f47..521c97801d 100644
--- a/bsps/powerpc/include/libcpu/io.h
+++ b/bsps/powerpc/include/libcpu/io.h
@@ -50,7 +50,7 @@
  * Acts as a barrier to ensure all previous I/O accesses have
  * completed before any further ones are issued.
  */
-static inline void eieio(void)
+static inline void io_eieio(void)
 {
__asm__ __volatile__ ("eieio");
 }
@@ -59,9 +59,9 @@ static inline void eieio(void)
 /* Enforce in-order execution of data I/O.
  * No distinction between read/write on PPC; use eieio for all three.
  */
-#define iobarrier_rw() eieio()
-#define iobarrier_r()  eieio()
-#define iobarrier_w()  eieio()
+#define iobarrier_rw() io_eieio()
+#define iobarrier_r()  io_eieio()
+#define iobarrier_w()  io_eieio()
 
 /*
  * 8, 16 and 32 bit, big and little endian I/O operations, with barrier.
-- 
2.27.0

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


[PATCH 5] shell: Only clear std handles when the shell task exits

2020-08-08 Thread chrisj
From: Chris Johns 

Clearing the std file handles when the main loop exited crashes
telnetd as it reuses its session threads.

Closes #3859
---
 cpukit/libmisc/shell/shell.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 0b06e8b4d1..13ae411f9c 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -234,12 +234,16 @@ static void rtems_shell_clear_shell_env(void)
   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
-   */
+/*
+ * Clear stdin, stdout and stderr file pointers so they will not be closed.
+ */
+static void rtems_shell_clear_shell_std_handles(void)
+{
   stdin = NULL;
   stdout = NULL;
+  stderr = NULL;
 }
 
 /*
@@ -775,6 +779,7 @@ void rtems_shell_print_env(
 {
   if ( !shell_env ) {
 printk( "shell_env is NULL\n" );
+
 return;
   }
   printk( "shell_env=%p\n"
@@ -797,6 +802,7 @@ static rtems_task rtems_shell_task(rtems_task_argument 
task_argument)
   rtems_shell_env_t *shell_env = (rtems_shell_env_t*) task_argument;
   rtems_id   wake_on_end = shell_env->wake_on_end;
   rtems_shell_main_loop( shell_env );
+  rtems_shell_clear_shell_std_handles();
   if (wake_on_end != RTEMS_INVALID_ID)
 rtems_event_send (wake_on_end, RTEMS_EVENT_1);
   rtems_task_exit();
@@ -872,6 +878,11 @@ bool rtems_shell_main_loop(
 else
   stdout = stderr;
   } else if (strcmp(shell_env->output, "/dev/null") == 0) {
+if (stdout == NULL) {
+  fprintf(stderr, "shell: stdout is NULLs\n");
+  rtems_shell_clear_shell_env();
+  return false;
+}
 fclose (stdout);
   } else {
 FILE *output = fopen(shell_env->output,
@@ -906,6 +917,13 @@ bool rtems_shell_main_loop(
   }
 
   if (!input_file) {
+if (stdin == NULL) {
+  fprintf(stderr, "shell: stdin is NULLs\n");
+  if (stdoutToClose != NULL)
+fclose(stdoutToClose);
+  rtems_shell_clear_shell_env();
+  return false;
+}
 /* Make a raw terminal, Linux Manuals */
 if (tcgetattr(fileno(stdin), &previous_term) >= 0) {
   term = previous_term;
@@ -967,7 +985,7 @@ bool rtems_shell_main_loop(
  *  keep on trucking.
  */
 if (shell_env->login_check != NULL) {
-  result = rtems_shell_login(shell_env, stdin,stdout);
+  result = rtems_shell_login(shell_env, stdin, stdout);
 } else {
   setuid(shell_env->uid);
   setgid(shell_env->gid);
-- 
2.19.1

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


[PATCH] shell: Only clear std handles when the shell task exits

2020-08-08 Thread chrisj
From: Chris Johns 

Clearing the std file handles when the main loop exited crashes
telnetd as it reuses its session threads.
---
 cpukit/libmisc/shell/shell.c | 26 ++
 1 file changed, 22 insertions(+), 4 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index 0b06e8b4d1..13ae411f9c 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -234,12 +234,16 @@ static void rtems_shell_clear_shell_env(void)
   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
-   */
+/*
+ * Clear stdin, stdout and stderr file pointers so they will not be closed.
+ */
+static void rtems_shell_clear_shell_std_handles(void)
+{
   stdin = NULL;
   stdout = NULL;
+  stderr = NULL;
 }
 
 /*
@@ -775,6 +779,7 @@ void rtems_shell_print_env(
 {
   if ( !shell_env ) {
 printk( "shell_env is NULL\n" );
+
 return;
   }
   printk( "shell_env=%p\n"
@@ -797,6 +802,7 @@ static rtems_task rtems_shell_task(rtems_task_argument 
task_argument)
   rtems_shell_env_t *shell_env = (rtems_shell_env_t*) task_argument;
   rtems_id   wake_on_end = shell_env->wake_on_end;
   rtems_shell_main_loop( shell_env );
+  rtems_shell_clear_shell_std_handles();
   if (wake_on_end != RTEMS_INVALID_ID)
 rtems_event_send (wake_on_end, RTEMS_EVENT_1);
   rtems_task_exit();
@@ -872,6 +878,11 @@ bool rtems_shell_main_loop(
 else
   stdout = stderr;
   } else if (strcmp(shell_env->output, "/dev/null") == 0) {
+if (stdout == NULL) {
+  fprintf(stderr, "shell: stdout is NULLs\n");
+  rtems_shell_clear_shell_env();
+  return false;
+}
 fclose (stdout);
   } else {
 FILE *output = fopen(shell_env->output,
@@ -906,6 +917,13 @@ bool rtems_shell_main_loop(
   }
 
   if (!input_file) {
+if (stdin == NULL) {
+  fprintf(stderr, "shell: stdin is NULLs\n");
+  if (stdoutToClose != NULL)
+fclose(stdoutToClose);
+  rtems_shell_clear_shell_env();
+  return false;
+}
 /* Make a raw terminal, Linux Manuals */
 if (tcgetattr(fileno(stdin), &previous_term) >= 0) {
   term = previous_term;
@@ -967,7 +985,7 @@ bool rtems_shell_main_loop(
  *  keep on trucking.
  */
 if (shell_env->login_check != NULL) {
-  result = rtems_shell_login(shell_env, stdin,stdout);
+  result = rtems_shell_login(shell_env, stdin, stdout);
 } else {
   setuid(shell_env->uid);
   setgid(shell_env->gid);
-- 
2.19.1

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


[PATCH] sb/track: Add a command to track build sets.

2020-08-09 Thread chrisj
From: Chris Johns 

- Process a build set for a range of hosts and output a dependency
  tree, the used build set and configuration files.
- Output the configuration files that are no referenced

Closes #4044
---
 bare/config/devel/libusb-1.0.18-1.cfg  |   3 +
 source-builder/config/autoconf-2-1.cfg |   6 +-
 source-builder/config/automake-1-1.cfg |   6 +-
 source-builder/config/libusb-1-1.cfg   |   4 +-
 source-builder/sb-track|  27 +
 source-builder/sb/build.py |  15 +-
 source-builder/sb/cmd-track.py |  29 ++
 source-builder/sb/config.py|  87 ++--
 source-builder/sb/getsources.py| 583 +-
 source-builder/sb/simhost.py   | 657 +
 source-builder/sb/track.py | 254 ++
 11 files changed, 1068 insertions(+), 603 deletions(-)
 create mode 100755 source-builder/sb-track
 create mode 100755 source-builder/sb/cmd-track.py
 create mode 100644 source-builder/sb/simhost.py
 create mode 100644 source-builder/sb/track.py

diff --git a/bare/config/devel/libusb-1.0.18-1.cfg 
b/bare/config/devel/libusb-1.0.18-1.cfg
index b47855b..494afbe 100644
--- a/bare/config/devel/libusb-1.0.18-1.cfg
+++ b/bare/config/devel/libusb-1.0.18-1.cfg
@@ -15,6 +15,9 @@ Name: libusb-%{libusb_version}-%{_host}-%{release}
 %description
 LibUSB for host %{_host}.
 
+%hash sha512 libusb-%{libusb_version}.tar.bz2 \
+   
u8PXXLkfTmoCRUnCusOO6FrtqFKaRVP9NryOilwiPNieuVLtpx/MAHHWxsgYoGMdTMoIT+1p1Jhu7l3PmofWYg==
+
 #
 # The Libuxb build instructions. We use 1.xx Release 1.
 #
diff --git a/source-builder/config/autoconf-2-1.cfg 
b/source-builder/config/autoconf-2-1.cfg
index 86f5d1e..2b9466c 100644
--- a/source-builder/config/autoconf-2-1.cfg
+++ b/source-builder/config/autoconf-2-1.cfg
@@ -6,9 +6,9 @@
 
 %ifn %{defined _internal_autotools}
   %define _internal_autotools no
-  %ifn %{defined _internal_autotools_path}
-%define _internal_autotools_path %{nil}
-  %endif
+%endif
+%ifn %{defined _internal_autotools_path}
+  %define _internal_autotools_path %{_prefix}
 %endif
 
 Name:  autoconf-%{autoconf_version}-%{_host}-%{release}
diff --git a/source-builder/config/automake-1-1.cfg 
b/source-builder/config/automake-1-1.cfg
index 48beb51..83473de 100644
--- a/source-builder/config/automake-1-1.cfg
+++ b/source-builder/config/automake-1-1.cfg
@@ -6,9 +6,9 @@
 
 %ifn %{defined _internal_autotools}
   %define _internal_autotools no
-  %ifn %{defined _internal_autotools_path}
-%define _internal_autotools_path %{nil}
-  %endif
+%endif
+%ifn %{defined _internal_autotools_path}
+  %define _internal_autotools_path %{_prefix}
 %endif
 
 Name:  automake-%{automake_version}-%{_host}-%{release}
diff --git a/source-builder/config/libusb-1-1.cfg 
b/source-builder/config/libusb-1-1.cfg
index 4b250a3..803f326 100644
--- a/source-builder/config/libusb-1-1.cfg
+++ b/source-builder/config/libusb-1-1.cfg
@@ -33,8 +33,10 @@ URL:http://libusb.org/
   cd libusb-%{libusb_version}
 
 %if "%{_build}" != "%{_host}"
-  CFLAGS_FOR_BUILD="-g -O2 -Wall" \
+  LIBUSB_CFLAGS_FOR_BUILD="-g -O2 -Wall"
 %endif
+
+  CFLAGS_FOR_BUILD=${LIBUSB_CFLAGS_FOR_BUILD} \
   CFLAGS="$SB_CFLAGS" \
   ./configure \
 --build=%{_build} --host=%{_host} \
diff --git a/source-builder/sb-track b/source-builder/sb-track
new file mode 100755
index 000..a739978
--- /dev/null
+++ b/source-builder/sb-track
@@ -0,0 +1,27 @@
+#! /bin/sh
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2019 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+#
+set -e
+base=$(dirname $0)
+PYTHON_CMD=${base}/sb/cmd-track.py
+if test -f ${base}/sb/python-wrapper.sh; then
+  . ${base}/sb/python-wrapper.sh
+fi
+echo "error: python wrapper not found"
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index ceb179a..cfb7d8c 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -635,6 +635,10 @@ class build:
 return 0
 return package.get_size('installed')
 
+def includes(self):
+if self.config:
+return self.config.includes()
+
 def get_configs(opts):
 
 def _scan(_path, ext):
@@ -648,10 +652

[PATCH] sb/builder: Remove sb-builder command

2020-08-09 Thread chrisj
From: Chris Johns 

Closes #4045
---
 source-builder/sb-builder| 27 ---
 source-builder/sb/cmd-builder.py | 29 -
 2 files changed, 56 deletions(-)
 delete mode 100755 source-builder/sb-builder
 delete mode 100755 source-builder/sb/cmd-builder.py

diff --git a/source-builder/sb-builder b/source-builder/sb-builder
deleted file mode 100755
index be3d205..000
--- a/source-builder/sb-builder
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh
-#
-# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2018 Chris Johns (chr...@rtems.org)
-# All rights reserved.
-#
-# This file is part of the RTEMS Tools package in 'rtems-tools'.
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-set -e
-base=$(dirname $0)
-PYTHON_CMD=${base}/sb/cmd-builder.py
-if test -f ${base}/sb/python-wrapper.sh; then
-  . ${base}/sb/python-wrapper.sh
-fi
-echo "error: python wrapper not found"
diff --git a/source-builder/sb/cmd-builder.py b/source-builder/sb/cmd-builder.py
deleted file mode 100755
index 437b81a..000
--- a/source-builder/sb/cmd-builder.py
+++ /dev/null
@@ -1,29 +0,0 @@
-#
-# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2010-2012 Chris Johns (chr...@rtems.org)
-# All rights reserved.
-#
-# This file is part of the RTEMS Tools package in 'rtems-tools'.
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-from __future__ import print_function
-
-import sys, os
-
-try:
-import build
-build.run(sys.argv)
-except ImportError:
-print("Incorrect Source Builder installation", file = sys.stderr)
-sys.exit(1)
-- 
2.27.0

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


[PATCH] sb/bootstrap: Remove the sb-bootsrap command

2020-08-09 Thread chrisj
From: Chris Johns 

Closes #4046
---
 source-builder/sb-bootstrap|  27 ---
 source-builder/sb/bootstrap.py | 273 -
 source-builder/sb/cmd-bootstrap.py |  29 ---
 3 files changed, 329 deletions(-)
 delete mode 100755 source-builder/sb-bootstrap
 delete mode 100644 source-builder/sb/bootstrap.py
 delete mode 100755 source-builder/sb/cmd-bootstrap.py

diff --git a/source-builder/sb-bootstrap b/source-builder/sb-bootstrap
deleted file mode 100755
index 618e2bb..000
--- a/source-builder/sb-bootstrap
+++ /dev/null
@@ -1,27 +0,0 @@
-#! /bin/sh
-#
-# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2018 Chris Johns (chr...@rtems.org)
-# All rights reserved.
-#
-# This file is part of the RTEMS Tools package in 'rtems-tools'.
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-set -e
-base=$(dirname $0)
-PYTHON_CMD=${base}/sb/cmd-bootstrap.py
-if test -f ${base}/sb/python-wrapper.sh; then
-  . ${base}/sb/python-wrapper.sh
-fi
-echo "error: python wrapper not found"
diff --git a/source-builder/sb/bootstrap.py b/source-builder/sb/bootstrap.py
deleted file mode 100644
index ec7d7c3..000
--- a/source-builder/sb/bootstrap.py
+++ /dev/null
@@ -1,273 +0,0 @@
-#
-# RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2013-2016 Chris Johns (chr...@rtems.org)
-# All rights reserved.
-#
-# This file is part of the RTEMS Tools package in 'rtems-tools'.
-#
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-
-from __future__ import print_function
-
-import datetime
-import operator
-import os
-import re
-import sys
-import threading
-import time
-
-import error
-import log
-import options
-import path
-import version
-
-def _collect(path_, file):
-confs = []
-for root, dirs, files in os.walk(path.host(path_), topdown = True):
-for f in files:
-if f == file:
-confs += [path.shell(path.join(root, f))]
-return confs
-
-def _grep(file, pattern):
-rege = re.compile(pattern)
-try:
-f = open(path.host(file), 'r')
-matches = [rege.match(l) != None for l in f.readlines()]
-f.close()
-except IOError as err:
-raise error.general('reading: %s' % (file))
-return True in matches
-
-class command:
-
-def __init__(self, cmd, cwd):
-self.exit_code = 0
-self.thread = None
-self.output = None
-self.cmd = cmd
-self.cwd = cwd
-self.result = None
-
-def runner(self):
-
-import subprocess
-
-#
-# Support Python 2.6
-#
-if "check_output" not in dir(subprocess):
-def f(*popenargs, **kwargs):
-if 'stdout' in kwargs:
-raise ValueError('stdout argument not allowed, it will be 
overridden.')
-process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, 
**kwargs)
-output, unused_err = process.communicate()
-retcode = process.poll()
-if retcode:
-cmd = kwargs.get("args")
-if cmd is None:
-cmd = popenargs[0]
-raise subprocess.CalledProcessError(retcode, cmd)
-return output
-subprocess.check_output = f
-
-self.start_time = datetime.datetime.now()
-self.exit_code = 0
-try:
-try:
-if os.name == 'nt':
-cmd = ['sh', '-c'] + self.cmd
-else:
-cmd = self.cmd
-self.output = subprocess.check_output(cmd, cwd = 
path.host(self.cwd))
-   

[PATCH 3/3] bare/libusb: Fix the configuration and add a hash

2020-08-10 Thread chrisj
From: Chris Johns 

Updates #4014
---
 bare/config/devel/libusb-1.0.18-1.cfg | 3 +++
 source-builder/config/libusb-1-1.cfg  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/bare/config/devel/libusb-1.0.18-1.cfg 
b/bare/config/devel/libusb-1.0.18-1.cfg
index b47855b..494afbe 100644
--- a/bare/config/devel/libusb-1.0.18-1.cfg
+++ b/bare/config/devel/libusb-1.0.18-1.cfg
@@ -15,6 +15,9 @@ Name: libusb-%{libusb_version}-%{_host}-%{release}
 %description
 LibUSB for host %{_host}.
 
+%hash sha512 libusb-%{libusb_version}.tar.bz2 \
+   
u8PXXLkfTmoCRUnCusOO6FrtqFKaRVP9NryOilwiPNieuVLtpx/MAHHWxsgYoGMdTMoIT+1p1Jhu7l3PmofWYg==
+
 #
 # The Libuxb build instructions. We use 1.xx Release 1.
 #
diff --git a/source-builder/config/libusb-1-1.cfg 
b/source-builder/config/libusb-1-1.cfg
index 4b250a3..803f326 100644
--- a/source-builder/config/libusb-1-1.cfg
+++ b/source-builder/config/libusb-1-1.cfg
@@ -33,8 +33,10 @@ URL:http://libusb.org/
   cd libusb-%{libusb_version}
 
 %if "%{_build}" != "%{_host}"
-  CFLAGS_FOR_BUILD="-g -O2 -Wall" \
+  LIBUSB_CFLAGS_FOR_BUILD="-g -O2 -Wall"
 %endif
+
+  CFLAGS_FOR_BUILD=${LIBUSB_CFLAGS_FOR_BUILD} \
   CFLAGS="$SB_CFLAGS" \
   ./configure \
 --build=%{_build} --host=%{_host} \
-- 
2.27.0

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


[PATCH 1/3] rtems: Remove RTEMS 6 build sets.

2020-08-10 Thread chrisj
From: Chris Johns 

Updates #4014
---
 rtems/config/6/rtems-aarch64.bset|  4 
 rtems/config/6/rtems-all.bset| 19 ---
 rtems/config/6/rtems-arm.bset|  4 
 rtems/config/6/rtems-autotools-base.bset |  9 ---
 rtems/config/6/rtems-autotools-internal.bset | 11 -
 rtems/config/6/rtems-autotools.bset  | 25 
 rtems/config/6/rtems-base.bset   | 13 --
 rtems/config/6/rtems-bfin.bset   |  3 ---
 rtems/config/6/rtems-default.bset| 15 
 rtems/config/6/rtems-epiphany.bset   | 17 -
 rtems/config/6/rtems-i386.bset   |  4 
 rtems/config/6/rtems-lm32.bset   |  3 ---
 rtems/config/6/rtems-m68k.bset   |  3 ---
 rtems/config/6/rtems-microblaze.bset |  3 ---
 rtems/config/6/rtems-mips.bset   |  6 -
 rtems/config/6/rtems-moxie.bset  |  6 -
 rtems/config/6/rtems-nios2.bset  |  3 ---
 rtems/config/6/rtems-or1k.bset   |  3 ---
 rtems/config/6/rtems-powerpc.bset|  4 
 rtems/config/6/rtems-riscv.bset  |  4 
 rtems/config/6/rtems-sh.bset |  3 ---
 rtems/config/6/rtems-sparc.bset  |  6 -
 rtems/config/6/rtems-sparc64.bset|  3 ---
 rtems/config/6/rtems-v850.bset   |  3 ---
 rtems/config/6/rtems-x86_64.bset |  4 
 25 files changed, 178 deletions(-)
 delete mode 100644 rtems/config/6/rtems-aarch64.bset
 delete mode 100644 rtems/config/6/rtems-all.bset
 delete mode 100644 rtems/config/6/rtems-arm.bset
 delete mode 100644 rtems/config/6/rtems-autotools-base.bset
 delete mode 100644 rtems/config/6/rtems-autotools-internal.bset
 delete mode 100644 rtems/config/6/rtems-autotools.bset
 delete mode 100644 rtems/config/6/rtems-base.bset
 delete mode 100644 rtems/config/6/rtems-bfin.bset
 delete mode 100644 rtems/config/6/rtems-default.bset
 delete mode 100644 rtems/config/6/rtems-epiphany.bset
 delete mode 100644 rtems/config/6/rtems-i386.bset
 delete mode 100644 rtems/config/6/rtems-lm32.bset
 delete mode 100644 rtems/config/6/rtems-m68k.bset
 delete mode 100644 rtems/config/6/rtems-microblaze.bset
 delete mode 100644 rtems/config/6/rtems-mips.bset
 delete mode 100644 rtems/config/6/rtems-moxie.bset
 delete mode 100644 rtems/config/6/rtems-nios2.bset
 delete mode 100644 rtems/config/6/rtems-or1k.bset
 delete mode 100644 rtems/config/6/rtems-powerpc.bset
 delete mode 100644 rtems/config/6/rtems-riscv.bset
 delete mode 100644 rtems/config/6/rtems-sh.bset
 delete mode 100644 rtems/config/6/rtems-sparc.bset
 delete mode 100644 rtems/config/6/rtems-sparc64.bset
 delete mode 100644 rtems/config/6/rtems-v850.bset
 delete mode 100644 rtems/config/6/rtems-x86_64.bset

diff --git a/rtems/config/6/rtems-aarch64.bset 
b/rtems/config/6/rtems-aarch64.bset
deleted file mode 100644
index e3c91af..000
--- a/rtems/config/6/rtems-aarch64.bset
+++ /dev/null
@@ -1,4 +0,0 @@
-%define release 1
-%define rtems_arch aarch64
-%define with_libgomp
-%include 6/rtems-default.bset
diff --git a/rtems/config/6/rtems-all.bset b/rtems/config/6/rtems-all.bset
deleted file mode 100644
index 8f020f9..000
--- a/rtems/config/6/rtems-all.bset
+++ /dev/null
@@ -1,19 +0,0 @@
-6/rtems-aarch64
-6/rtems-arm
-6/rtems-bfin
-6/rtems-epiphany
-6/rtems-i386
-6/rtems-lm32
-6/rtems-m68k
-6/rtems-microblaze
-6/rtems-mips
-6/rtems-moxie
-6/rtems-nios2
-6/rtems-or1k
-6/rtems-powerpc
-6/rtems-riscv
-6/rtems-sh
-6/rtems-sparc
-6/rtems-sparc64
-6/rtems-v850
-6/rtems-x86_64
diff --git a/rtems/config/6/rtems-arm.bset b/rtems/config/6/rtems-arm.bset
deleted file mode 100644
index 425d66b..000
--- a/rtems/config/6/rtems-arm.bset
+++ /dev/null
@@ -1,4 +0,0 @@
-%define release 1
-%define rtems_arch arm
-%define with_libgomp
-%include 6/rtems-default.bset
diff --git a/rtems/config/6/rtems-autotools-base.bset 
b/rtems/config/6/rtems-autotools-base.bset
deleted file mode 100644
index c6819c1..000
--- a/rtems/config/6/rtems-autotools-base.bset
+++ /dev/null
@@ -1,9 +0,0 @@
-%define release 1
-%define rtems_arch none
-
-%include 6/rtems-base.bset
-
-package: rtems-%{rtems_version}-autotools-%{_host}-%{release}
-
-tools/rtems-autoconf-2.69-1
-tools/rtems-automake-1.12.6-1
diff --git a/rtems/config/6/rtems-autotools-internal.bset 
b/rtems/config/6/rtems-autotools-internal.bset
deleted file mode 100644
index 19d2f19..000
--- a/rtems/config/6/rtems-autotools-internal.bset
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# Do not use via the command line.
-#
-
-%define _internal_autotools yes
-%define _disable_collecting yes
-%define _disable_packaging  yes
-%define _disable_reporting  yes
-%define _disable_installing yes
-
-%include 6/rtems-autotools-base.bset
diff --git a/rtems/config/6/rtems-autotools.bset 
b/rtems/config/6/rtems-autotools.bset
deleted file mode 100644
index e57d25d..000
--- a/rtems/config/6/rtems-autotoo

[PATCH] user, README: Add Python script host set up information

2020-08-10 Thread chrisj
From: Chris Johns 

- Add Python3 and venv to the README

- Add a section on how to set up a host if the python command is
  not available.

Update #4037
---
 README.txt|  18 --
 user/hosts/index.rst  |  22 ---
 user/hosts/python.rst | 137 ++
 3 files changed, 161 insertions(+), 16 deletions(-)
 create mode 100644 user/hosts/python.rst

diff --git a/README.txt b/README.txt
index ce30505..03f57ed 100644
--- a/README.txt
+++ b/README.txt
@@ -101,14 +101,20 @@ command.
 
 Please add your host as you set it up.
 
-The best environment to use is `virtualenv`. It can create a specific python
-environment using `pip`.
+The best results are produced with Python3 and a virtual environment`. It can
+create a specific python environment using `pip`.
 
-Virtualenv
-~~
+Virtual Environment
+~~~
+
+Create a directory to house the virtual environment, create the envrionment
+and the activate it. This example assumes Python3 and the `venv` module:
+
+  $ mkdir sphinx
+  $ python3 -m venv sphinx
+  $ . ./sphinx/bin/activate
 
-Create a directory to house the virtualenv, create the envrionment and the
-activate it:
+Alternatively you can use the `virtualenv` command:
 
   $ mkdir sphinx
   $ virtualenv sphinx
diff --git a/user/hosts/index.rst b/user/hosts/index.rst
index 5588339..29de1ce 100644
--- a/user/hosts/index.rst
+++ b/user/hosts/index.rst
@@ -15,11 +15,11 @@ development computer, more often called the host computer. 
These are typically
 your desktop machine or a special build server. All RTEMS tools and runtime
 libraries are built from source on your host machine. The RTEMS Project does
 not maintain binary builds of the tools. This differs to what you normally
-experience with host operating systems, and it is, however this approach works
-well. RTEMS is not a host operating system and it is not a
-distrbution. Deploying binary packages for every possible host operating system
-is too big a task for the RTEMS Project and it is not a good use of core
-developer time. Their time is better spent making RTEMS better and faster.
+experience with host operating systems however this approach works well. RTEMS
+is not a host operating system and it is not a distrbution. Deploying binary
+packages for every possible host operating system is too big a task for the
+RTEMS Project and it is not a good use of core developer time. Their time is
+better spent making RTEMS better and faster.
 
 The RTEMS Project's aim is to give you complete freedom to decide on the
 languages used in your project, which version control system, and the build
@@ -37,14 +37,16 @@ engineer a development environment that suites you. The 
basic specs are:
 
 RTEMS makes no demands on graphics.
 
-If you are using a VM or your host computer is not a fast modern machine do not
-be concerned. The tools may take longer to build than faster hardware however
-building tools is something you do once. Once the tools and RTEMS is built all
-your time can be spent writing and developing your application. Over an hour
-can happen and for the ARM architecture and with all BSPs it can be many hours.
+If you are using a VM or your host computer is not a fast modern machine do
+not be concerned. The tools may take longer to build than faster hardware
+however building tools is something you do once. Once the tools and RTEMS are
+built all your time can be spent writing and developing your application. It
+may take longer than an hour for the ARM architecture and with all BSPs it can
+be many hours.
 
 .. toctree::
 
+   python
os
posix
macos
diff --git a/user/hosts/python.rst b/user/hosts/python.rst
new file mode 100644
index 000..350795b
--- /dev/null
+++ b/user/hosts/python.rst
@@ -0,0 +1,137 @@
+.. SPDX-License-Identifier: CC-BY-SA-4.0
+
+.. Copyright (C) 2020 Chris Johns 
+
+.. _host-os:
+
+Python
+==
+
+RTEMS uses Python in a range of host tools for users and
+developer. RTEMS supports:
+
+#. Python3 and Python2 for user tools,
+
+#. Python3 for developer tools.
+
+Python2 is now **end of life** however the RTEMS Project will continue to
+provide support for it's user commands. We do this to support older host
+operating systems some users may be forced to support. At some point the
+project will drop support for Python2 so we recommend users look at ways to
+transition to Python3 if it is not easily available.
+
+Developers of RTEMS are required to have Python3 available. RTEMS tools used
+by developers for the development and maintance of RTEMS are Python3 only.
+
+All RTEMS Tools that can be invoked from the command line start with the
+following line:
+
+.. code-block::
+
+  #! /usr/bin/env python
+
+The ``env`` command is available on all POSIX host operating systems and it
+searchs the ``$PATH`` environment variable for the ``python`` command invoking
+it with the script as the first argument. This means you need to have a
+suitable ``python`` command

[PATCH 1/2] user: Remove RSB sb-builder command

2020-08-10 Thread chrisj
From: Chris Johns 

Updates #4045
---
 user/rsb/commands.rst  | 40 ---
 user/rsb/configuration.rst | 49 +++---
 2 files changed, 14 insertions(+), 75 deletions(-)

diff --git a/user/rsb/commands.rst b/user/rsb/commands.rst
index b4787aa..04d3cea 100644
--- a/user/rsb/commands.rst
+++ b/user/rsb/commands.rst
@@ -295,43 +295,3 @@ The ``arguments`` are a list of build sets to build.
 ``--list-deps``:
   Print a list of dependent files used by a build set. Dependent files have a
   ``dep[?]` prefix where ``?`` is a number. The files are listed 
alphabetically.
-
-Set Builder (sb-builder)
-
-
-This command builds a configuration as described in a configuration
-file. Configuration files have the extension of ``.cfg``:
-
-.. code-block:: none
-
-$ ./source-builder/sb-builder --help
-sb-builder: [options] [args]
-RTEMS Source Builder, an RTEMS Tools Project (c) 2012 Chris Johns
-Options and arguments:
---force: Force the build to proceed
---quiet: Quiet output (not used)
---trace: Trace the execution
---dry-run  : Do everything but actually run the build
---warn-all : Generate warnings
---no-clean : Do not clean up the build tree
---always-clean : Always clean the build tree, even with an error
---jobs : Run with specified number of jobs, default: num 
CPUs.
---host : Set the host triplet
---build: Set the build triplet
---target   : Set the target triplet
---prefix path  : Tools build prefix, ie where they are installed
---topdir path  : Top of the build tree, default is $PWD
---configdir path   : Path to the configuration directory, default: 
./config
---builddir path: Path to the build directory, default: ./build
---sourcedir path   : Path to the source directory, default: ./source
---patchdir path: Path to the patches directory, default: ./patches
---tmppath path : Path to the temp directory, default: ./tmp
---macros file[,[file]  : Macro format files to load after the defaults
---log file : Log file where all build out is written too
---url url[,url]: URL to look for source
---targetcflags flags   : List of C flags for the target code
---targetcxxflags flags : List of C++ flags for the target code
---libstdcxxflags flags : List of C++ flags to build the target libstdc++ 
code
---with- : Add the --with- to the build
---without-  : Add the --without- to the build
---list-configs : List available configurations
diff --git a/user/rsb/configuration.rst b/user/rsb/configuration.rst
index e31d1bb..1403c4f 100644
--- a/user/rsb/configuration.rst
+++ b/user/rsb/configuration.rst
@@ -40,8 +40,7 @@ The configuration search path is a macro variable and is 
reference as
 
 Build set files have the file extension ``.bset`` and the package build
 configuration files have the file extension of ``.cfg``. The ``sb-set-builder``
-command will search for *build sets* and the ``sb-builder`` commands works with
-package build configuration files.
+command will search for *build sets*.
 
 Both types of configuration files use the ``#`` character as a comment
 character. Anything after this character on the line is ignored. There is no
@@ -450,13 +449,12 @@ tools.
 
 File naming provides configuration management. A specific version of a package
 is captured in a specific set of configuration files. The top level
-configuration file referenced in a *build set* or passed to the ``sb-builder``
-command relates to a specific configuration of the package being built. For
-example the RTEMS configuration file ``rtems-gcc-4.7.2-newlib-2.0.0-1.cfg``
-creates an RTEMS GCC and Newlib package where the GCC version is 4.7.2, the
-Newlib version is 2.0.0, plus any RTEMS specific patches that related to this
-version. The configuration defines the version numbers of the various parts
-that make up this package:
+configuration file referenced in a *build set* relates to a specific
+configuration of the package being built. For example the RTEMS configuration
+file ``rtems-gcc-4.7.2-newlib-2.0.0-1.cfg`` creates an RTEMS GCC and Newlib
+package where the GCC version is 4.7.2, the Newlib version is 2.0.0, plus any
+RTEMS specific patches that related to this version. The configuration defines
+the version numbers of the various parts that make up this package:
 
 .. code-block:: spec
 
@@ -736,28 +734,11 @@ Finally there is an optional clean section. The RSB will 
run this section if
 ``--no-clean`` has not been provided on the command line. The RSB does clean up
 for you.
 
-Once we have the configuration files we can execute the build using the
-``sb-builder`` command. The command will perform the build 

[PATCH 2/2] user, eclipse: Remove RSB sb-bootstrap command

2020-08-10 Thread chrisj
From: Chris Johns 

Update #4046
---
 eclipse/rtems.rst   | 2 +-
 user/installation/developer.rst | 6 +++---
 user/installation/kernel.rst| 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/eclipse/rtems.rst b/eclipse/rtems.rst
index 4459749..3db2e7b 100644
--- a/eclipse/rtems.rst
+++ b/eclipse/rtems.rst
@@ -44,7 +44,7 @@ Now run the `bootstrap` command:
   $ ./bootstrap
 
 Sit back, this can take a while. The Getting Started Guide talks about using
-the RSB's `sb-bootstrap` to run the bootstrap process in parallel on all
+the `rtems-bootstrap` to run the bootstrap process in parallel on all
 available cores. The output of the bootstrap has not been copied into this
 documentment.
 
diff --git a/user/installation/developer.rst b/user/installation/developer.rst
index ff7eefe..1b2b785 100644
--- a/user/installation/developer.rst
+++ b/user/installation/developer.rst
@@ -576,12 +576,12 @@ Then we generate the pre-install header file automake 
make files:
   Generating ./cpukit/zlib/preinstall.am
/c/opt/rtems/kernel/rtems
 
-Finally we run the RSB's parallel ``bootstrap`` command:
+Finally we run the parallel ``bootstrap`` command:
 
 .. code-block:: none
 
-  $ /c/opt/rtems/rsb/source-builder/sb-bootstrap
-  RTEMS Source Builder - RTEMS Bootstrap, 4.11 (76188ee494dd)
+  $ ./rtems-bootstrap
+  RTEMS Bootstrap, 4.11 (76188ee494dd)
 1/139: autoreconf: configure.ac
 2/139: autoreconf: c/configure.ac
 3/139: autoreconf: c/src/configure.ac
diff --git a/user/installation/kernel.rst b/user/installation/kernel.rst
index f8c3c6f..fca4ed7 100644
--- a/user/installation/kernel.rst
+++ b/user/installation/kernel.rst
@@ -57,18 +57,18 @@ The developers version of the code from git requires we 
``bootstrap`` the
 source code. This is an ``autoconf`` and ``automake`` bootstrap to create the
 various files generated by ``autoconf`` and ``automake``. RTEMS does not keep
 these generated files under version control. The bootstrap process is slow so
-to speed it up the RSB provides a command that can perform the bootstrap in
+to speed it up we provide a command that can perform the bootstrap in
 parallel using your available cores. We need to enter the cloned source
 directory then run the bootstrap commands:
 
 .. code-block:: none
 
   $ cd rtems
-  $ ./bootstrap -c && $HOME/development/rtems/rsb/source-builder/sb-bootstrap
+  $ ./bootstrap -c && ./rtems-bootstrap
   removing automake generated Makefile.in files
   removing configure files
   removing aclocal.m4 files
-  RTEMS Source Builder - RTEMS Bootstrap, 5 (089327b5dcf9)
+  RTEMS Bootstrap, 5 (089327b5dcf9)
 1/139: autoreconf: configure.ac
 2/139: autoreconf: cpukit/configure.ac
 3/139: autoreconf: tools/cpu/configure.ac
-- 
2.24.1

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


[PATCH] user: Add the RSB sb-track command

2020-08-10 Thread chrisj
From: Chris Johns 

Updates #4036
---
 user/rsb/commands.rst | 81 +++
 1 file changed, 81 insertions(+)

diff --git a/user/rsb/commands.rst b/user/rsb/commands.rst
index 04d3cea..4048568 100644
--- a/user/rsb/commands.rst
+++ b/user/rsb/commands.rst
@@ -295,3 +295,84 @@ The ``arguments`` are a list of build sets to build.
 ``--list-deps``:
   Print a list of dependent files used by a build set. Dependent files have a
   ``dep[?]` prefix where ``?`` is a number. The files are listed 
alphabetically.
+
+Track (sb-track)
+
+
+This command checks build sets and configurations reporting any errors, the
+dependencies and which files are referenced. The command can list all the
+configuration files not referenced. If this option is used when checking all
+build set files a list of all configuration files not referenced can be
+found. The list can be used to purge the RSB of old and unused configurations.
+
+The check runs a build set through a number of host configurations. This
+checks any logic that is specific to a host.
+
+The command reports a dependency tree for a build set in the output
+report. For example the dependency tree for the ``database/sqlite`` build set
+is:
+
+.. code-block:: none
+
+  +-- rtems/config/databases/sqlite.bset
+   +-- rtems/config/databases/sqlite-3.31.1-1.cfg
++-- rtems/config/rtems-bsp.cfg
++-- source-builder/config/sqlite-3-1.cfg
+   +-- rtems/config/rtems-package.bset
++-- rtems/config/rtems-urls.bset
++-- rtems/config/rtems-version.bset
+
+The comnmand is:
+
+.. code-block:: none
+
+$ ../source-builder/sb-track --help
+usage: sb-dep-check [-h] [--rtems-version RTEMS_VERSION] [--list-hosts]
+[--list-bsets] [--output OUTPUT] [--log LOG] [--trace]
+[--not-referenced]
+[bsets [bsets ...]]
+
+RTEMS Track Dependencies a build set has for all hosts.
+
+positional arguments:
+  bsets Build sets.
+
+optional arguments:
+  -h, --helpshow this help message and exit
+  --rtems-version RTEMS_VERSION
+Set the RTEMS version.
+  --list-hosts  List the hosts.
+  --list-bsets  List the hosts.
+  --output OUTPUT   Output file.
+  --log LOG Log file.
+  --trace   Enable trace logging for debugging.
+  --not-referenced  Write out the list of config files not referenced.
+
+The ``bsets`` are a list of build sets to check. If none are provided all
+build sets are checked.
+
+**Options**:
+
+``-h, --help``:
+  The command's help.
+
+``--rtems-version``:
+  Set the RTEMS version number.
+
+``--list-hosts``:
+  List the hosts each build set of check against.
+
+``--list-bsets``:
+  List all the build set files.
+
+``--output``:
+  Write the report to the output file.
+
+``--log``:
+  The log file the build set check processing is written too.
+
+``--trace``:
+  Enable trace debugging.
+
+``--not-referenced``:
+  List the configration files not referenced by a build set in the output.
-- 
2.24.1

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


[PATCH] Move 5 build sets to 6

2020-08-12 Thread chrisj
From: Chris Johns 

- Move 5/bsps/* to bsps/*

- Update package build references from 5 to 6

- Remove 5 build sets.

Update #4048
---
 rtems/config/5/bsps/atsamv.bset  | 10 --
 rtems/config/5/bsps/imx7.bset| 10 --
 rtems/config/5/bsps/qoriq_e500.bset  | 10 --
 rtems/config/5/bsps/qoriq_e6500_32.bset  | 10 --
 rtems/config/5/bsps/qoriq_e6500_64.bset  | 10 --
 rtems/config/6/rtems-default.bset|  3 +++
 rtems/config/{5 => 6}/rtems-kernel.bset  |  2 +-
 rtems/config/{5 => 6}/rtems-libbsd.bset  |  2 +-
 rtems/config/{5 => 6}/rtems-llvm.bset|  0
 rtems/config/{5 => 6}/rtems-packages.bset|  0
 rtems/config/{5 => 6}/rtems-tools.bset   |  4 ++--
 rtems/config/bsps/atsamv.bset| 10 ++
 rtems/config/{5 => }/bsps/beagleboneblack.bset   | 10 +-
 rtems/config/{5 => }/bsps/erc32.bset | 10 +-
 rtems/config/{5 => }/bsps/gr712rc.bset   |  6 +++---
 rtems/config/{5 => }/bsps/gr740.bset |  6 +++---
 rtems/config/bsps/imx7.bset  | 10 ++
 rtems/config/{5 => }/bsps/pc.bset| 10 +-
 rtems/config/bsps/qoriq_e500.bset| 10 ++
 rtems/config/bsps/qoriq_e6500_32.bset| 10 ++
 rtems/config/bsps/qoriq_e6500_64.bset| 10 ++
 rtems/config/{5 => }/bsps/raspberrypi2.bset  | 10 +-
 rtems/config/{5 => }/bsps/xilinx_zynq_zc702.bset | 10 +-
 rtems/config/{5 => }/bsps/xilinx_zynq_zc706.bset | 10 +-
 rtems/config/{5 => }/bsps/xilinx_zynq_zedboard.bset  | 10 +-
 rtems/config/ftp/curl.bset   |  5 -
 rtems/config/net-mgmt/net-snmp.bset  |  5 -
 rtems/config/tools/rtems-kernel-5.cfg| 12 
 rtems/config/tools/rtems-kernel-6.cfg| 12 
 rtems/config/tools/rtems-kernel-common.cfg   |  3 +--
 .../tools/{rtems-libbsd-5.cfg => rtems-libbsd-6.cfg} |  7 ---
 31 files changed, 115 insertions(+), 122 deletions(-)
 delete mode 100644 rtems/config/5/bsps/atsamv.bset
 delete mode 100644 rtems/config/5/bsps/imx7.bset
 delete mode 100644 rtems/config/5/bsps/qoriq_e500.bset
 delete mode 100644 rtems/config/5/bsps/qoriq_e6500_32.bset
 delete mode 100644 rtems/config/5/bsps/qoriq_e6500_64.bset
 rename rtems/config/{5 => 6}/rtems-kernel.bset (88%)
 rename rtems/config/{5 => 6}/rtems-libbsd.bset (77%)
 rename rtems/config/{5 => 6}/rtems-llvm.bset (100%)
 rename rtems/config/{5 => 6}/rtems-packages.bset (100%)
 rename rtems/config/{5 => 6}/rtems-tools.bset (74%)
 create mode 100644 rtems/config/bsps/atsamv.bset
 rename rtems/config/{5 => }/bsps/beagleboneblack.bset (68%)
 rename rtems/config/{5 => }/bsps/erc32.bset (65%)
 rename rtems/config/{5 => }/bsps/gr712rc.bset (55%)
 rename rtems/config/{5 => }/bsps/gr740.bset (55%)
 create mode 100644 rtems/config/bsps/imx7.bset
 rename rtems/config/{5 => }/bsps/pc.bset (65%)
 create mode 100644 rtems/config/bsps/qoriq_e500.bset
 create mode 100644 rtems/config/bsps/qoriq_e6500_32.bset
 create mode 100644 rtems/config/bsps/qoriq_e6500_64.bset
 rename rtems/config/{5 => }/bsps/raspberrypi2.bset (67%)
 rename rtems/config/{5 => }/bsps/xilinx_zynq_zc702.bset (68%)
 rename rtems/config/{5 => }/bsps/xilinx_zynq_zc706.bset (68%)
 rename rtems/config/{5 => }/bsps/xilinx_zynq_zedboard.bset (69%)
 delete mode 100644 rtems/config/tools/rtems-kernel-5.cfg
 create mode 100644 rtems/config/tools/rtems-kernel-6.cfg
 rename rtems/config/tools/{rtems-libbsd-5.cfg => rtems-libbsd-6.cfg} (63%)

diff --git a/rtems/config/5/bsps/atsamv.bset b/rtems/config/5/bsps/atsamv.bset
deleted file mode 100644
index 4bde317..000
--- a/rtems/config/5/bsps/atsamv.bset
+++ /dev/null
@@ -1,10 +0,0 @@
-%define mail_single_report 1
-
-%define with_rtems_bsp atsamv
-%define rtems_target   arm-rtems5
-%define rtems_host %{rtems_target}
-
-5/rtems-arm
-5/rtems-kernel
-5/rtems-libbsd
-5/rtems-packages
diff --git a/rtems/config/5/bsps/imx7.bset b/rtems/config/5/bsps/imx7.bset
deleted file mode 100644
index c48a526..000
--- a/rtems/config/5/bsps/imx7.bset
+++ /dev/null
@@ -1,10 +0,0 @@
-%define mail_single_report 1
-
-%define with_rtems_bsp imx7
-%define rtems_target   arm-rtems5
-%define rtems_host %{rtems_target}
-
-5/rtems-arm
-5/rtems-kernel
-5/rtems-libbsd
-5/rtems-packages
diff --git a/rtems/config/5/bsps/qoriq_e500.bset 
b/rtems/config/5/bsps/qoriq_e500.bset
deleted file mode 100644
index 4390e72..000
--- a/rtems/config/5/bsps/qoriq_e500.bset
+++ /dev/null
@@ -1,10 +0,0 @@
-%define mail_single_report 1
-
-%define with_rtems_bsp qoriq_e500
-%define rtems_target   powerpc-rtems5
-%define rtems_host %{rtems_target}
-
-5/rtems-powerpc
-5/rtems-kernel
-5/rtems-l

[PATCH v2] Move 5 build sets to 6

2020-08-12 Thread chrisj
From: Chris Johns 

- Move 5/bsps/* to bsps/*

- Update package build references from 5 to 6

- Remove 5 build sets.

Update #4048
---
 rtems/config/5/bsps/atsamv.bset   | 10 -
 rtems/config/5/bsps/imx7.bset | 10 -
 rtems/config/5/bsps/qoriq_e500.bset   | 10 -
 rtems/config/5/bsps/qoriq_e6500_32.bset   | 10 -
 rtems/config/5/bsps/qoriq_e6500_64.bset   | 10 -
 rtems/config/5/rtems-aarch64.bset |  4 --
 rtems/config/5/rtems-all.bset | 19 -
 rtems/config/5/rtems-arm.bset |  4 --
 rtems/config/5/rtems-autotools-base.bset  | 23 ---
 rtems/config/5/rtems-autotools-internal.bset  | 13 ---
 rtems/config/5/rtems-autotools.bset   | 27 -
 rtems/config/5/rtems-bfin.bset|  3 --
 rtems/config/5/rtems-default.bset | 22 ---
 rtems/config/5/rtems-epiphany.bset| 39 ---
 rtems/config/5/rtems-i386.bset|  4 --
 rtems/config/5/rtems-lm32.bset| 10 -
 rtems/config/5/rtems-m68k.bset|  3 --
 rtems/config/5/rtems-microblaze.bset  |  3 --
 rtems/config/5/rtems-mips.bset|  6 ---
 rtems/config/5/rtems-moxie.bset   | 12 --
 rtems/config/5/rtems-nios2.bset   |  3 --
 rtems/config/5/rtems-or1k.bset| 15 ---
 rtems/config/5/rtems-powerpc.bset |  8 
 rtems/config/5/rtems-riscv.bset   | 17 
 rtems/config/5/rtems-sh.bset  |  6 ---
 rtems/config/5/rtems-sparc.bset   |  6 ---
 rtems/config/5/rtems-sparc64.bset |  3 --
 rtems/config/5/rtems-tier-1.bset  |  5 ---
 rtems/config/5/rtems-tier-2.bset  |  3 --
 rtems/config/5/rtems-tier-3.bset  | 17 
 rtems/config/5/rtems-tier-4.bset  | 10 -
 rtems/config/5/rtems-v850.bset|  3 --
 rtems/config/5/rtems-x86_64.bset  | 13 ---
 rtems/config/6/rtems-default.bset |  3 ++
 rtems/config/{5 => 6}/rtems-kernel.bset   |  2 +-
 rtems/config/{5 => 6}/rtems-libbsd.bset   |  2 +-
 rtems/config/{5 => 6}/rtems-llvm.bset |  0
 rtems/config/{5 => 6}/rtems-packages.bset |  0
 rtems/config/{5 => 6}/rtems-tools.bset|  4 +-
 rtems/config/bsps/atsamv.bset | 10 +
 .../config/{5 => }/bsps/beagleboneblack.bset  | 10 ++---
 rtems/config/{5 => }/bsps/erc32.bset  | 10 ++---
 rtems/config/{5 => }/bsps/gr712rc.bset|  6 +--
 rtems/config/{5 => }/bsps/gr740.bset  |  6 +--
 rtems/config/bsps/imx7.bset   | 10 +
 rtems/config/{5 => }/bsps/pc.bset | 10 ++---
 rtems/config/bsps/qoriq_e500.bset | 10 +
 rtems/config/bsps/qoriq_e6500_32.bset | 10 +
 rtems/config/bsps/qoriq_e6500_64.bset | 10 +
 rtems/config/{5 => }/bsps/raspberrypi2.bset   | 10 ++---
 .../{5 => }/bsps/xilinx_zynq_zc702.bset   | 10 ++---
 .../{5 => }/bsps/xilinx_zynq_zc706.bset   | 10 ++---
 .../{5 => }/bsps/xilinx_zynq_zedboard.bset| 10 ++---
 rtems/config/ftp/curl.bset|  5 ---
 rtems/config/net-mgmt/net-snmp.bset   |  5 ---
 rtems/config/tools/rtems-kernel-5.cfg | 12 --
 rtems/config/tools/rtems-kernel-6.cfg | 12 ++
 rtems/config/tools/rtems-kernel-common.cfg|  3 +-
 ...{rtems-libbsd-5.cfg => rtems-libbsd-6.cfg} |  7 ++--
 59 files changed, 115 insertions(+), 423 deletions(-)
 delete mode 100644 rtems/config/5/bsps/atsamv.bset
 delete mode 100644 rtems/config/5/bsps/imx7.bset
 delete mode 100644 rtems/config/5/bsps/qoriq_e500.bset
 delete mode 100644 rtems/config/5/bsps/qoriq_e6500_32.bset
 delete mode 100644 rtems/config/5/bsps/qoriq_e6500_64.bset
 delete mode 100644 rtems/config/5/rtems-aarch64.bset
 delete mode 100644 rtems/config/5/rtems-all.bset
 delete mode 100644 rtems/config/5/rtems-arm.bset
 delete mode 100644 rtems/config/5/rtems-autotools-base.bset
 delete mode 100644 rtems/config/5/rtems-autotools-internal.bset
 delete mode 100644 rtems/config/5/rtems-autotools.bset
 delete mode 100644 rtems/config/5/rtems-bfin.bset
 delete mode 100644 rtems/config/5/rtems-default.bset
 delete mode 100644 rtems/config/5/rtems-epiphany.bset
 delete mode 100644 rtems/config/5/rtems-i386.bset
 delete mode 100644 rtems/config/5/rtems-lm32.bset
 delete mode 100644 rtems/config/5/rtems-m68k.bset
 delete mode 100644 rtems/config/5/rtems-microblaze.bset
 delete mode 100644 rtems/config/5/rtems-mips.bset
 delete mode 100644 rtems/config/5/rtems-moxie.bset
 delete mode 100644 rtems/config/5/rtems-nios2.bset
 delete mode 100644 rtems/config/5/rtems-or1k.bset
 delete mode 100644 rtems/config/5/rtems-powerpc.bset
 delete mode 100644 rtems/config/5/rtems-riscv.bset
 delete mode 100644 rtems/config/5/rtems-sh.bset
 delete mode 100644 rtems/config/5/rtems-sparc.bset
 delete mode

[PATCH] sb: Use shebang env python

2020-08-25 Thread chrisj
From: Chris Johns 

Closes #4037
---
 source-builder/pkg-config | 236 +++---
 source-builder/sb-check   |  24 +--
 source-builder/sb-defaults|  23 +--
 source-builder/sb-get-sources |  23 +--
 source-builder/sb-reports |  23 +--
 source-builder/sb-rtems-config|  23 +--
 source-builder/sb-set-builder |  22 +--
 source-builder/sb-track   |  22 +--
 source-builder/sb/build.py|  22 +--
 source-builder/sb/check.py|  16 +-
 source-builder/sb/cmd-check.py|  29 
 source-builder/sb/cmd-defaults.py |  29 
 source-builder/sb/cmd-get-sources.py  |  29 
 source-builder/sb/cmd-pkg-config.py   | 220 
 source-builder/sb/cmd-reports.py  |  29 
 source-builder/sb/cmd-rtems-config.py |  29 
 source-builder/sb/cmd-set-builder.py  |  29 
 source-builder/sb/cmd-track.py|  29 
 source-builder/sb/config.py   |  16 +-
 source-builder/sb/cvs.py  |  10 +-
 source-builder/sb/darwin.py   |   2 +-
 source-builder/sb/download.py |  14 +-
 source-builder/sb/ereport.py  |   4 +-
 source-builder/sb/execute.py  |   4 +-
 source-builder/sb/freebsd.py  |   6 +-
 source-builder/sb/getsources.py   |  12 +-
 source-builder/sb/git.py  |  13 +-
 source-builder/sb/linux.py|   4 +-
 source-builder/sb/log.py  |   2 +-
 source-builder/sb/macros.py   |   4 +-
 source-builder/sb/mailer.py   |   6 +-
 source-builder/sb/netbsd.py   |   4 +-
 source-builder/sb/options.py  |  44 +++--
 source-builder/sb/path.py |   4 +-
 source-builder/sb/pkgconfig.py|   9 +-
 source-builder/sb/python-wrapper.sh   |  39 -
 source-builder/sb/reports.py  |  22 +--
 source-builder/sb/rtemsconfig.py  |  10 +-
 source-builder/sb/setbuilder.py   |  22 +--
 source-builder/sb/shell.py|   8 +-
 source-builder/sb/simhost.py  |  36 ++--
 source-builder/sb/solaris.py  |   6 +-
 source-builder/sb/sources.py  |   2 +-
 source-builder/sb/track.py|  14 +-
 source-builder/sb/version.py  |   6 +-
 source-builder/sb/windows.py  |   6 +-
 46 files changed, 471 insertions(+), 715 deletions(-)
 delete mode 100755 source-builder/sb/cmd-check.py
 delete mode 100755 source-builder/sb/cmd-defaults.py
 delete mode 100755 source-builder/sb/cmd-get-sources.py
 delete mode 100755 source-builder/sb/cmd-pkg-config.py
 delete mode 100755 source-builder/sb/cmd-reports.py
 delete mode 100755 source-builder/sb/cmd-rtems-config.py
 delete mode 100755 source-builder/sb/cmd-set-builder.py
 delete mode 100755 source-builder/sb/cmd-track.py
 delete mode 100644 source-builder/sb/python-wrapper.sh

diff --git a/source-builder/pkg-config b/source-builder/pkg-config
index 65ee307..10db546 100755
--- a/source-builder/pkg-config
+++ b/source-builder/pkg-config
@@ -1,27 +1,221 @@
-#! /bin/sh
+#! /usr/bin/env python
 #
 # RTEMS Tools Project (http://www.rtems.org/)
-# Copyright 2018 Chris Johns (chr...@rtems.org)
+# Copyright 2014-2016 Chris Johns (chr...@rtems.org)
 # All rights reserved.
 #
 # This file is part of the RTEMS Tools package in 'rtems-tools'.
 #
-# Permission to use, copy, modify, and/or distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-set -e
-base=$(dirname $0)
-PYTHON_CMD=${base}/sb/cmd-pkg-config.py
-if test -f ${base}/sb/python-wrapper.sh; then
-  . ${base}/sb/python-wrapper.sh
-fi
-echo "error: python wrapper not found"
+# 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 PUR

[PATCH] tester: Change to a simpler TFTP server

2020-08-26 Thread chrisj
From: Chris Johns 

- Add a simpler TFTP to allow parallel test hardware

- Remove the imported tftpy server

Closes #4063
---
 tester/rt/tftp.py|  37 +-
 tester/rt/tftpserver.py  | 619 +++
 tester/rt/tftpy/COPYING  |  21 -
 tester/rt/tftpy/README   | 115 -
 tester/rt/tftpy/TftpClient.py| 107 -
 tester/rt/tftpy/TftpContexts.py  | 429 ---
 tester/rt/tftpy/TftpPacketFactory.py |  47 --
 tester/rt/tftpy/TftpPacketTypes.py   | 494 -
 tester/rt/tftpy/TftpServer.py| 271 
 tester/rt/tftpy/TftpShared.py|  52 ---
 tester/rt/tftpy/TftpStates.py| 611 --
 tester/rt/tftpy/__init__.py  |  27 --
 tester/rtems-tftp-server |  46 ++
 13 files changed, 685 insertions(+), 2191 deletions(-)
 create mode 100644 tester/rt/tftpserver.py
 delete mode 100644 tester/rt/tftpy/COPYING
 delete mode 100644 tester/rt/tftpy/README
 delete mode 100644 tester/rt/tftpy/TftpClient.py
 delete mode 100644 tester/rt/tftpy/TftpContexts.py
 delete mode 100644 tester/rt/tftpy/TftpPacketFactory.py
 delete mode 100644 tester/rt/tftpy/TftpPacketTypes.py
 delete mode 100644 tester/rt/tftpy/TftpServer.py
 delete mode 100644 tester/rt/tftpy/TftpShared.py
 delete mode 100644 tester/rt/tftpy/TftpStates.py
 delete mode 100644 tester/rt/tftpy/__init__.py
 create mode 100755 tester/rtems-tftp-server

diff --git a/tester/rt/tftp.py b/tester/rt/tftp.py
index d518036..46a1d11 100644
--- a/tester/rt/tftp.py
+++ b/tester/rt/tftp.py
@@ -43,7 +43,7 @@ import sys
 from rtemstoolkit import error
 from rtemstoolkit import reraise
 
-import tftpy
+import tftpserver
 
 class tftp(object):
 '''RTEMS Testing TFTP base.'''
@@ -88,7 +88,7 @@ class tftp(object):
 def _stop(self):
 try:
 if self.server:
-self.server.stop(now = True)
+self.server.stop()
 except:
 pass
 
@@ -101,6 +101,10 @@ class tftp(object):
 
 def _timeout(self):
 self._stop()
+while self.running or not self.finished:
+self._unlock('_timeout')
+time.sleep(0.1)
+self._lock('_timeout')
 if self.timeout is not None:
 self.timeout()
 
@@ -119,22 +123,21 @@ class tftp(object):
 return None
 
 def _listener(self):
-tftpy_log = logging.getLogger('tftpy')
-tftpy_log.setLevel(100)
+self._lock('_listener')
+exe = self.exe
+self.exe = None
+self._unlock('_listener')
+self.server = tftpserver.tftp_server(host = 'all',
+ port = self.port,
+ timeout = 1,
+ forced_file = exe,
+ sessions = 1)
 try:
-self.server = tftpy.TftpServer(tftproot = '.',
-   dyn_file_func = self._exe_handle)
-except tftpy.TftpException as te:
-raise error.general('tftp: %s' % (str(te)))
-if self.server is not None:
-try:
-self.server.listen('0.0.0.0', self.port, 0.5)
-except tftpy.TftpException as te:
-raise error.general('tftp: %s' % (str(te)))
-except IOError as ie:
-if ie.errno == errno.EACCES:
-raise error.general('tftp: permissions error: check tftp 
server port')
-raise error.general('tftp: io error: %s' % (str(ie)))
+self.server.start()
+self.server.run()
+except:
+self.server.stop()
+raise
 
 def _runner(self):
 self._lock('_runner')
diff --git a/tester/rt/tftpserver.py b/tester/rt/tftpserver.py
new file mode 100644
index 000..b307bd2
--- /dev/null
+++ b/tester/rt/tftpserver.py
@@ -0,0 +1,619 @@
+#
+# Copyright 2020 Chris Johns (chris@contemporary.software)
+# All rights reserved.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+#
+# The TFTP Server handles a read only TFTP session.
+#
+
+from __future__ import print_function
+
+import argparse
+import os
+import socket
+import sys
+import 

[PATCH] sb: Fix the imports on Python2

2020-08-26 Thread chrisj
From: Chris Johns 

Closes #4037
---
 source-builder/sb-check |  2 --
 source-builder/sb/__init__.py   | 20 
 source-builder/sb/build.py  |  3 +--
 source-builder/sb/config.py |  3 +--
 source-builder/sb/getsources.py |  3 +--
 source-builder/sb/linux.py  |  2 +-
 source-builder/sb/reports.py|  9 +++--
 source-builder/sb/setbuilder.py |  3 +--
 source-builder/sb/shell.py  |  3 +--
 source-builder/sb/simhost.py|  3 +--
 source-builder/sb/track.py  |  3 +--
 11 files changed, 31 insertions(+), 23 deletions(-)
 create mode 100644 source-builder/sb/__init__.py

diff --git a/source-builder/sb-check b/source-builder/sb-check
index b75767e..8c60bf6 100755
--- a/source-builder/sb-check
+++ b/source-builder/sb-check
@@ -20,8 +20,6 @@
 
 from __future__ import print_function
 
-import sb.check
-
 try:
 import sb.check
 sb.check.run()
diff --git a/source-builder/sb/__init__.py b/source-builder/sb/__init__.py
new file mode 100644
index 000..c4275e2
--- /dev/null
+++ b/source-builder/sb/__init__.py
@@ -0,0 +1,20 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2020 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Permission to use, copy, modify, and/or distribute this software for any
+# purpose with or without fee is hereby granted, provided that the above
+# copyright notice and this permission notice appear in all copies.
+#
+# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+from __future__ import print_function
diff --git a/source-builder/sb/build.py b/source-builder/sb/build.py
index f3253dd..16a495b 100644
--- a/source-builder/sb/build.py
+++ b/source-builder/sb/build.py
@@ -48,8 +48,7 @@ except KeyboardInterrupt:
 print('abort: user terminated')
 sys.exit(1)
 except:
-print('error: unknown application load error')
-sys.exit(1)
+raise
 
 def humanize_number(num, suffix):
 for unit in ['','K','M','G','T','P','E','Z']:
diff --git a/source-builder/sb/config.py b/source-builder/sb/config.py
index db795b3..cd0bf94 100644
--- a/source-builder/sb/config.py
+++ b/source-builder/sb/config.py
@@ -45,8 +45,7 @@ except KeyboardInterrupt:
 print('user terminated', file = sys.stderr)
 sys.exit(1)
 except:
-print('error: unknown application load error', file = sys.stderr)
-sys.exit(1)
+raise
 
 def _check_bool(value):
 istrue = None
diff --git a/source-builder/sb/getsources.py b/source-builder/sb/getsources.py
index 0ccf257..d348da4 100644
--- a/source-builder/sb/getsources.py
+++ b/source-builder/sb/getsources.py
@@ -40,8 +40,7 @@ except KeyboardInterrupt:
 print('abort: user terminated', file = sys.stderr)
 sys.exit(1)
 except:
-print('error: unknown application load error', file = sys.stderr)
-sys.exit(1)
+raise
 
 def run(args = sys.argv):
 ec = 0
diff --git a/source-builder/sb/linux.py b/source-builder/sb/linux.py
index d773818..d89377b 100644
--- a/source-builder/sb/linux.py
+++ b/source-builder/sb/linux.py
@@ -23,10 +23,10 @@
 #
 
 import multiprocessing
+import platform
 import pprint
 import os
 
-from . import platform
 from . import path
 
 def load():
diff --git a/source-builder/sb/reports.py b/source-builder/sb/reports.py
index 34474f3..a20b29e 100644
--- a/source-builder/sb/reports.py
+++ b/source-builder/sb/reports.py
@@ -30,9 +30,6 @@ import datetime
 import os
 import sys
 
-import pprint
-pp = pprint.PrettyPrinter(indent = 2)
-
 try:
 from . import build
 from . import check
@@ -42,15 +39,13 @@ try:
 from . import log
 from . import options
 from . import path
-from . import setbuilder
 from . import sources
 from . import version
 except KeyboardInterrupt:
 print('user terminated', file = sys.stderr)
 sys.exit(1)
 except:
-print('error: unknown application load error', file = sys.stderr)
-sys.exit(1)
+raise
 
 _line_len = 78
 
@@ -865,6 +860,7 @@ class report:
 raise error.general('writing output file: %s: %s' % (name, 
err))
 
 def generate(self, name, tree = None, opts = None, macros = None):
+from . import setbuilder
 self.buildset_start(name)
 if tree is None:
 tree = self.tree
@@ -899,6 +895,7 @@ class report:
 
 def run(args):
 try:
+from . import setbuilder
 optargs = { '--list-bsets':   'List available build sets',
 '--list-configs': 'List available configurations',
  

[PATCH v2] tester: Change to a simpler TFTP server

2020-08-30 Thread chrisj


Hello,

The v2 patch has changed the template to a slightly modified version of the
one in the enginneering manual. The code has been yapf and pylint checked.

Chris

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


[PATCH] eng: Update the python template, add a shell template

2020-08-31 Thread chrisj
From: Chris Johns 

---
 eng/coding-file-hdr.rst | 62 ++---
 1 file changed, 58 insertions(+), 4 deletions(-)

diff --git a/eng/coding-file-hdr.rst b/eng/coding-file-hdr.rst
index cda631a..dafe82c 100644
--- a/eng/coding-file-hdr.rst
+++ b/eng/coding-file-hdr.rst
@@ -92,7 +92,7 @@ Use the following guidelines and template for C and C++ 
header files (here
 * Separate the Doxygen comment block from the copyright and license, so that
   the copyright and license information is not included in the Doxygen output.
 
-* For C++ header files discard the extern "C".
+* For C++ header files discard the ``extern "C"`` start and end sections.
 
 .. code-block:: c
 
@@ -138,12 +138,14 @@ Use the following guidelines and template for C and C++ 
header files (here
 
 #include 
 
+/* Remove for C++ code */
 #ifdef __cplusplus
 extern "C" {
 #endif
 
 /* Declarations, defines, macros, inline functions, etc. */
 
+/* Remove for C++ code */
 #ifdef __cplusplus
 }
 #endif
@@ -207,13 +209,65 @@ and  placeholders see 
:ref:`FileHeaderCopyright`.
 Python File Template
 
 
-Use the following template for Python source files and other files which accept
-a ``#``-style comment block.  For the , , and
- placeholders see :ref:`FileHeaderCopyright`.
+Use the following template for Python source files. For the ,
+, and  placeholders see
+:ref:`FileHeaderCopyright`.
+
+The ``File documentation block`` is a Python docstring module documentation
+block.
+
+.. code-block:: python
+
+# SPDX-License-Identifier: BSD-2-Clause
+'''File documentation block'''
+
+# Copyright (C) ,  
+#
+# 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.
+
+If the python source file is a command line command add the following as the
+first line of the file:
 
 .. code-block:: python
 
 #!/usr/bin/env python
+
+A command line python module does not need to have the ``.py`` file extension.
+
+Only specify ``python`` as the command to ``env``. A system that does not
+provide the ``python`` command can install a virtual python environment or the
+user can prepend the specific Python versioned command to the python script on
+the command line when invoking the command.
+
+Shell Scripts
+-
+
+Use the following template for shell script source files and other files which
+accept a ``#``-style comment block. For the , , and
+ placeholders see :ref:`FileHeaderCopyright`.
+
+.. code-block:: python
+
+# /bin/sh
 # SPDX-License-Identifier: BSD-2-Clause
 
 # File documentation block
-- 
2.24.1

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


  1   2   3   4   5   6   7   >