[rtems-tools PATCH 2/2] test, rtemstoolkit: Fix regx escape errors on python 3.12

2024-04-18 Thread chrisj
From: Chris Johns 

---
 tester/rt/pygdb/spark.py | 2 +-
 tester/rt/test.py| 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tester/rt/pygdb/spark.py b/tester/rt/pygdb/spark.py
index 0eac365..b669998 100644
--- a/tester/rt/pygdb/spark.py
+++ b/tester/rt/pygdb/spark.py
@@ -119,7 +119,7 @@ class GenericParser:
self.augment(start)
self.ruleschanged = 1
 
-   _NULLABLE = '\e_'
+   _NULLABLE = r'\e_'
_START = 'START'
_BOF = '|-'
 
diff --git a/tester/rt/test.py b/tester/rt/test.py
index db5939b..9108206 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -71,7 +71,7 @@ class log_capture(object):
 def get(self):
 s = []
 status = []
-status_regx = re.compile('^\[\s*\d+/\s*\d+\] p:.+')
+status_regx = re.compile(r'^\[\s*\d+/\s*\d+\] p:.+')
 for l in self.log:
 if status_regx.match(l):
 status += [l]
@@ -175,7 +175,7 @@ def find_executables(paths, glob):
 for f in files:
 if fnmatch.fnmatch(f.lower(), glob):
 executables += [path.join(root, f)]
-norun = re.compile('.*\.norun.*')
+norun = re.compile(r'.*\.norun.*')
 executables = [e for e in executables if not norun.match(e)]
 return sorted(executables)
 
-- 
2.39.3 (Apple Git-146)

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


[rtems-tools PATCH 1/2] rtemstoolkit: Fix decoding unicode strings in output

2024-04-18 Thread chrisj
From: Chris Johns 

---
 rtemstoolkit/execute.py | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index 31d3a8a..c7d8134 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -37,6 +37,7 @@
 from __future__ import print_function
 
 import functools
+import codecs
 import io
 import os
 import re
@@ -203,6 +204,10 @@ class execute(object):
 stacktraces.trace()
 if trace_threads:
 print('execute:_readthread: start')
+if sys.stdout.encoding is not None:
+decoder = codecs.getincrementaldecoder(sys.stdout.encoding)()
+else:
+decoder = None
 count = 0
 line = ''
 try:
@@ -222,8 +227,8 @@ class execute(object):
 _output_line(line + '\n', exe, prefix, out, count)
 break
 # str and bytes are the same type in Python2
-if type(data) is not str and type(data) is bytes:
-data = data.decode(sys.stdout.encoding)
+if decoder is not None and type(data) is not str and 
type(data) is bytes:
+data = decoder.decode(data)
 last_ch = data[-1]
 sd = (line + data).split('\n')
 if last_ch != '\n':
@@ -382,6 +387,9 @@ class execute(object):
 if self.verbose:
 log.output(what + ': ' + cs)
 log.trace('exe: %s' % (cs))
+if shell and self.shell_exe:
+command = arg_list(command)
+command[:0] = self.shell_exe
 if not stdin and self.input:
 stdin = subprocess.PIPE
 if not stdout:
-- 
2.39.3 (Apple Git-146)

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


[RSB PATCH] 6/rtems-gcc: Revert to the gcc-13 release branch for MacOS fixes

2024-04-13 Thread chrisj
From: Chris Johns 

Change back to gcc-13 branch and a git version as gcc-13.2 does
not build on MacOS 14.4. The fixes are on the gcc-13 release branch.
---
 rtems/config/6/rtems-default.bset   | 2 +-
 rtems/config/tools/rtems-gcc-13-newlib-head.cfg | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/rtems/config/6/rtems-default.bset 
b/rtems/config/6/rtems-default.bset
index 2d7a223..2d51c50 100644
--- a/rtems/config/6/rtems-default.bset
+++ b/rtems/config/6/rtems-default.bset
@@ -14,7 +14,7 @@
 %defineifnot with_rtems_gmp  devel/gmp-6.3.0
 %defineifnot with_rtems_gdb  tools/rtems-gdb-13.2
 %defineifnot with_rtems_binutils tools/rtems-binutils-2.41
-%defineifnot with_rtems_gcc  tools/rtems-gcc-13.2-newlib-head
+%defineifnot with_rtems_gcc  tools/rtems-gcc-13-newlib-head
 %defineifnot with_rtems_toolstools/rtems-tools-6
 
 tools/rtems-default-tools.bset
diff --git a/rtems/config/tools/rtems-gcc-13-newlib-head.cfg 
b/rtems/config/tools/rtems-gcc-13-newlib-head.cfg
index c73d5a6..4dbbd9b 100644
--- a/rtems/config/tools/rtems-gcc-13-newlib-head.cfg
+++ b/rtems/config/tools/rtems-gcc-13-newlib-head.cfg
@@ -1,12 +1,12 @@
 %include %{_configdir}/checks.cfg
 %include %{_configdir}/base.cfg
 
-%define gcc_version 8c04837
+%define gcc_version 54a235e
 %define gcc_external 1
 %define gcc_expand_name gnu-mirror-gcc-%{gcc_version}
 %source set gcc --rsb-file=%{gcc_expand_name}.tar.gz 
https://codeload.github.com/RTEMS/gnu-mirror-gcc/tar.gz/%{gcc_version}
 %hash sha512 %{gcc_expand_name}.tar.gz \
-  
YSkX/JY61N+I4CPkJInUNGzwhb+uv+YNs9qcTxxJhg/HpGD5vI9duEPNw++F3y8J4re87DPJGIzV5DsFUBCJnA==
+  
UAXjyfPP883wjLDnobDk4wmg/vAO0I4LjzzurLCKejj0FUSk0KvlkVj1CF+3XwFcdlCWRhN7z/Ls4fOunafe9w==
 
 %define newlib_version 176b19f
 %define newlib_external 1
@@ -19,4 +19,4 @@
 %define with_plugin 0
 %define with_iconv 1
 
-%include %{_configdir}/gcc-12.cfg
+%include %{_configdir}/gcc-13.cfg
-- 
2.39.3 (Apple Git-146)

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


[RSB PATCH v3] sb: Add sb-rtems-pkg to update the RTEMS package hashes and checksums

2024-04-03 Thread chrisj
From: Chris Johns 

---
 source-builder/sb-rtems-pkg   |  29 
 source-builder/sb/download.py |   5 +-
 source-builder/sb/git.py  |  12 ++
 source-builder/sb/rtemspkg.py | 287 ++
 4 files changed, 332 insertions(+), 1 deletion(-)
 create mode 100755 source-builder/sb-rtems-pkg
 create mode 100644 source-builder/sb/rtemspkg.py

diff --git a/source-builder/sb-rtems-pkg b/source-builder/sb-rtems-pkg
new file mode 100755
index 000..99ed26c
--- /dev/null
+++ b/source-builder/sb-rtems-pkg
@@ -0,0 +1,29 @@
+#! /usr/bin/env python
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2024 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
+
+try:
+import sb.rtemspkg
+sb.rtemspkg.run()
+except ImportError:
+import sys
+print("Incorrect Source Builder installation", file = sys.stderr)
+sys.exit(1)
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 6e6f9f2..0201675 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -85,6 +85,8 @@ def _hash_check(file_, absfile, macros, remove = True):
 hash = hash.split()
 if len(hash) != 2:
 raise error.internal('invalid hash format: %s' % (file_))
+if hash[0] == 'NO-HASH':
+return not failed
 try:
 hashlib_algorithms = hashlib.algorithms
 except:
@@ -479,7 +481,8 @@ def _git_downloader(url, local, config, opts):
 else:
 repo.clean(['-f', '-d'])
 repo.reset('--hard')
-repo.checkout('master')
+default_branch = repo.default_branch()
+repo.checkout(default_branch)
 for a in us[1:]:
 _as = a.split('=')
 if _as[0] == 'branch' or _as[0] == 'checkout':
diff --git a/source-builder/sb/git.py b/source-builder/sb/git.py
index 237e690..0aa4da9 100644
--- a/source-builder/sb/git.py
+++ b/source-builder/sb/git.py
@@ -226,6 +226,18 @@ class repo:
 hash = l1[len('commit '):]
 return hash
 
+def default_branch(self):
+ec, output = self._run(['remote', 'show'])
+if ec == 0:
+origin = output.split('\n')[0]
+ec, output = self._run(['remote', 'show', origin])
+if ec == 0:
+for l in output.split('\n'):
+l = l.strip()
+if l.startswith('HEAD branch: '):
+return l[len('HEAD branch: '):]
+return None
+
 if __name__ == '__main__':
 import os.path
 import sys
diff --git a/source-builder/sb/rtemspkg.py b/source-builder/sb/rtemspkg.py
new file mode 100644
index 000..492eb59
--- /dev/null
+++ b/source-builder/sb/rtemspkg.py
@@ -0,0 +1,287 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2024 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.
+
+#
+# This code builds a package compiler tool suite given a tool set. A tool
+# set lists the various tools. These are specific tool configurations.
+#
+
+from __future__ import print_function
+
+import argparse
+import base64
+import copy
+import datetime
+import hashlib
+import os
+import sys
+
+try:
+from . import build
+from . import download
+from . import error
+from . import git
+from . import log
+from . import path
+from . import simhost
+from . import 

v3 sb-rtems-pkg

2024-04-03 Thread chrisj
Hi

I notice after sending v2 I had not implemented the options. These are 
now done in v3.

Chris

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


[RSB PATCH v2] sb: Add sb-rtems-pkg to update the RTEMS package hashes and checksums

2024-04-03 Thread chrisj
From: Chris Johns 

---
 source-builder/sb-rtems-pkg   |  29 
 source-builder/sb/download.py |   5 +-
 source-builder/sb/git.py  |  12 ++
 source-builder/sb/rtemspkg.py | 290 ++
 4 files changed, 335 insertions(+), 1 deletion(-)
 create mode 100755 source-builder/sb-rtems-pkg
 create mode 100644 source-builder/sb/rtemspkg.py

diff --git a/source-builder/sb-rtems-pkg b/source-builder/sb-rtems-pkg
new file mode 100755
index 000..99ed26c
--- /dev/null
+++ b/source-builder/sb-rtems-pkg
@@ -0,0 +1,29 @@
+#! /usr/bin/env python
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2024 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
+
+try:
+import sb.rtemspkg
+sb.rtemspkg.run()
+except ImportError:
+import sys
+print("Incorrect Source Builder installation", file = sys.stderr)
+sys.exit(1)
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 6e6f9f2..0201675 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -85,6 +85,8 @@ def _hash_check(file_, absfile, macros, remove = True):
 hash = hash.split()
 if len(hash) != 2:
 raise error.internal('invalid hash format: %s' % (file_))
+if hash[0] == 'NO-HASH':
+return not failed
 try:
 hashlib_algorithms = hashlib.algorithms
 except:
@@ -479,7 +481,8 @@ def _git_downloader(url, local, config, opts):
 else:
 repo.clean(['-f', '-d'])
 repo.reset('--hard')
-repo.checkout('master')
+default_branch = repo.default_branch()
+repo.checkout(default_branch)
 for a in us[1:]:
 _as = a.split('=')
 if _as[0] == 'branch' or _as[0] == 'checkout':
diff --git a/source-builder/sb/git.py b/source-builder/sb/git.py
index 237e690..0aa4da9 100644
--- a/source-builder/sb/git.py
+++ b/source-builder/sb/git.py
@@ -226,6 +226,18 @@ class repo:
 hash = l1[len('commit '):]
 return hash
 
+def default_branch(self):
+ec, output = self._run(['remote', 'show'])
+if ec == 0:
+origin = output.split('\n')[0]
+ec, output = self._run(['remote', 'show', origin])
+if ec == 0:
+for l in output.split('\n'):
+l = l.strip()
+if l.startswith('HEAD branch: '):
+return l[len('HEAD branch: '):]
+return None
+
 if __name__ == '__main__':
 import os.path
 import sys
diff --git a/source-builder/sb/rtemspkg.py b/source-builder/sb/rtemspkg.py
new file mode 100644
index 000..52d1f3d
--- /dev/null
+++ b/source-builder/sb/rtemspkg.py
@@ -0,0 +1,290 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2024 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.
+
+#
+# This code builds a package compiler tool suite given a tool set. A tool
+# set lists the various tools. These are specific tool configurations.
+#
+
+from __future__ import print_function
+
+import argparse
+import base64
+import copy
+import datetime
+import hashlib
+import os
+import sys
+
+try:
+from . import build
+from . import download
+from . import error
+from . import git
+from . import log
+from . import path
+from . import simhost
+from . import 

[RSB PATCH] sb: Add sb-rtems-pkg to update the RTEMS package hashes and checksums

2024-04-02 Thread chrisj
From: Chris Johns 

---
 source-builder/sb-rtems-pkg   |  29 
 source-builder/sb/download.py |   5 +-
 source-builder/sb/git.py  |  12 ++
 source-builder/sb/rtemspkg.py | 279 ++
 4 files changed, 324 insertions(+), 1 deletion(-)
 create mode 100755 source-builder/sb-rtems-pkg
 create mode 100644 source-builder/sb/rtemspkg.py

diff --git a/source-builder/sb-rtems-pkg b/source-builder/sb-rtems-pkg
new file mode 100755
index 000..99ed26c
--- /dev/null
+++ b/source-builder/sb-rtems-pkg
@@ -0,0 +1,29 @@
+#! /usr/bin/env python
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2024 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
+
+try:
+import sb.rtemspkg
+sb.rtemspkg.run()
+except ImportError:
+import sys
+print("Incorrect Source Builder installation", file = sys.stderr)
+sys.exit(1)
diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 6e6f9f2..0201675 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -85,6 +85,8 @@ def _hash_check(file_, absfile, macros, remove = True):
 hash = hash.split()
 if len(hash) != 2:
 raise error.internal('invalid hash format: %s' % (file_))
+if hash[0] == 'NO-HASH':
+return not failed
 try:
 hashlib_algorithms = hashlib.algorithms
 except:
@@ -479,7 +481,8 @@ def _git_downloader(url, local, config, opts):
 else:
 repo.clean(['-f', '-d'])
 repo.reset('--hard')
-repo.checkout('master')
+default_branch = repo.default_branch()
+repo.checkout(default_branch)
 for a in us[1:]:
 _as = a.split('=')
 if _as[0] == 'branch' or _as[0] == 'checkout':
diff --git a/source-builder/sb/git.py b/source-builder/sb/git.py
index 237e690..0aa4da9 100644
--- a/source-builder/sb/git.py
+++ b/source-builder/sb/git.py
@@ -226,6 +226,18 @@ class repo:
 hash = l1[len('commit '):]
 return hash
 
+def default_branch(self):
+ec, output = self._run(['remote', 'show'])
+if ec == 0:
+origin = output.split('\n')[0]
+ec, output = self._run(['remote', 'show', origin])
+if ec == 0:
+for l in output.split('\n'):
+l = l.strip()
+if l.startswith('HEAD branch: '):
+return l[len('HEAD branch: '):]
+return None
+
 if __name__ == '__main__':
 import os.path
 import sys
diff --git a/source-builder/sb/rtemspkg.py b/source-builder/sb/rtemspkg.py
new file mode 100644
index 000..0b43d23
--- /dev/null
+++ b/source-builder/sb/rtemspkg.py
@@ -0,0 +1,279 @@
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2024 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.
+
+#
+# This code builds a package compiler tool suite given a tool set. A tool
+# set lists the various tools. These are specific tool configurations.
+#
+
+from __future__ import print_function
+
+import argparse
+import base64
+import copy
+import datetime
+import hashlib
+import os
+import sys
+
+try:
+from . import build
+from . import download
+from . import error
+from . import git
+from . import log
+from . import path
+from . import simhost
+from . import 

[RSB PATCH] rtems: Update RTEMS packages to their HEAD

2024-04-02 Thread chrisj
From: Chris Johns 

---
 rtems/config/tools/rtems-kernel-6.cfg | 4 ++--
 rtems/config/tools/rtems-libbsd-6.cfg | 4 ++--
 rtems/config/tools/rtems-tools-6.cfg  | 6 +++---
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index 1e90184..9219263 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 6
 #
 
-%define rtems_kernel_version e7cb79c39d8dbc02ded1d6d9c37ee00323508bf3
+%define rtems_kernel_version 1ef5fa07aa87adc9925c75060a7888f110104fa7
 
 %hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-   
ZLKEYfCw1B7bzEMixtVB8Ire77RqdidztgGj6bX9LL/fYqfG74UNkyLl9uMK4mGKML3xOszXKn+lURAhyfDhDg==
+  
5WE5sLbkU9p3atZ9PV6Dcy1TGKXZKErJ+kEfe9j6IyXohS3vc76hFIrVt8I8beDDKEogNB8HAuVsZklPv3YViA==
 #
 # The RTEMS build instructions.
 #
diff --git a/rtems/config/tools/rtems-libbsd-6.cfg 
b/rtems/config/tools/rtems-libbsd-6.cfg
index 3dfc693..c71ba07 100644
--- a/rtems/config/tools/rtems-libbsd-6.cfg
+++ b/rtems/config/tools/rtems-libbsd-6.cfg
@@ -3,9 +3,9 @@
 #
 
 #  branch: 6-freebsd-12
-%define rtems_libbsd_version 1524f95e93a0e0ff85d676d214e0e57cac44e4f5
+%define rtems_libbsd_version 388d46bb1b3080402c68ae11d14b2b36c3138952
 %hash sha512 rtems-libbsd-%{rtems_libbsd_version}.tar.bz2 \
-  
QiNVx1kFPcX9tmkY2mdWO2gb/t32J+AJkXOBAkyjfsaUuvBz43oMeOrpBFJuuix6eTmmukSzAulUCLdqBJlAWQ==
+  
zMyTB+Z7vJXpywhCbRCK/vz2KUbwdg1JwoQ/JPqFbicmo/W42D/fGjKFxhPrzg0mL4silqSJ4xPdfOhET5vrtw==
 %define rtems_waf_version ad08908c452c6a9bbb3bf7bbbcc9fc03fe46cc7f
 %hash sha512 rtems_waf-%{rtems_waf_version}.tar.bz2 \
   
EyuEit0DsAR1gK9Ki1sjl416PFgFe7dcggH3H/hmdAPmMjEIIdX7TVOTDgOIK1Pt0DW6lZ9NcW7O87GZFyy8hg==
diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index 8abfeea..9a1c625 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version 12971a8
+%define rtems_tools_version 12971a8b858add612833a43360e7a7ba95902d3e
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
-%hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-  
SrjY0gweRgWHmqBYj0wFnu1LFkaeNeS05SD1dKVzz2kvs3UCZ6AM8DrLbVe0q4H14DZwmrE3mMgbutsVev0Oxg==
+%hash sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
+  
SpaYAsHhzHncHC0tlQOJwexUJ7i+l5yG1Vf8Twl61dAyOEYhkugjvRCtchN4GJQmzPrqjqFIdwciemveysouJA==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.42.0

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


[rtems-docs PATCH] user: Automatic version number fixes

2023-12-18 Thread chrisj
From: Chris Johns 

Updates #4695
---
 user/exe/initialization.rst|  3 +--
 user/tracing/captureengine.rst | 20 ++--
 user/tracing/examples.rst  | 12 ++--
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/user/exe/initialization.rst b/user/exe/initialization.rst
index f4b5d7e..116 100644
--- a/user/exe/initialization.rst
+++ b/user/exe/initialization.rst
@@ -83,13 +83,12 @@ initialization is performed before multitasking is started.
 
 The RTEMS Tool ``rtems-exeinfo`` can provide some detail about the registered
 handlers. The following shows the initialization handlers for the Hello World
-sample application in the RTEMS kernel's testsuite::
+sample application in the RTEMS kernel's testsuite:
 
 .. code-block:: none
 
  $ rtems-exeinfo --init 
arm-rtems@rtems-ver-major@/c/xilinx_zynq_zedboard/testsuites/samples/hello.exe
  RTEMS Executable Info @rtems-ver-major@.5416cfa39dd6
- $ rtems-exeinfo --init 
arm-rtems@rtems-ver-major@/c/xilinx_zynq_zedboard/testsuites/samples/hello.exe
  exe: 
arm-rtems@rtems-ver-major@/c/xilinx_zynq_zedboard/testsuites/samples/hello.exe
 
  Compilation:
diff --git a/user/tracing/captureengine.rst b/user/tracing/captureengine.rst
index a8bca53..137c555 100644
--- a/user/tracing/captureengine.rst
+++ b/user/tracing/captureengine.rst
@@ -14,22 +14,22 @@ runtime and does not require RTEMS or your application to 
be rebuilt in order
 to use it.
 
 The Capture Engine's sample testcase for the `sparc/erc32` is available in
-build directory created when building RTEMS in the path
-file: `sparc-rtems5/c/erc32/testsuites/samples`. In order to access the capture
-testcase perform the following set of operations inside the RTEMS build
-directory.
+build directory created when building RTEMS in the path file:
+`sparc-rtems@rtems-ver-major@/c/erc32/testsuites/samples`. In order to access
+the capture testcase perform the following set of operations inside the RTEMS
+build directory.
 
 .. code-block:: none
 
-  $ cd /sparc-rtems5/c/erc32/testsuites/samples
-  $ sparc-rtems5-run ./capture.exe
+  $ cd /sparc-rtems@rtems-ver-major@/c/erc32/testsuites/samples
+  $ sparc-rtems@rtems-ver-major@-run ./capture.exe
 
 
   *** BEGIN OF TEST CAPTURE ENGINE ***
-  *** TEST VERSION: 5.0.0.de9b7d712bf5da6593386fd4fbca0d5f8b8431d8
+  *** TEST VERSION: 
@rtems-ver-major@.@rtems-ver-minor@.0.de9b7d712bf5da6593386fd4fbca0d5f8b8431d8
   *** TEST STATE: USER_INPUT
   *** TEST BUILD: RTEMS_NETWORKING RTEMS_POSIX_API
-  *** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 
a3a6c34c150a357e57769a26a460c475e188438f, Newlib 3.0.0)
+  *** TEST TOOLS: 7.3.0 20180125 (RTEMS @rtems-ver-major@, RSB 
a3a6c34c150a357e57769a26a460c475e188438f, Newlib 3.0.0)
   Press any key to start capture engine (20s remaining)
   Press any key to start capture engine (19s remaining)
   Press any key to start capture engine (18s remaining)
@@ -101,10 +101,10 @@ number of context switches between tasks we are not 
interested in.
 .. code-block:: none
 
   *** BEGIN OF TEST CAPTURE ENGINE ***
-  *** TEST VERSION: 5.0.0.de9b7d712bf5da6593386fd4fbca0d5f8b8431d8
+  *** TEST VERSION: 
@rtems-ver-major@.@rtems-ver-minor@.0.de9b7d712bf5da6593386fd4fbca0d5f8b8431d8
   *** TEST STATE: USER_INPUT
   *** TEST BUILD: RTEMS_NETWORKING RTEMS_POSIX_API
-  *** TEST TOOLS: 7.3.0 20180125 (RTEMS 5, RSB 
a3a6c34c150a357e57769a26a460c475e188438f, Newlib 3.0.0)
+  *** TEST TOOLS: 7.3.0 20180125 (RTEMS @rtems-ver-major@, RSB 
a3a6c34c150a357e57769a26a460c475e188438f, Newlib 3.0.0)
   Press any key to start capture engine (20s remaining)
   Press any key to start capture engine (19s remaining)
   Press any key to start capture engine (18s remaining)
diff --git a/user/tracing/examples.rst b/user/tracing/examples.rst
index 2b673d4..ed0c722 100644
--- a/user/tracing/examples.rst
+++ b/user/tracing/examples.rst
@@ -48,19 +48,19 @@ BSP is configured with the following command -
 
 .. code-block:: none
 
-  ../rtems/configure --target=sparc-rtems5 --prefix=/development/rtems/5 \
+  ../rtems/configure --target=sparc-rtems@rtems-ver-major@ 
--prefix=/development/rtems/5 \
   --enable-networking --enable-tests --enable-rtemsbsp=erc32 --enable-cxx
 
 The next two commands are used to link the fileio executable.The `-B` option
 signifies the use of the complete path to the required directory or file. Write
-the full path instead of the path file: `sparc-rtems5/erc32/lib/` in the
+the full path instead of the path file: 
`sparc-rtems@rtems-ver-major@/erc32/lib/` in the
 following commands according to your installation. Also confirm the path of the
 fileio's executable and object files in the last line of the command according
 to your installation.
 
 .. code-block:: none
 
-  sparc-rtems5-gcc -Bsparc-rtems5/erc32/lib/ \
+  sparc-rtems@rtems-ver-major@-gcc -Bsparc-rtems@rtems-ver-major@/erc32/lib/ \
   -qrtems -mcpu=cypress -O2 -g -ffunction-sections \
   -fdata-sections -Wall -Wmissing-prototypes -Wimplicit-function-declaration 

[rtems-docs PATCH] sphinx/style: Fix building with the latest sphinx

2023-12-18 Thread chrisj
From: Chris Johns 

Tested on sphinx 7.2, 6.1.3 AND 5.3.0

Closes #4980
---
 common/sphinx_rtd_theme_rtems/layout.html | 6 +-
 common/waf.py | 5 ++---
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/common/sphinx_rtd_theme_rtems/layout.html 
b/common/sphinx_rtd_theme_rtems/layout.html
index 0fe6c65..3542bea 100644
--- a/common/sphinx_rtd_theme_rtems/layout.html
+++ b/common/sphinx_rtd_theme_rtems/layout.html
@@ -67,7 +67,11 @@
   {%- endblock %}
 
   {# CSS #}
-  
+  {%- if sphinx_version <= "5.9.0" -%}
+   
+  {%- else %}
+   
+  {%- endif %}
   
   {%- for css in css_files %}
 {%- if css|attr("rel") %}
diff --git a/common/waf.py b/common/waf.py
index 6efe038..79c4057 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -16,11 +16,10 @@ from waflib.Build import BuildContext
 import latex
 import conf
 
-# Sphinx >= 6 are currently broken. 
+# Sphinx >= 6 are currently broken.
 # If you do not want to check for a maximum version, set it to None.
 sphinx_min_version = (1, 3)
-sphinx_max_version = (5, 9)
-#sphinx_max_version = None
+sphinx_max_version = None
 
 def version_cmdline(ctx):
 return '-Drelease="%s" -Dversion="%s" -Drtems_major="%s" ' \
-- 
2.42.0

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


[rtems-release PATCH] Update with RTEMS 6 changes

2023-12-13 Thread chrisj
From: Chris Johns 

---
 rtems-release-4.10-conf |  2 ++
 rtems-release-4.11-conf |  2 ++
 rtems-release-5-conf|  2 ++
 rtems-release-defaults  |  2 ++
 rtems-release-kernel| 13 +++--
 rtems-release-notes |  2 +-
 .../rtems-release-notes-coverpage.html.in   |  2 +-
 rtems-release-package-lists |  4 +++-
 8 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/rtems-release-4.10-conf b/rtems-release-4.10-conf
index 1e29f78..cb71d43 100755
--- a/rtems-release-4.10-conf
+++ b/rtems-release-4.10-conf
@@ -34,6 +34,8 @@
 #
 rtems_waf=no
 rtems_libbsd=no
+rtems_net_legacy=no
+rtems_net_services=no
 rtems_docs=no
 rtems_release_notes=no
 rtems_readme_release_notes=
diff --git a/rtems-release-4.11-conf b/rtems-release-4.11-conf
index 9fe957a..aceebc8 100755
--- a/rtems-release-4.11-conf
+++ b/rtems-release-4.11-conf
@@ -33,3 +33,5 @@
 # The script is the overridded configuration for 4.11.
 #
 rtems_waf=no
+rtems_net_legacy=no
+rtems_net_services=no
diff --git a/rtems-release-5-conf b/rtems-release-5-conf
index c42ad55..6da7d27 100755
--- a/rtems-release-5-conf
+++ b/rtems-release-5-conf
@@ -33,3 +33,5 @@
 # The script is the overridded configuration for 5.
 #
 rtems_waf=no
+rtems_net_legacy=no
+rtems_net_services=no
diff --git a/rtems-release-defaults b/rtems-release-defaults
index b558a45..4b6abba 100755
--- a/rtems-release-defaults
+++ b/rtems-release-defaults
@@ -72,6 +72,8 @@ comp_tar=J
 rtems_waf=yes
 rtems_examples=yes
 rtems_libbsd=yes
+rtems_net_legacy=yes
+rtems_net_services=yes
 rtems_docs=yes
 rtems_docs_required=yes
 rtems_docs_build=sphinx
diff --git a/rtems-release-kernel b/rtems-release-kernel
index 09c7ac2..e25129c 100755
--- a/rtems-release-kernel
+++ b/rtems-release-kernel
@@ -106,16 +106,9 @@ cd ${prefix}
   # Waf build system. Update RTEMS version and collect the BSPs
   #
   echo "] RTEMS Build System: waf"
-  f="spec/build/cpukit/optvermaj.yml"
-  echo "] Update ${f}"
-  sed -i "s/- get-string-command-line:.*/- get-string-command-line: 
'${version}'/" ${f}
-  f="spec/build/cpukit/optvermin.yml"
-  echo "] Update ${f}"
-  minor=$(echo ${revision} | sed 's/-.*//')
-  sed -i "s/- set-value:.*/- set-value: '${minor}'/" ${f}
-  f="spec/build/cpukit/optverrev.yml"
-  echo "] Update ${f}"
-  sed -i "s/- set-value:.*/- set-value: '0'/" ${f}
+  f="VERSION"
+  echo "] Creating ${f}: ${release}"
+  echo "RTEMS_VERSION = ${release}" > ${f}
  else
   #
   # Autoconf build system. Bootstrap RTEMS
diff --git a/rtems-release-notes b/rtems-release-notes
index c1d280d..659a706 100755
--- a/rtems-release-notes
+++ b/rtems-release-notes
@@ -68,7 +68,7 @@ title="RTEMS Release Notes builder"
 #
 ws_pwd=${PWD}
 
-echo "] Creating release notes"
+echo "] Creating release notes for ${release}"
 echo "] Generate release notes markdown"
 
 #
diff --git 
a/rtems-release-notes-coverpage/rtems-release-notes-coverpage.html.in 
b/rtems-release-notes-coverpage/rtems-release-notes-coverpage.html.in
index 422e8bd..4f9350a 100644
--- a/rtems-release-notes-coverpage/rtems-release-notes-coverpage.html.in
+++ b/rtems-release-notes-coverpage/rtems-release-notes-coverpage.html.in
@@ -46,7 +46,7 @@


  
-   Copyright @TEAR@ RTEMS Project
+   Copyright @YEAR@ RTEMS Project
  

  
diff --git a/rtems-release-package-lists b/rtems-release-package-lists
index c73ad60..55bfedb 100755
--- a/rtems-release-package-lists
+++ b/rtems-release-package-lists
@@ -45,7 +45,9 @@ fi
 # RTEMS 6 and later
 #
 if [ ${version} -ge 6 ]; then
-  rtems_packages="${rtems_packages} rtems_waf rtems-net-legacy rtems-lwip"
+  rtems_packages="${rtems_packages} rtems_waf"
+  rtems_packages="${rtems_packages} rtems-net-legacy rtems-lwip"
+  rtems_packages="${rtems_packages} rtems-net-services"
 fi
 
 #
-- 
2.37.1

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


[rtems-tools PATCH] tester/console: Fix restart regx check

2023-12-13 Thread chrisj
From: Chris Johns 

The fix to the TFTP timeout has a simple bug.

Updates #4959
---
 tester/rt/config.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tester/rt/config.py b/tester/rt/config.py
index 139e1fa..2361bc9 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -425,7 +425,7 @@ class file(config.file):
 self.defined('target_reset_on_timeout'):
 reset_target = True
 restart = \
-(self.target_start_regx is not None and self.target_start_regx 
is not None)
+(self.target_start_regx is not None and 
self.target_start_regx.match(text))
 if restart:
 if self.test_started:
 self._capture_console('target start detected')
-- 
2.37.1

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


[PATCH v3] libmisc/shell: Work around tmux bug in row and column

2023-12-12 Thread chrisj
From: Chris Johns 

- Extend the timeout to 150 msec for long remote sessions

- Improve the performance of the detection

Closes #4975
Closes #4977
---
 cpukit/libmisc/shell/shell.c | 150 +--
 1 file changed, 125 insertions(+), 25 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index cd83aa56d1..9cefc80255 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -805,6 +805,109 @@ void rtems_shell_print_env(
 }
 #endif
 
+/*
+ * Wait for the string to return or timeout.
+ */
+static bool rtems_shell_term_wait_for(const int fd, const char* str, const int 
timeout)
+{
+  int msec = timeout;
+  int i = 0;
+  while (msec-- > 0 && str[i] != '\0') {
+char ch[2];
+if (read(fd, &ch[0], 1) == 1) {
+  fflush(stdout);
+  if (ch[0] != str[i++]) {
+return false;
+  }
+  msec = timeout;
+} else {
+  usleep(1000);
+}
+  }
+  if (msec == 0) {
+return false;
+  }
+  return true;
+}
+
+/*
+ * Buffer a string up to the end string
+ */
+static int rtems_shell_term_buffer_until(const int fd,
+ char* buf,
+ const int size,
+ const char* end,
+ const int timeout)
+{
+  int msec = timeout;
+  int i = 0;
+  int e = 0;
+  memset(&buf[0], 0, size);
+  while (msec-- > 0 && i < size && end[e] != '\0') {
+char ch[2];
+if (read(fd, &ch[0], 1) == 1) {
+  fflush(stdout);
+  buf[i++] = ch[0];
+  if (ch[0] == end[e]) {
+e++;
+  } else {
+e = 0;
+  }
+  msec = timeout;
+} else {
+  usleep(1000);
+}
+  }
+  if (msec == 0 || end[e] != '\0') {
+return -1;
+  }
+  i -= e;
+  if (i < size) {
+buf[i] = '\0';
+  }
+  return i;
+}
+
+/*
+ * Determine if the terminal has the row and column values
+ * swapped
+ *
+ * https://github.com/tmux/tmux/issues/3457
+ *
+ * Tmux has a bug where the lines and cols are swapped. There is a lag
+ * in the time it takes to get the fix into code so see if tmux is
+ * running and which version and work around the bug.
+ *
+ * The terminal device needs to have VMIN=0, and VTIME=0
+ */
+static bool rtems_shell_term_row_column_swapped(const int fd, const int 
timeout) {
+  char buf[64];
+  memset(&buf[0], 0, sizeof(buf));
+  /*
+   * CSI > Ps q
+   *Ps = 0   =>   DCS > | text ST
+   */
+  fputs("\033[>0q", stdout);
+  fflush(stdout);
+  if (rtems_shell_term_wait_for(fd, "\033P>|", timeout)) {
+int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), "\033\\", 
timeout);
+if (len > 0) {
+  if (memcmp(buf, "tmux ", 5) == 0) {
+static const char* bad_versions[] = {
+  "3.2", "3.2a", "3.3", "3.3a"
+};
+size_t i;
+for (i = 0; i < RTEMS_ARRAY_SIZE(bad_versions); ++i) {
+  if (strcmp(bad_versions[i], buf + 5) == 0) {
+return true;
+  }
+}
+  }
+}
+  }
+  return false;
+}
+
 /*
  * Direct method to get the size of an XTERM window.
  *
@@ -814,6 +917,7 @@ static void rtems_shell_winsize( void )
 {
   const int fd = fileno(stdin);
   struct winsize ws;
+  const int timeout = 150;
   char buf[64];
   bool ok = false;
   int lines = 0;
@@ -831,9 +935,6 @@ static void rtems_shell_winsize( void )
   term.c_cc[VMIN] = 0;
   term.c_cc[VTIME] = 0;
   if (tcsetattr (fd, TCSADRAIN, &term) >= 0) {
-int msec = 50;
-int len = 0;
-int i = 0;
 memset(&buf[0], 0, sizeof(buf));
 /*
  * 
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Miscellaneous
@@ -842,35 +943,34 @@ static void rtems_shell_winsize( void )
  */
 fputs("\033[18t", stdout);
 fflush(stdout);
-while (msec-- > 0 && len < sizeof(buf)) {
-  char ch[2];
-  if (read(fd, &ch[0], 1) == 1) {
-buf[len++] = ch[0];
-msec = 50;
-  } else {
-usleep(1000);
-  }
-}
-while (i < len) {
-  static const char resp[] = "\033[8;";
-  if (memcmp(resp, &buf[i], sizeof(resp) - 1) == 0) {
-i += sizeof(resp) - 1;
-while (i < len && buf[i] != ';') {
+if (rtems_shell_term_wait_for(fd, "\033[8;", timeout)) {
+  int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), ";", 
timeout);
+  if (len > 0) {
+int i;
+lines = 0;
+i = 0;
+while (i < len) {
   lines *= 10;
   lines += buf[i++] - '0';
 }
-cols = 0;
-++i;
-while (i < len && buf[i] != 't') {
-  cols *= 10;
-  cols += buf[i++] - '0';
+len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), "t", 
timeout);
+if (len > 0) {
+  cols = 0;
+  i = 0;
+ 

[PATCH v2] libmisc/shell: Work around tmux bug in row and column

2023-12-12 Thread chrisj
From: Chris Johns 

- Extend the timeout to 150 msec for long remote sessions

- Improve the performance of the detection

Closes #4975
Closes #4977
---
 cpukit/libmisc/shell/shell.c | 150 +--
 1 file changed, 125 insertions(+), 25 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index cd83aa56d1..d8853d74a4 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -805,6 +805,109 @@ void rtems_shell_print_env(
 }
 #endif
 
+/*
+ * Wait for the string to return or timeout.
+ */
+static bool rtems_shell_term_wait_for(const int fd, const char* str, const int 
timeout)
+{
+  int msec = timeout;
+  int i = 0;
+  while (msec-- > 0 && str[i] != '\0') {
+char ch[2];
+if (read(fd, &ch[0], 1) == 1) {
+  fflush(stdout);
+  if (ch[0] != str[i++]) {
+return false;
+  }
+  msec = timeout;
+} else {
+  usleep(1000);
+}
+  }
+  if (msec == 0) {
+return false;
+  }
+  return true;
+}
+
+/*
+ * Buffer a string up to the end string
+ */
+static int rtems_shell_term_buffer_until(const int fd,
+ char* buf,
+ const int size,
+ const char* end,
+ const int timeout)
+{
+  int msec = timeout;
+  int i = 0;
+  int e = 0;
+  memset(&buf[0], 0, size);
+  while (msec-- > 0 && i < size && end[e] != '\0') {
+char ch[2];
+if (read(fd, &ch[0], 1) == 1) {
+  fflush(stdout);
+  buf[i++] = ch[0];
+  if (ch[0] == end[e]) {
+e++;
+  } else {
+e = 0;
+  }
+  msec = timeout;
+} else {
+  usleep(1000);
+}
+  }
+  if (msec == 0 || end[e] != '\0') {
+return -1;
+  }
+  i -= e;
+  if (i < size) {
+buf[i] = '\0';
+  }
+  return i;
+}
+
+/*
+ * Determine if the terminal has the row and column values
+ * swapped
+ *
+ * https://github.com/tmux/tmux/issues/3457
+ *
+ * Tmux has a bug where the lines and cols are swapped. There is a lag
+ * in the time it takes to get the fix into code so see if tmux is
+ * running and which version and work around the bug.
+ *
+ * The terminal device needs to have VMIN=0, and VTIME=0
+ */
+static bool rtems_shell_term_row_column_swapped(const int fd, const int 
timeout) {
+  char buf[64];
+  memset(&buf[0], 0, sizeof(buf));
+  /*
+   * CSI > Ps q
+   *Ps = 0   =>   DCS > | text ST
+   */
+  fputs("\033[>0q", stdout);
+  fflush(stdout);
+  if (rtems_shell_term_wait_for(fd, "\033P>|", timeout)) {
+int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), "\033\\", 
timeout);
+if (len > 0) {
+  if (memcmp(buf, "tmux ", 5) == 0) {
+static const char* bad_versions[] = {
+  "3.2", "3.2a", "3.3", "3.3a"
+};
+size_t i;
+for (i = 0; i < RTEMS_ARRAY_SIZE(bad_versions); ++i) {
+  if (strcmp(bad_versions[i], buf + 5) == 0) {
+return true;
+  }
+}
+  }
+}
+  }
+  return false;
+}
+
 /*
  * Direct method to get the size of an XTERM window.
  *
@@ -814,6 +917,7 @@ static void rtems_shell_winsize( void )
 {
   const int fd = fileno(stdin);
   struct winsize ws;
+  const int timeout = 150;
   char buf[64];
   bool ok = false;
   int lines = 0;
@@ -831,9 +935,6 @@ static void rtems_shell_winsize( void )
   term.c_cc[VMIN] = 0;
   term.c_cc[VTIME] = 0;
   if (tcsetattr (fd, TCSADRAIN, &term) >= 0) {
-int msec = 50;
-int len = 0;
-int i = 0;
 memset(&buf[0], 0, sizeof(buf));
 /*
  * 
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Miscellaneous
@@ -842,39 +943,38 @@ static void rtems_shell_winsize( void )
  */
 fputs("\033[18t", stdout);
 fflush(stdout);
-while (msec-- > 0 && len < sizeof(buf)) {
-  char ch[2];
-  if (read(fd, &ch[0], 1) == 1) {
-buf[len++] = ch[0];
-msec = 50;
-  } else {
-usleep(1000);
-  }
-}
-while (i < len) {
-  static const char resp[] = "\033[8;";
-  if (memcmp(resp, &buf[i], sizeof(resp) - 1) == 0) {
-i += sizeof(resp) - 1;
-while (i < len && buf[i] != ';') {
+if (rtems_shell_term_wait_for(fd, "\033[8;", timeout)) {
+  int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), ";", 
timeout);
+  if (len > 0) {
+int i;
+lines = 0;
+i = 0;
+while (i < len) {
   lines *= 10;
   lines += buf[i++] - '0';
 }
-cols = 0;
-++i;
-while (i < len && buf[i] != 't') {
-  cols *= 10;
-  cols += buf[i++] - '0';
+len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), "t", 
timeout);
+if (len > 0) {
+  cols = 0;
+  i = 0;
+ 

[RSB PATCH 1/2] print/texinfo: Check the version and build if too old

2023-12-12 Thread chrisj
From: Chris Johns 

Packages like binutils need newer versions than available by
default on MacOS.
---
 bare/config/print/texinfo.cfg | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/bare/config/print/texinfo.cfg b/bare/config/print/texinfo.cfg
index 5fa0cba..63df197 100644
--- a/bare/config/print/texinfo.cfg
+++ b/bare/config/print/texinfo.cfg
@@ -1,8 +1,16 @@
 #
 # GNU makeinfo has a version option, check for it.
-# If not found build it.
+# If not found or not recent build it.
 #
+%define makeinfo_version 7.0.3
 %define has_makeinfo %(makeinfo --version > /dev/null 2>&1; echo $?)
+%if %{has_makeinfo} == 0
+ %define makeinfo_version_resident \
+  %(makeinfo --version | grep -e "^makeinfo (GNU texinfo)" -e 
"^texi2any (GNU texinfo)" | rev | sed -r 's/ .*//' | rev)
+ %if %{makeinfo_version_resident} < %{makeinfo_version}
+  %define has_makeinfo 1
+ %endif
+%endif
 %if %{has_makeinfo} != 0
  %include %{_configdir}/print/texinfo-7.0.3.cfg
 %endif
-- 
2.37.1

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


[RSB PATCH 2/2] bare/or1ksim: Fix invalid hash and fix the version

2023-12-12 Thread chrisj
From: Chris Johns 

---
 bare/config/devel/or1ksim-1.1.0.cfg   | 6 +++---
 source-builder/config/or1ksim-1-1.cfg | 4 +++-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bare/config/devel/or1ksim-1.1.0.cfg 
b/bare/config/devel/or1ksim-1.1.0.cfg
index d4ccc88..c0cbde7 100644
--- a/bare/config/devel/or1ksim-1.1.0.cfg
+++ b/bare/config/devel/or1ksim-1.1.0.cfg
@@ -8,9 +8,9 @@
 
 %include %{_configdir}/base.cfg
 
-%define or1ksim_version 1.1.0
-%hash sha512 or1k-master.zip \
-
qi2pPthxvefp9OpwsAz3ul9lakJHkpwIgGlj4fcDa+Lshjsush2ekYm1SKsPJ38YaldSuJdH2buhCmPkXTeWHQ==
+%define or1ksim_version be3612f0
+%hash sha512 or1ksim-%{or1ksim_version}.tar.gz \
+
Mwd/0EisPq98b7TA9O84As21R/CvgSkZVQktcfRnsUnnMDfxICButX5EzflhzLd1NDzfqoNjXxDi65HBC10LnA==
 
 #
 # The or1ksim build instructions. We use 1.x.x Release 1.
diff --git a/source-builder/config/or1ksim-1-1.cfg 
b/source-builder/config/or1ksim-1-1.cfg
index 468f524..a95f1ee 100644
--- a/source-builder/config/or1ksim-1-1.cfg
+++ b/source-builder/config/or1ksim-1-1.cfg
@@ -17,7 +17,9 @@ URL: https://github.com/openrisc/or1ksim
 #
 # Source
 #
-%source set or1ksim https://github.com/openrisc/or1ksim/archive/or1k-master.zip
+%source set or1ksim \
+--rsb-file=or1ksim-%{or1ksim_version}.tar.gz \
+
https://codeload.github.com/openrisc/or1ksim/tar.gz/%{or1ksim_version}
 
 #
 # Prepare the source code.
-- 
2.37.1

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


[PATCH] rtems-fdt: Fix node property access on 64bit

2023-12-12 Thread chrisj
From: Chris Johns 

---
 cpukit/libmisc/rtems-fdt/rtems-fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt.c 
b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
index ec8f270eef..9f8d7bfb24 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt.c
@@ -1165,7 +1165,7 @@ rtems_fdt_get_value (const char* path,
   }
 
   if (length == sizeof (uintptr_t))
-*value = rtems_fdt_get_uint32 (prop);
+*value = rtems_fdt_get_uintptr (prop);
   else
 *value = 0;
 
-- 
2.42.0

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


[PATCH] libmisc/shell: Work around tmux bug in row and column

2023-12-12 Thread chrisj
From: Chris Johns 

- Extend the timeout to 150 msec for long remote sessions

- Improve the performance of the detection

Closes #4975
Closes #4977
---
 cpukit/libmisc/shell/shell.c | 141 ---
 1 file changed, 116 insertions(+), 25 deletions(-)

diff --git a/cpukit/libmisc/shell/shell.c b/cpukit/libmisc/shell/shell.c
index cd83aa56d1..3aded5440f 100644
--- a/cpukit/libmisc/shell/shell.c
+++ b/cpukit/libmisc/shell/shell.c
@@ -805,6 +805,69 @@ void rtems_shell_print_env(
 }
 #endif
 
+/*
+ * Wait for the string to return or timeout.
+ */
+static bool rtems_shell_term_wait_for(const int fd, const char* str, const int 
timeout)
+{
+  int msec = timeout;
+  int i = 0;
+  while (msec-- > 0 && str[i] != '\0') {
+char ch[2];
+if (read(fd, &ch[0], 1) == 1) {
+  fflush(stdout);
+  if (ch[0] != str[i++]) {
+return false;
+  }
+  msec = timeout;
+} else {
+  usleep(1000);
+}
+  }
+  if (msec == 0) {
+return false;
+  }
+  return true;
+}
+
+/*
+ * Buffer a string up to the end string
+ */
+static int rtems_shell_term_buffer_until(const int fd,
+ char* buf,
+ const int size,
+ const char* end,
+ const int timeout)
+{
+  int msec = timeout;
+  int i = 0;
+  int e = 0;
+  memset(&buf[0], 0, size);
+  while (msec-- > 0 && i < size && end[e] != '\0') {
+char ch[2];
+if (read(fd, &ch[0], 1) == 1) {
+  fflush(stdout);
+  buf[i++] = ch[0];
+  if (ch[0] == end[e]) {
+e++;
+  } else {
+e = 0;
+  }
+  msec = timeout;
+} else {
+  usleep(1000);
+}
+  }
+  if (msec == 0 || end[e] != '\0') {
+return -1;
+  }
+  i -= e;
+  if (i < size) {
+buf[i] = '\0';
+  }
+  return i;
+}
+
 /*
  * Direct method to get the size of an XTERM window.
  *
@@ -831,10 +894,39 @@ static void rtems_shell_winsize( void )
   term.c_cc[VMIN] = 0;
   term.c_cc[VTIME] = 0;
   if (tcsetattr (fd, TCSADRAIN, &term) >= 0) {
-int msec = 50;
-int len = 0;
-int i = 0;
+const int timeout = 150;
+bool row_cols_swapped = false;
 memset(&buf[0], 0, sizeof(buf));
+/*
+ * https://github.com/tmux/tmux/issues/3457
+ *
+ * Tmux has a bug where the lines and cols are swapped. There is a lag
+ * in the time it takes to get the fix into code so see if tmux is
+ * running and which version and work around the bug.
+ *
+ * CSI > Ps q
+ *Ps = 0   =>   DCS > | text ST
+ */
+fputs("\033[>0q", stdout);
+fflush(stdout);
+if (rtems_shell_term_wait_for(fd, "\033P>|", timeout)) {
+  int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), 
"\033\\", timeout);
+  if (len > 0) {
+if (memcmp(buf, "tmux ", 5) == 0) {
+  static const char* bad_versions[] = {
+"3.2", "3.2a", "3.3", "3.3a"
+  };
+  #define bad_versions_num (sizeof(bad_versions) / 
sizeof(bad_versions[0]))
+  size_t i;
+  for (i = 0; i < bad_versions_num; ++i) {
+if (strcmp(bad_versions[i], buf + 5) == 0) {
+  row_cols_swapped = true;
+  break;
+}
+  }
+}
+  }
+}
 /*
  * 
https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Miscellaneous
  *
@@ -842,33 +934,32 @@ static void rtems_shell_winsize( void )
  */
 fputs("\033[18t", stdout);
 fflush(stdout);
-while (msec-- > 0 && len < sizeof(buf)) {
-  char ch[2];
-  if (read(fd, &ch[0], 1) == 1) {
-buf[len++] = ch[0];
-msec = 50;
-  } else {
-usleep(1000);
-  }
-}
-while (i < len) {
-  static const char resp[] = "\033[8;";
-  if (memcmp(resp, &buf[i], sizeof(resp) - 1) == 0) {
-i += sizeof(resp) - 1;
-while (i < len && buf[i] != ';') {
+if (rtems_shell_term_wait_for(fd, "\033[8;", timeout)) {
+  int len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), ";", 
timeout);
+  if (len > 0) {
+int i;
+lines = 0;
+i = 0;
+while (i < len) {
   lines *= 10;
   lines += buf[i++] - '0';
 }
-cols = 0;
-++i;
-while (i < len && buf[i] != 't') {
-  cols *= 10;
-  cols += buf[i++] - '0';
+len = rtems_shell_term_buffer_until(fd, buf, sizeof(buf), "t", 
timeout);
+if (len > 0) {
+  cols = 0;
+  i = 0;
+  while (i < len) {
+cols *= 10;
+cols += buf[i++] - '0';
+  }
+

[RSB PATCH] print/texinfo: Check the version and build if too old

2023-12-07 Thread chrisj
From: Chris Johns 

Packages like binutils need newer versions than available by
default on MacOS.
---
 bare/config/print/texinfo.cfg | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/bare/config/print/texinfo.cfg b/bare/config/print/texinfo.cfg
index 5fa0cba..0c4c4f9 100644
--- a/bare/config/print/texinfo.cfg
+++ b/bare/config/print/texinfo.cfg
@@ -1,8 +1,15 @@
 #
 # GNU makeinfo has a version option, check for it.
-# If not found build it.
+# If not found or not recent build it.
 #
+%define makeinfo_version 7.0.3
 %define has_makeinfo %(makeinfo --version > /dev/null 2>&1; echo $?)
+%if %{has_makeinfo} == 0
+ %define makeinfo_version_resident %(makeinfo --version | grep "makeinfo (GNU 
texinfo)" | rev | sed -r 's/ .*//' | rev)
+ %if %{makeinfo_version_resident} < %{makeinfo_version}
+  %define has_makeinfo 1
+ %endif
+%endif
 %if %{has_makeinfo} != 0
  %include %{_configdir}/print/texinfo-7.0.3.cfg
 %endif
-- 
2.37.1 (Apple Git-137.1)

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


[PATCH v2 2/4] hash: Fix missing hashes after errors if missing

2023-12-06 Thread chrisj
From: Chris Johns 

---
 bare/config/devel/binutils-2.22-1.cfg |  2 +
 bare/config/devel/binutils-2.24-1.cfg |  3 +
 bare/config/devel/gcc-4.6-newlib-1.20-1.cfg   | 13 
 .../config/devel/gcc-4.9.1-newlib-2.1.0-1.cfg | 11 +++
 bare/config/devel/gdb-7.7-1.cfg   |  2 +
 rtems/config/graphics/nxlib-0.47-dev-1.cfg|  4 +-
 rtems/config/net-mgmt/net-snmp-5.7.2.1-1.cfg  |  2 +-
 rtems/config/net/net-services-1.cfg   |  2 +-
 rtems/config/tools/rtems-libbsd-6.cfg |  2 +-
 rtems/config/tools/rtems-net-legacy-6.cfg |  2 +-
 .../tools/rtems-xilinx-binutils-2.36.cfg  | 67 +---
 .../tools/rtems-xilinx-gcc-10-newlib-head.cfg | 76 ---
 source-builder/config/gdb-7.5-1.cfg   |  3 +
 source-builder/config/nxlib-1.cfg |  4 +-
 source-builder/config/swig-4-1.cfg|  3 +-
 15 files changed, 134 insertions(+), 62 deletions(-)

diff --git a/bare/config/devel/binutils-2.22-1.cfg 
b/bare/config/devel/binutils-2.22-1.cfg
index e585483..1afa6b1 100644
--- a/bare/config/devel/binutils-2.22-1.cfg
+++ b/bare/config/devel/binutils-2.22-1.cfg
@@ -10,6 +10,8 @@
 %include %{_configdir}/base.cfg
 
 %define binutils_version 2.22
+%hash sha512 binutils-%{binutils_version}.tar.bz2 \
+   
/+jvJj75kYPozII/6Eh/99D3v5qO/ShTtfRjasoAI4UNE95OrH13pfaUE9ilDm+VuxRWm+U9+GwLzjgDRSWrdA==
 
 #
 # The binutils build instructions. We use 2.xx Release 1.
diff --git a/bare/config/devel/binutils-2.24-1.cfg 
b/bare/config/devel/binutils-2.24-1.cfg
index 652c274..a714ff1 100644
--- a/bare/config/devel/binutils-2.24-1.cfg
+++ b/bare/config/devel/binutils-2.24-1.cfg
@@ -9,6 +9,9 @@
 
 %define binutils_version 2.24
 
+%hash sha512 binutils-%{binutils_version}.tar.bz2 \
+   
Xsla1H1JsSxFWKjbDKIQnT7hlV43dgV/MzDEUG+PTRz15QX7+KFrmEA6D83qr5hv4KIr5kViR9vazmPOH3drEg==
+
 #
 # Enable deterministic archives by default. This will be the default
 # there all tools using this binutils will create deterministic
diff --git a/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg 
b/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg
index 659752f..bb3f2e3 100644
--- a/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg
+++ b/bare/config/devel/gcc-4.6-newlib-1.20-1.cfg
@@ -19,6 +19,19 @@
 %define gmp_url  https://ftp.gnu.org/gnu/gmp
 %define mpfr_url https://ftp.gnu.org/gnu/mpfr
 
+%hash sha512 gcc-core-%{gcc_version}.tar.bz2 \
+   
ucVpu3E/OrCp1PbomMfQGRRUb7vmH021FRU2/+N0SQrm8VTfojgatgcrKJC3YVT769+S8GDoVAT1SZfwFpcvTA==
+%hash sha512 gcc-g--%{gcc_version}.tar.gz \
+   
qVHKvglD9l+ziCNrHuemi3ebq0T4aTQIkzRseYbiVEkA0LZeTyUHxpdlXzaxajB3szQG1Zh8VtMGhYZda9tOGA==
+%hash sha512 newlib-%{newlib_version}.tar.gz \
+   
Kr8dMJgORgxNb/5NFoLjhAPQVgSOAGdTYiVnMeV/5nWdAehby6hCWNIRlBkm4TvzxjL/OCSTGoRMiyWW55VFHw==
+%hash sha512 mpfr-%{mpfr_version}.tar.bz2 \
+   
u6x9DWP9O0zYleJHxEitzn9MK2tm7P4mrxOAGOD5aZH6jL2MvpT5JHYaoaxnbiWa8SKGAN/AhUMU6HXnc5/SeQ==
+%hash sha512 mpc-%{mpc_version}.tar.gz \
+   
3KrDiXrfFBHhGZ4pXojXQ4r8YA9BJWXDtFCwECuDdR6xYPhbdSKJEZX/Cgop/M7dB9wBGpUJaaCXnE49TvweEA==
+%hash sha512 gmp-%{gmp_version}.tar.bz2 \
+   
ZLqIpKZP77FurpxkTqgRlAEeoLQmZKWvawFOfaPQ8JYF3uUYuaNhsGUQMRzf1JaraNCdo9hdZoC9rD92XrZ/YQ==
+
 #
 # Project custom message
 #
diff --git a/bare/config/devel/gcc-4.9.1-newlib-2.1.0-1.cfg 
b/bare/config/devel/gcc-4.9.1-newlib-2.1.0-1.cfg
index 495641e..d739807 100644
--- a/bare/config/devel/gcc-4.9.1-newlib-2.1.0-1.cfg
+++ b/bare/config/devel/gcc-4.9.1-newlib-2.1.0-1.cfg
@@ -19,6 +19,17 @@
 %define with_iconv 1
 %endif
 
+%hash sha512 gcc-%{gcc_version}.tar.bz2 \
+   
hZgQakt8A7tNbin6G/qe5rY5DR8byobBzNJ67YMK4dEm2qUMQEEBbL+nYJDdZsUfHOBpWLjM1sO+UerodRJVkw==
+%hash sha512 newlib-%{newlib_version}.tar.gz \
+   
Z3CGT5MHq7JAGk5I8oaEXTpK/DCyrJh9pLlkpUhcw4I7MtBqCr9hUo6TxK2KOgqjzB7NOwM4UOayvebZu8mlRw==
+%hash sha512 mpfr-%{mpfr_version}.tar.bz2 \
+   
u6x9DWP9O0zYleJHxEitzn9MK2tm7P4mrxOAGOD5aZH6jL2MvpT5JHYaoaxnbiWa8SKGAN/AhUMU6HXnc5/SeQ==
+%hash sha512 mpc-%{mpc_version}.tar.gz \
+   
3KrDiXrfFBHhGZ4pXojXQ4r8YA9BJWXDtFCwECuDdR6xYPhbdSKJEZX/Cgop/M7dB9wBGpUJaaCXnE49TvweEA==
+%hash sha512 gmp-%{gmp_version}.tar.bz2 \
+   
ZLqIpKZP77FurpxkTqgRlAEeoLQmZKWvawFOfaPQ8JYF3uUYuaNhsGUQMRzf1JaraNCdo9hdZoC9rD92XrZ/YQ==
+
 #
 # The gcc/newlib build instructions. We use 4.9 Release 1.
 #
diff --git a/bare/config/devel/gdb-7.7-1.cfg b/bare/config/devel/gdb-7.7-1.cfg
index 1afce5a..e61fff2 100644
--- a/bare/config/devel/gdb-7.7-1.cfg
+++ b/bare/config/devel/gdb-7.7-1.cfg
@@ -6,6 +6,8 @@
 %include %{_configdir}/base.cfg
 
 %define gdb_version 7.7
+%hash sha512 gdb-%{gdb_version}.tar.gz \
+   
eNYj6X8jJUakcohURCIReUO4YtGZwR4E2E/GF210w27hqGLVJ07qKZbm6d6gnWtp5/DGxkrMS3oHuXSt0eiBPw==
 
 #
 # The gdb build instructions. We use 7.xx Release 1.
diff --git a/rtems/config/graphics/nxlib-0.47-dev-1.cfg 
b/rtems/config/graphics/nxlib-0.47-dev-1.cfg
index deed54e..aec6806 100644
--- a/rtems/config/graphics/nxlib-0.47-dev-1.cfg
+++ b/rtems/config/graphics/nxlib-0.47-dev-1.c

[PATCH v2 3/4] sb: Allow _ in downloaded file names

2023-12-06 Thread chrisj
From: Chris Johns 

---
 source-builder/sb/download.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 3f26644..6e6f9f2 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -132,7 +132,7 @@ def _hash_check(file_, absfile, macros, remove = True):
 if hasher is not None:
 del hasher
 else:
-raise error.general('%s: no hash found in released RSB' % (file_))
+raise error.general('%s: no hash found' % (file_))
 return not failed
 
 def _local_path(source, pathkey, config):
@@ -189,7 +189,7 @@ def _http_parser(source, pathkey, config, opts):
 #
 # Wipe out everything special in the file name.
 #
-source['file'] = re.sub(r'[^a-zA-Z0-9.\-]+', '-', source['file'])
+source['file'] = re.sub(r'[^a-zA-Z0-9.\-_]+', '-', source['file'])
 max_file_len = 127
 if len(source['file']) > max_file_len:
 raise error.general('file name length is greater than %i (maybe 
use --rsb-file=FILE option): %s' % \
-- 
2.37.1

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


[PATCH v2 4/4] sb: Set the uid and gid on POSIX systems

2023-12-06 Thread chrisj
From: Chris Johns 

This improves performance because it avoids an exec each time
the _uid macro is referenced and that can be a number of times
for each config parsed.
---
 source-builder/sb/options.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
index d554097..ac5982b 100644
--- a/source-builder/sb/options.py
+++ b/source-builder/sb/options.py
@@ -46,7 +46,7 @@ basepath = 'sb'
 #
 # Save the host and POSIX state.
 #
-host_windows = False
+host_windows = os.name == 'nt'
 host_posix = True
 
 class command_line:
@@ -103,6 +103,10 @@ class command_line:
 self.defaults[self._long_opts[lo][0]] = ('none',
  'none',
  
self._long_opts[lo][3])
+# Set the _uid field, performance improvement on Unix
+if not host_windows:
+self.defaults['_uid'] = str(os.getuid())
+self.defaults['_did'] = str(os.getdid())
 
 def __str__(self):
 def _dict(dd):
-- 
2.37.1

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


[PATCH v2 1/4] sb: No hash on a package is an error

2023-12-06 Thread chrisj
From: Chris Johns 

---
 source-builder/sb/download.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 410edeb..3f26644 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -132,9 +132,7 @@ def _hash_check(file_, absfile, macros, remove = True):
 if hasher is not None:
 del hasher
 else:
-if version.released():
-raise error.general('%s: no hash found in released RSB' % (file_))
-log.warning('%s: no hash found' % (file_))
+raise error.general('%s: no hash found in released RSB' % (file_))
 return not failed
 
 def _local_path(source, pathkey, config):
-- 
2.37.1

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


[RSB PATCH] gdb: Add options to contorl the python version

2023-11-29 Thread chrisj
From: Chris Johns 

The options are:
  --with-python2
  --with-python3
  --with-python-version

Closes #4973
---
 source-builder/config/gdb-common-1.cfg | 19 +++
 1 file changed, 19 insertions(+)

diff --git a/source-builder/config/gdb-common-1.cfg 
b/source-builder/config/gdb-common-1.cfg
index 0fea334..49bf673 100644
--- a/source-builder/config/gdb-common-1.cfg
+++ b/source-builder/config/gdb-common-1.cfg
@@ -44,6 +44,25 @@
 #
 # 3. Search for 'python3' and if not found search for 'python2'.
 #
+# User options to help find a suitable python:
+#
+# --with-python2 : name of a python2 command
+#
+# --with-python3 : name of a python2 command
+#
+# --with-python-version : name of a python command with a specific version
+#
+# For example `--with-python-version=python3.6
+#
+%if %{defined with_python2}
+ %define gdb-python2 %{with_python2}
+%endif
+%if %{defined with_python3}
+ %define gdb-python3 %{with_python3}
+%endif
+%if %{defined with_python_version}
+ %define gdb-python-version %{with_python_version}
+%endif
 %if %{defined gdb-python2}
   %define gdb-enable-python %{gdb_python2}
 %else
-- 
2.19.1

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


[RSB PATCH] sb: No hash on a package is an error

2023-11-29 Thread chrisj
From: Chris Johns 

---
 source-builder/sb/download.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/source-builder/sb/download.py b/source-builder/sb/download.py
index 410edeb..3f26644 100644
--- a/source-builder/sb/download.py
+++ b/source-builder/sb/download.py
@@ -132,9 +132,7 @@ def _hash_check(file_, absfile, macros, remove = True):
 if hasher is not None:
 del hasher
 else:
-if version.released():
-raise error.general('%s: no hash found in released RSB' % (file_))
-log.warning('%s: no hash found' % (file_))
+raise error.general('%s: no hash found in released RSB' % (file_))
 return not failed
 
 def _local_path(source, pathkey, config):
-- 
2.37.1

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


[RSB PATCH v2] 6: Fix gcc-13 support for MacOS

2023-11-28 Thread chrisj
From: Chris Johns 

Update #4921
---
 bare/config/devel/gmp-6.2.1.cfg   | 11 +++-
 bare/config/devel/gmp-6.3.0.cfg   | 18 +
 rtems/config/6/rtems-default.bset |  2 +-
 .../tools/rtems-gcc-13.2-newlib-head.cfg  |  2 +-
 source-builder/config/gcc-13.cfg  | 26 +++
 source-builder/config/gmp.cfg | 17 +++-
 6 files changed, 67 insertions(+), 9 deletions(-)
 create mode 100644 bare/config/devel/gmp-6.3.0.cfg
 create mode 100644 source-builder/config/gcc-13.cfg

diff --git a/bare/config/devel/gmp-6.2.1.cfg b/bare/config/devel/gmp-6.2.1.cfg
index 1ab620c..19c5930 100644
--- a/bare/config/devel/gmp-6.2.1.cfg
+++ b/bare/config/devel/gmp-6.2.1.cfg
@@ -8,8 +8,17 @@
 
 %include %{_configdir}/base.cfg
 
+%define gmp_url https://gcc.gnu.org/pub/gcc/infrastructure
 %define gmp_version 6.2.1
-%hash sha512 gmp-%{gmp_version}.tar.bz2 
8904334a3bcc5c896ececabc75cda9dec642e401fb5397c4992c4fabea5e962c9ce8bd44e8e4233c34e55c8010cc28db0545f5f750cbdbb5f00af538dc763be9
+%hash sha512 gmp-%{gmp_version}.tar.bz2 \
+
iQQzSjvMXIluzsq8dc2p3sZC5AH7U5fEmSxPq+peliyc6L1E6OQjPDTlXIAQzCjbBUX191DL27XwCvU43HY76Q==
+
+#
+# Do not use assembler if MacOS AARCH64
+#
+%if %{_host_os} == darwin && %{_host_arch} == arm64
+ %define gmp_extra_options --disable-assembly
+%endif
 
 #
 # The GMP build instructions.
diff --git a/bare/config/devel/gmp-6.3.0.cfg b/bare/config/devel/gmp-6.3.0.cfg
new file mode 100644
index 000..09e85b6
--- /dev/null
+++ b/bare/config/devel/gmp-6.3.0.cfg
@@ -0,0 +1,18 @@
+#
+# GMP 6.3.0
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+%include %{_configdir}/base.cfg
+
+%define gmp_version 6.3.0
+%hash sha512 gmp-%{gmp_version}.tar.bz2 \
+   
O2hMm8ue3it+VNC6TJdkv6F8INTzAAAXxVO28eE1tTaUlYD/NzQWgMJdwjbP4LoduM/f5hnOATZWGJ7whxuJ+A==
+
+#
+# The GMP build instructions.
+#
+%include %{_configdir}/gmp.cfg
diff --git a/rtems/config/6/rtems-default.bset 
b/rtems/config/6/rtems-default.bset
index b702275..2d7a223 100644
--- a/rtems/config/6/rtems-default.bset
+++ b/rtems/config/6/rtems-default.bset
@@ -11,7 +11,7 @@
 #
 %defineifnot with_rtems_dtc  devel/dtc-1.6.1-1
 %defineifnot with_rtems_expatdevel/expat-2.5.0-1
-%defineifnot with_rtems_gmp  devel/gmp-6.2.1
+%defineifnot with_rtems_gmp  devel/gmp-6.3.0
 %defineifnot with_rtems_gdb  tools/rtems-gdb-13.2
 %defineifnot with_rtems_binutils tools/rtems-binutils-2.41
 %defineifnot with_rtems_gcc  tools/rtems-gcc-13.2-newlib-head
diff --git a/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg 
b/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg
index 86e0135..a8d729f 100644
--- a/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg
+++ b/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg
@@ -17,4 +17,4 @@
 %define with_plugin 0
 %define with_iconv 1
 
-%include %{_configdir}/gcc-12.cfg
+%include %{_configdir}/gcc-13.cfg
diff --git a/source-builder/config/gcc-13.cfg b/source-builder/config/gcc-13.cfg
new file mode 100644
index 000..19b514a
--- /dev/null
+++ b/source-builder/config/gcc-13.cfg
@@ -0,0 +1,26 @@
+#
+# GCC 13
+#
+# This configuration file configure's, make's and install's gcc. It uses
+# newlib, ISL, MPFR and MPC in a one-tree build configuration.
+#
+
+%define isl_version 0.24
+%hash sha512 isl-%{isl_version}.tar.bz2 \
+
qrO929qWuAHQ9W0oaflDFXqtUqb25qYXRe3XQCNMY1w4IxryC8PxoI1Bal6XOpDhgkkHjtjkri8dXeV2WHOOlQ==
+# See #4657
+%patch add isl -p1 
https://devel.rtems.org/raw-attachment/ticket/4657/fix-mac-arm64-isl-config.patch
+%hash sha512 fix-mac-arm64-isl-config.patch \
+
wH/bYFplINGUNYUEcx5jtUAhHvaAOD8cpOxltKxDridodTT9fYGWpNvoOg7PLEKkJUxx5gnuSEp2FFc7xJmi6A==
+
+%define mpfr_version 4.2.1
+%define mpfr_url https://ftp.gnu.org/gnu/mpfr
+%hash sha512 mpfr-%{mpfr_version}.tar.bz2 \
+
yBhCUy7MZjNI3rdADZEa1xkz07Ulovnlrc0EJlycD90fIuyiKfSCcDrH8iLvIJ/J4zndH6R9cq5X9/cLIzanbw==
+
+%define mpc_version 1.3.1
+%define mpc_url https://ftp.gnu.org/gnu/mpc
+%hash sha512 mpc-%{mpc_version}.tar.gz \
+
S6tO9gdvjF39yZ2BC1EQjO1h6ilCugwcky1iQ2ClRz3yDTKzAPx28rpKoql+Hydcn9SUobqfB8TLKtfOrrGulw==
+
+%include %{_configdir}/gcc-common-1.cfg
diff --git a/source-builder/config/gmp.cfg b/source-builder/config/gmp.cfg
index 4e8d674..352caef 100644
--- a/source-builder/config/gmp.cfg
+++ b/source-builder/config/gmp.cfg
@@ -15,17 +15,22 @@ Release:   %{release}
 URL:  https://gmplib.org/
 
 #
-# Source
+# Allow the user to override the UURL
 #
-%source set gmp 
https://gcc.gnu.org/pub/gcc/infrastructure/gmp-%{gmp_version}.tar.bz2
+%if %{!defined gmp_url}
+ %define gmp_url https://gmplib.org/download/gmp
+%endif
 
-%define gmp_extra_options %{nil}
+#
+# Source
+#
+%source set gmp %{gmp_url}/gmp-%{gmp_version}.tar.bz2
 
 #
-# Do not use assembler if MacOS AARCH64
+# Allow extra options
 #
-%if %{_host_os} == darwin && %{_host_arch} == arm64
- %define gmp_extra_options %{gmp_extra_options} --disable-assembly
+%if %{!defined gmp_

[RSB PATCH] 6: Merge the MacOS M silicon patch from gcc-12 to gcc-13

2023-11-23 Thread chrisj
From: Chris Johns 

Updates #4921
---
 rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg 
b/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg
index 86e0135..4422e36 100644
--- a/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg
+++ b/rtems/config/tools/rtems-gcc-13.2-newlib-head.cfg
@@ -6,6 +6,20 @@
 %hash sha512 gcc-%{gcc_version}.tar.xz \
   
2Z5IJqcNsEUERn40np+67apYcHZs2nxcq1DN6+3EvnVevKW3ieEjKjSiC+GgtgCX3pKA7+R723HHMlHjCwhiog==
 
+# Following patches are related to compilation on Apple M1/Darwin host 
platform.
+# They are here to workaround issues with ISL and MPC libraries.
+# Upstream projects were already informed so hopefully when RSB moves
+# to more modern libraries versions they may be removed from here.
+# The patches are solely for libisl 0.24 and libmpc 1.2.1
+# See #4657 for more information.
+%patch add isl -p1 
https://devel.rtems.org/raw-attachment/ticket/4657/fix-mac-arm64-isl-config.patch
+%hash sha512 fix-mac-arm64-isl-config.patch \
+
wH/bYFplINGUNYUEcx5jtUAhHvaAOD8cpOxltKxDridodTT9fYGWpNvoOg7PLEKkJUxx5gnuSEp2FFc7xJmi6A==
+%patch add mpc -p1 
https://devel.rtems.org/raw-attachment/ticket/4657/fix-mac-arm64-mpc-config.patch
+%hash sha512 fix-mac-arm64-mpc-config.patch \
+
KEmxHjYOqY4LTXCMZ3I60tbHusbR5GlnP0CLARHPAnhCnovDj9K3U43C1bsMxDDGRqD6fwtrEFoEgqVFX63IuQ==
+# Comment above related to #4657 and patches ends here
+
 %define newlib_version 3cacedb
 %define newlib_external 1
 %define newlib_expand_name sourceware-mirror-newlib-cygwin-%{newlib_version}
-- 
2.39.3 (Apple Git-145)

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


[RSB PATCH] rtems/rtems-tools: Update with C++17 and Python 3.12 fixes

2023-11-22 Thread chrisj
From: Chris Johns 

Updates #4969
Updates #4970
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index 859c297..7ef2052 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version 7dc34d2cabf5e9f77b6a9d035b01a75a6f593044
+ %define rtems_tools_version f408c0f8d935d53c232c67bed39e4018fd8d7a2a
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-   
I8F4RkorMvfM9OUuS6hRfAEjxMydtE6sHTjnTzpek854caQAC2eHN2Hqi6HIN/9zXEWA7YeFgNsYdJsBsA5Hcg==
+   
xZIWwcW4y9wOsIY+8XWDAxKk51TwKFHeOw39SS6zxrgE0LOFxfpy/SQeidCRvOUieQPbEmZRUdLyFW1UDEHh3w==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.39.3 (Apple Git-145)

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


[rtems-docs PATCH] user/hosts/macos: Update MacOS versions and using python.org

2023-11-22 Thread chrisj
From: Chris Johns 

---
 user/hosts/macos.rst | 105 +++
 1 file changed, 97 insertions(+), 8 deletions(-)

diff --git a/user/hosts/macos.rst b/user/hosts/macos.rst
index 78cef88..667c913 100644
--- a/user/hosts/macos.rst
+++ b/user/hosts/macos.rst
@@ -7,18 +7,105 @@
 Apple macOS
 ===
 
-Apple's macOS is fully supported. You need to download and install a recent
-version of the Apple developer application Xcode. Xocde is available in the App
-Store. Make sure you install the Command Line Tools add on available for
-download within Xcode and once installed open a Terminal shell and enter the
-command ``cc`` and accept the license agreement.
+Apple's macOS is supported. You need to download and install a recent
+version of the Apple developer application Xcode. Xocde is available
+in the App Store. Make sure you install the Command Line Tools add on
+available for download within Xcode and once installed open a Terminal
+shell and enter the command ``cc`` and accept the license agreement.
 
-The normal prefix when working on macOS as a user is under your home directory.
-Prefixes of :file:`$HOME/development/rtems` or :file:`$HOME/rtems` are
-suitable.
+The normal prefix when working on macOS as a user is under your home
+directory.  Prefixes of :file:`$HOME/development/rtems` or
+:file:`$HOME/rtems` are suitable.
 
 :ref:`QuickStartPrefixes` details using Prefixes to manage the installation.
 
+Homebrew and Macports should work but are not tested by the project as
+they are rolling releases making it difficult to reproduce any
+problems there may be. We recommend reaching out to those projects for
+support.
+
+Intel and Apple silicon is supported.
+
+Python
+~~
+
+Building GDB requires the installation of Python's development
+libraries. Building GDB includes the Python runtime header
+``Python.h`` and linking to the Python runtime libraries. The RSB
+detects a valid header and libraries before starting a GDB
+build.
+
+It is recommended you run the RSB in a Python virtual environment. A
+virtual environment manages paths for you, provides a ``python``
+executable mapped to the version the virtual environment is built with
+and a command to find the appropiate runtime header and library files
+GDB needs. Virtual environments make it easier to update Python to a
+newer version if this is needed.
+
+Apple has removed support for Python's development libraries from
+recent versions of MacOS as users can manage Python using the
+installer packages provided by the Python project.
+
+To install:
+
+1. Download a Python installer for MacOS from https://www.python.org/.
+
+2. Run the installer and install Python.
+
+3. Open a terminal and update your shell profile using the command
+   Python provides. For Python 3.12 the command is:
+
+   .. code-block:: shell
+
+  /Applications/Python\ 3.12/Update\ Shell\ Profile.command
+
+   Check with:
+
+   .. code-block:: shell
+
+  % type python3.12
+  python3.12 is 
/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12
+
+3. Create a virtual environment:
+
+   .. code-block:: shell
+
+  mkdir $HOME/development/rtems
+  cd $HOME/development/rtems
+  python3.12 -m venv py3.12
+
+   Activate the virtual environment:
+
+   .. code-block:: shell
+
+  . $HOME/development/rtems/py3.12/bin/activate
+
+   You are now ready to the build the tools within the virtual
+   environment.
+
+.. _Sonoma:
+
+Sonoma
+~~
+
+The RSB is supported on Sonoma and Applie silicon.
+
+.. _Ventura:
+
+Ventura
+~~~
+
+The RSB is supported on Ventura and Intel silicon.
+
+.. _Monterey:
+
+Monterey
+
+
+The RSB is supported on Ventura and Intel silicon.
+
+.. _Catalina:
+
 Catalina
 
 
@@ -30,6 +117,8 @@ also
 Due to the deprecated Python 2.7 support, we recommend to install and use the
 `latest Python 3 release from python.org 
`_.
 
+.. _Sierra:
+
 Sierra
 ~~
 
-- 
2.37.1

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


[rtems-tools PATCH 1/2] rtemstoolkit: Update SimpleIni to latest

2023-11-21 Thread chrisj
From: Chris Johns 

The resolves C++17 warnings.

Updates #4970
---
 rtemstoolkit/SimpleIni.h | 598 +++
 1 file changed, 419 insertions(+), 179 deletions(-)

diff --git a/rtemstoolkit/SimpleIni.h b/rtemstoolkit/SimpleIni.h
index fd37c4b..ec99abb 100644
--- a/rtemstoolkit/SimpleIni.h
+++ b/rtemstoolkit/SimpleIni.h
@@ -3,9 +3,9 @@
 
 Library SimpleIni
 FileSimpleIni.h
-Author  Brodie Thiesfield [code at jellycan dot com]
+Author  Brodie Thiesfield
 Source  https://github.com/brofield/simpleini
-Version 4.17
+Version 4.20
 
 
 Jump to the @link CSimpleIniTempl CSimpleIni @endlink interface 
documentation.
@@ -20,7 +20,7 @@
 @section features FEATURES
 
 - MIT Licence allows free use in all software (including GPL and 
commercial)
-- multi-platform (Windows 95/98/ME/NT/2K/XP/2003, Windows CE, Linux, Unix)
+- multi-platform (Windows CE/9x/NT..10/etc, Linux, MacOSX, Unix)
 - loading and saving of INI-style configuration files
 - configuration files can have any newline format on all platforms
 - liberal acceptance of file format
@@ -42,22 +42,31 @@
 - Windows/VC6 (warning level 3)
 - Windows/VC.NET 2003 (warning level 4)
 - Windows/VC 2005 (warning level 4)
+- Windows/VC 2019 (warning level 4)
 - Linux/gcc (-Wall)
 
 
 @section usage USAGE SUMMARY
 
+-#  Decide if you will be using utf8 or MBCS files, and working with the
+data in utf8, wchar_t or ICU chars. 
+-#  If you will only be using straight utf8 files and access the data via 
the 
+char interface, then you do not need any conversion library and could 
define 
+SI_NO_CONVERSION. Note that no conversion also means no validation of 
the data.
+If no converter is specified then the default converter is 
SI_CONVERT_GENERIC 
+on Mac/Linux and SI_CONVERT_WIN32 on Windows. If you need widechar 
support on 
+Mac/Linux then use either SI_CONVERT_GENERIC or SI_CONVERT_ICU. These 
are also
+supported on all platforms.
 -#  Define the appropriate symbol for the converter you wish to use and
-include the SimpleIni.h header file. If no specific converter is 
defined
-then the default converter is used. The default conversion mode uses
-SI_CONVERT_WIN32 on Windows and SI_CONVERT_GENERIC on all other
-platforms. If you are using ICU then SI_CONVERT_ICU is supported on all
-platforms.
--#  Declare an instance the appropriate class. Note that the following
+include the SimpleIni.h header file. 
+-#  Declare an instance of the appropriate class. Note that the following
 definitions are just shortcuts for commonly used types. Other types
 (PRUnichar, unsigned short, unsigned char) are also possible.
 
-Interface   Case-sensitive  Load UTF-8  Load 
MBCS   Typedef
+Interface   Case-sensitive  Load UTF-8  Load 
MBCS   Typedef
+SI_NO_CONVERSION
+charNo  Yes No 
 CSimpleIniA
+charYes Yes No 
 CSimpleIniCaseA
 SI_CONVERT_GENERIC
 charNo  Yes Yes #1 
 CSimpleIniA
 charYes Yes Yes
 CSimpleIniCaseA
@@ -88,6 +97,8 @@
 GetValueReturn a value for a section & key
 SetValueAdd or update a value for a section & 
key
 Delete  Remove a section, or a key from a 
section
+SectionExists   Does a section exist?
+KeyExists   Does a key exist?
 
 -# Call Save() or SaveFile() to save the INI configuration data
 
@@ -161,9 +172,10 @@
   SI_STRLESS class, or by sorting the strings external to this library.
 - Usage of the  header on Windows can be disabled by defining
   SI_NO_MBCS. This is defined automatically on Windows CE platforms.
+- Not thread-safe so manage your own locking
 
 @section contrib CONTRIBUTIONS
-
+
 - 2010/05/03: Tobias Gehrig: added GetDoubleValue()
 
 @section licence MIT LICENCE
@@ -213,11 +225,11 @@
 #endif
 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
-#include 
 #include 
 
 #ifdef SI_SUPPORT_IOSTREAMS
@@ -233,16 +245,16 @@
 # define SI_ASSERT(x)
 #endif
 
-enum SI_Error {
-SI_OK   =  0,   //!< No error
-SI_UPDATED  =  1,   //!< An existing value was updated
-SI_INSERTED =  2,   //!< A new value was inserted
+using SI_Error = int;
 
-// note: test for any error with (retval < 0)
-SI_FAIL = -1,   //!< Generic failure
-SI_NOMEM= -2,   //!< Out of memory error
-SI_FILE = -3//!< File error (see errno for detail error)
-};
+constexpr int SI_OK = 0;//!< No error
+constexpr int SI_UPDATED = 1;   //!< A

[rtems-tools PATCH 2/2] rtemstoolkit, linkers: Fix C++17 warnings

2023-11-21 Thread chrisj
From: Chris Johns 

Closes #4970
---
 linkers/rtems-exeinfo.cpp |  3 +--
 rtemstoolkit/rld-elf.cpp  | 12 
 rtemstoolkit/rld-elf.h|  5 -
 rtemstoolkit/rld-rap.cpp  |  9 ++---
 rtemstoolkit/rld.cpp  | 14 --
 5 files changed, 11 insertions(+), 32 deletions(-)

diff --git a/linkers/rtems-exeinfo.cpp b/linkers/rtems-exeinfo.cpp
index 0900812..0b43403 100644
--- a/linkers/rtems-exeinfo.cpp
+++ b/linkers/rtems-exeinfo.cpp
@@ -223,8 +223,7 @@ namespace rld
  * Helper for for_each to filter and load the sections we wish to
  * dump.
  */
-class section_loader:
-  public std::unary_function < const files::section, void >
+class section_loader
 {
 public:
 
diff --git a/rtemstoolkit/rld-elf.cpp b/rtemstoolkit/rld-elf.cpp
index 68efdbe..8b55818 100644
--- a/rtemstoolkit/rld-elf.cpp
+++ b/rtemstoolkit/rld-elf.cpp
@@ -200,18 +200,6 @@ namespace rld
   << std::endl;
 }
 
-section::section (const section& orig)
-  : file_ (orig.file_),
-index_ (orig.index_),
-name_ (orig.name_),
-scn (orig.scn),
-shdr (orig.shdr),
-data_ (orig.data_),
-rela (orig.rela),
-relocs (orig.relocs)
-{
-}
-
 section::section ()
   : file_ (0),
 index_ (-1),
diff --git a/rtemstoolkit/rld-elf.h b/rtemstoolkit/rld-elf.h
index 4919135..d66eee5 100644
--- a/rtemstoolkit/rld-elf.h
+++ b/rtemstoolkit/rld-elf.h
@@ -174,11 +174,6 @@ namespace rld
*/
   section (file& file_, int index);
 
-  /**
-   * Copy constructor.
-   */
-  section (const section& orig);
-
   /**
* Default constructor.
*/
diff --git a/rtemstoolkit/rld-rap.cpp b/rtemstoolkit/rld-rap.cpp
index 93ffbdc..045536a 100644
--- a/rtemstoolkit/rld-rap.cpp
+++ b/rtemstoolkit/rld-rap.cpp
@@ -696,8 +696,7 @@ namespace rld
  * Helper for for_each to merge the related object sections into the RAP
  * section.
  */
-class section_merge:
-  public std::unary_function < const files::section, void >
+class section_merge
 {
 public:
 
@@ -1191,8 +1190,7 @@ namespace rld
 /**
  * Helper for for_each to write out the various sections.
  */
-class section_writer:
-  public std::unary_function < object, void >
+class section_writer
 {
 public:
 
@@ -1364,8 +1362,6 @@ namespace rld
 void
 image::write_relocations (compress::compressor& comp)
 {
-  uint32_t rr = 0;
-
   for (int s = 0; s < rap_secs; ++s)
   {
 uint32_t count = get_relocations (s);
@@ -1515,7 +1511,6 @@ namespace rld
 
 ++rc;
 ++sr;
-++rr;
   }
 }
   }
diff --git a/rtemstoolkit/rld.cpp b/rtemstoolkit/rld.cpp
index 90fb39d..d0848ad 100644
--- a/rtemstoolkit/rld.cpp
+++ b/rtemstoolkit/rld.cpp
@@ -106,9 +106,10 @@ namespace rld
   ltrim (const std::string& s)
   {
 std::string t = s;
-t.erase (t.begin (),
- std::find_if (t.begin (), t.end (),
- std::not1 (std::ptr_fun < int, int > 
(std::isspace;
+auto non_space =
+  std::find_if (t.begin (), t.end (),
+[](unsigned char c) { return !std::isspace (c); });
+t.erase (t.begin (), non_space);
 return t;
   }
 
@@ -116,9 +117,10 @@ namespace rld
   rtrim (const std::string& s)
   {
 std::string t = s;
-t.erase (std::find_if (t.rbegin (), t.rend (),
-   std::not1 (std::ptr_fun < int, int > 
(std::isspace))).base(),
- t.end());
+auto last_space =
+  std::find_if (t.rbegin (), t.rend (),
+[](unsigned char c) { return !std::isspace (c); }).base();
+t.erase (last_space, t.end());
 return t;
   }
 
-- 
2.37.1

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


[PATCH] waf: Fix Python 3.12 escape sequences

2023-11-21 Thread chrisj
From: Chris Johns 

Updates #4968
---
 wscript | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wscript b/wscript
index 69732d4e17..dd7fda7225 100755
--- a/wscript
+++ b/wscript
@@ -125,7 +125,7 @@ class Template(string.Template):
 idpattern = "[_A-Za-z][_A-Za-z0-9:#]*"
 
 
-_VAR_PATTERN = re.compile("\$\{?(" + Template.idpattern + ")\}?$")
+_VAR_PATTERN = re.compile("\\$\\{?(" + Template.idpattern + ")\\}?$")
 
 
 def _is_enabled_op_and(enabled, enabled_by):
-- 
2.37.1

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


[PATCH] python: Updates for Python 3.12

2023-11-20 Thread chrisj
From: Chris Johns 

- Change SafeConfigParser to ConfigParser

- Fix escape sequences in strings

Updates #4968
---
 linkers/wscript   | 2 +-
 misc/wscript  | 2 +-
 rtemstoolkit/configuration.py | 2 +-
 rtemstoolkit/version.py   | 2 +-
 rtemstoolkit/wscript  | 2 +-
 trace/wscript | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/linkers/wscript b/linkers/wscript
index 8591d60..2d2d7f0 100644
--- a/linkers/wscript
+++ b/linkers/wscript
@@ -178,4 +178,4 @@ def build(bld):
 use = modules)
 
 def tags(ctx):
-ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
+ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True)
diff --git a/misc/wscript b/misc/wscript
index 21e7f75..5775dcf 100644
--- a/misc/wscript
+++ b/misc/wscript
@@ -92,4 +92,4 @@ def build(bld):
   'tools/config/rtems-boot.ini')
 
 def tags(ctx):
-ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
+ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True)
diff --git a/rtemstoolkit/configuration.py b/rtemstoolkit/configuration.py
index 1f57de4..ba38104 100644
--- a/rtemstoolkit/configuration.py
+++ b/rtemstoolkit/configuration.py
@@ -57,7 +57,7 @@ class configuration:
 else:
 self.config = configparser.ConfigParser()
 self.ini = None
-self.macro_filter = re.compile('\$\{[^\}]+\}')
+self.macro_filter = re.compile(r'\$\{[^\}]+\}')
 
 def __str__(self):
 if self.ini is None:
diff --git a/rtemstoolkit/version.py b/rtemstoolkit/version.py
index 56cf97f..51188bf 100644
--- a/rtemstoolkit/version.py
+++ b/rtemstoolkit/version.py
@@ -116,7 +116,7 @@ def _load_released_version_config():
 os.path.join('..', 'VERSION'),
 rtems.configuration_file('rtems-version.ini')]:
 if path.exists(path.join(ver)):
-v = configparser.SafeConfigParser()
+v = configparser.ConfigParser()
 try:
 v.read(path.host(ver))
 except Exception as e:
diff --git a/rtemstoolkit/wscript b/rtemstoolkit/wscript
index bd7254b..0a27853 100644
--- a/rtemstoolkit/wscript
+++ b/rtemstoolkit/wscript
@@ -168,7 +168,7 @@ def rebuild(ctx):
 waflib.Options.commands.extend(['clean', 'build'])
 
 def tags(ctx):
-ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
+ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True)
 
 #
 # Libelf module.
diff --git a/trace/wscript b/trace/wscript
index a3dd5d5..0c0e4b4 100644
--- a/trace/wscript
+++ b/trace/wscript
@@ -101,4 +101,4 @@ def build(bld):
 lib = conf['lib'])
 
 def tags(ctx):
-ctx.exec_command('etags $(find . -name \*.[sSch])', shell = True)
+ctx.exec_command('etags $(find . -name \\*.[sSch])', shell = True)
-- 
2.37.1

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


[PATCH v2] sb: Fix Python 3.12 safeConfigParser and invalid escape sequences

2023-11-20 Thread chrisj
From: Chris Johns 

Updates #4968
---
 source-builder/sb/pkgconfig.py | 4 ++--
 source-builder/sb/version.py   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/source-builder/sb/pkgconfig.py b/source-builder/sb/pkgconfig.py
index 198ec80..bfe769f 100755
--- a/source-builder/sb/pkgconfig.py
+++ b/source-builder/sb/pkgconfig.py
@@ -90,7 +90,7 @@ class package(object):
 get_recursion = ['cflags', 'libs']
 no_dup_flags = ['-I', '-l', '-L']
 dual_opts = ['-D', '-U', '-I', '-l', '-L']
-lib_list_splitter = re.compile('[\s,]+')
+lib_list_splitter = re.compile(r'[\s,]+')
 loaded_prefixes = None
 loaded = {}
 
@@ -514,7 +514,7 @@ class package(object):
 return None
 s = ''
 if self.file_:
-mre = re.compile('\$\{[^\}]+\}')
+mre = re.compile(r'\$\{[^\}]+\}')
 s = self.fields[label.lower()]
 expanded = True
 tm = False
diff --git a/source-builder/sb/version.py b/source-builder/sb/version.py
index 4ec7cfa..eb6a17d 100644
--- a/source-builder/sb/version.py
+++ b/source-builder/sb/version.py
@@ -110,7 +110,7 @@ def _load_released_version_config():
 import configparser
 except ImportError:
 import ConfigParser as configparser
-v = configparser.SafeConfigParser()
+v = configparser.ConfigParser()
 try:
 v.read(path.host(ver))
 except Exception as e:
-- 
2.37.1

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


[PATCH] sb: Fix python re warning for invalid escape sequences

2023-11-19 Thread chrisj
From: Chris Johns 

---
 source-builder/sb/pkgconfig.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/source-builder/sb/pkgconfig.py b/source-builder/sb/pkgconfig.py
index 198ec80..bfe769f 100755
--- a/source-builder/sb/pkgconfig.py
+++ b/source-builder/sb/pkgconfig.py
@@ -90,7 +90,7 @@ class package(object):
 get_recursion = ['cflags', 'libs']
 no_dup_flags = ['-I', '-l', '-L']
 dual_opts = ['-D', '-U', '-I', '-l', '-L']
-lib_list_splitter = re.compile('[\s,]+')
+lib_list_splitter = re.compile(r'[\s,]+')
 loaded_prefixes = None
 loaded = {}
 
@@ -514,7 +514,7 @@ class package(object):
 return None
 s = ''
 if self.file_:
-mre = re.compile('\$\{[^\}]+\}')
+mre = re.compile(r'\$\{[^\}]+\}')
 s = self.fields[label.lower()]
 expanded = True
 tm = False
-- 
2.37.1

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


[RSB PATCH 5/5] rtems/net-legacy: Update to latest

2023-10-12 Thread chrisj
From: Chris Johns 

Pick up the test printer header change
---
 rtems/config/tools/rtems-net-legacy-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-net-legacy-6.cfg 
b/rtems/config/tools/rtems-net-legacy-6.cfg
index 559ec01..d5ac842 100644
--- a/rtems/config/tools/rtems-net-legacy-6.cfg
+++ b/rtems/config/tools/rtems-net-legacy-6.cfg
@@ -3,9 +3,9 @@
 #
 
 #  branch: main
-%define rtems_net_version 3a83bcef4bd62fda5c0f9c94dd649fc32d962ab2
+%define rtems_net_version a1e5d91c818d0881293c3c9e7d549816d34f6c77
 %hash sha512 rtems-net-legacy-%{rtems_net_version}.tar.bz2 \
-   
ANUrgSU3YRAnbEM/9wL5R4LrRCcyDYZz9KbRhTxnNYvUPjrfNgO+bM1qEYtJI6qUxvlKZYkVIkeOKxsAtjj1/A==
+   
wM9thMsQQdhtNVBV+FnnE/YS+2r+N7rYLsmCUMs4zQIgQ/bqhg4Sk2nkgse9NBs/gXTeCzzwG3/BTH6eQIYjBg==
 %define rtems_waf_version 68654b4f995382765605dc16917baad4bdbf7f7c
 %hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 \

NAuyFxjfSiQd6VfYZl4fJClywPrLF2fN+GjXHjq3ddceqaBrSeHZ+XpYpU3XTnk2qKICsUSTLV+CskDuWdwqvQ==
-- 
2.31.1

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


[RSB PATCH 3/5] rtems/libbsd: Update to latest

2023-10-12 Thread chrisj
From: Chris Johns 

- Pick up fixes to x86 (i368) bus space usage in kernel DMA
---
 rtems/config/tools/rtems-libbsd-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-libbsd-6.cfg 
b/rtems/config/tools/rtems-libbsd-6.cfg
index c89b5eb..3bb1db7 100644
--- a/rtems/config/tools/rtems-libbsd-6.cfg
+++ b/rtems/config/tools/rtems-libbsd-6.cfg
@@ -3,9 +3,9 @@
 #
 
 #  branch: 6-freebsd-12
-%define rtems_libbsd_version a0d36f58fd7587c14b82044f49735ee5aca152f2
+%define rtems_libbsd_version 1524f95e93a0e0ff85d676d214e0e57cac44e4f5
 %hash sha512 rtems-libbsd-%{rtems_libbsd_version}.tar.bz2 \
-  
E17YUAzCenQVp2t9IeGp0rRBjSr8/O8PCkF50T5gQ5vfyKttlrayqIbbOatcoVrqAN7IY4qpfazRYS4UF+jEKg==
+  
QiNVx1kFPcX9tmkY2mdWO2gb/t32J+AJkXOBAkyjfsaUuvBz43oMeOrpBFJuuix6eTmmukSzAulUCLdqBJlAWQ==
 %define rtems_waf_version ad08908c452c6a9bbb3bf7bbbcc9fc03fe46cc7f
 %hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 \
   
EyuEit0DsAR1gK9Ki1sjl416PFgFe7dcggH3H/hmdAPmMjEIIdX7TVOTDgOIK1Pt0DW6lZ9NcW7O87GZFyy8hg==
-- 
2.31.1

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


[RSB PATCH 4/5] rtems/net-services: Update to latest

2023-10-12 Thread chrisj
From: Chris Johns 

- Updates for the RTEMS test changes
---
 rtems/config/net/net-services-1.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/net/net-services-1.cfg 
b/rtems/config/net/net-services-1.cfg
index bf1bdc8..cf17227 100644
--- a/rtems/config/net/net-services-1.cfg
+++ b/rtems/config/net/net-services-1.cfg
@@ -9,9 +9,9 @@
 #
 # Net Services Version
 #
-%define rtems_net_services_version fe0706060e5687a99c01d155e05d25bc34915ae1
+%define rtems_net_services_version 1651ac768f744725708c4328745665e1e7fa3c26
 %hash sha512 rtems-net-services-%{rtems_net_services_version}.tar.bz2 \
-   
5R/rhW3Supzw7KvDdkVYrWt3y3mxZ8hubwA8HpWtAZosWVlEauGvUpCfh1CthrHKHJ6uW1NpmewoAaZ9T25jsA==
+   
+czrODTpJF+nvMF4TFQFi3qn3k+X/N4JnxHFChrWGXAnaBQayjEkSNObhmETG3qe/ET8dhXHwJs/1A3A7e3uLA==
 
 %define rtems_waf_version 68654b4f995382765605dc16917baad4bdbf7f7c
 %hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 \
-- 
2.31.1

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


[RSB PATCH 1/5] rtems/tools: Update to latest

2023-10-12 Thread chrisj
From: Chris Johns 

Minor fix in rtems-test
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index 9632d5b..859c297 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version eda9325e583f761c53ee3db83124cc77cb4fefb5
+ %define rtems_tools_version 7dc34d2cabf5e9f77b6a9d035b01a75a6f593044
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-   
kdrwOv0iUKYjWud2g/9aSnduIniNWnQKry04zwKEiwlKdg1KnMhGu4b0mpQD2PnsYxGha/ksPEnHLPnahQTarg==
+   
I8F4RkorMvfM9OUuS6hRfAEjxMydtE6sHTjnTzpek854caQAC2eHN2Hqi6HIN/9zXEWA7YeFgNsYdJsBsA5Hcg==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.31.1

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


[RSB PATCH 2/5] rtems/kernel: Update to latest

2023-10-12 Thread chrisj
From: Chris Johns 

- libdl: fix TLS in base image
- bsps/xnandpsu: fixes
- cpukit/jffs2: avoid dead lock
- bsps/imxrt: enable USB and fix PHY clock enable
- bsps/stm32h7: update STM32 H7 HAL
---
 rtems/config/tools/rtems-kernel-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index c9c884f..02b66b6 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 6
 #
 
-%define rtems_kernel_version c1d9dcbbb2a436256b49d9a0c322c78261509264
+%define rtems_kernel_version 25a4dff56ef48dd9eb646558404b55a0555a87f4
 
 %hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-   
dH0PgnSQ1k6pTCP/NhIgWzhDjHqFuLI03RBhbjaRFvRs5CUbZIG+x8opTb13czga/cUhOBd9JC7x557FkX0seA==
+   
CKj52ct4Bz3XrktSajwH1NsNrFX06VCEpmMHmeNwsseR+TWan9Pxsr8s/n2u8CdhjKfxztbrVB34NN8TCq8lkQ==
 #
 # The RTEMS build instructions.
 #
-- 
2.31.1

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


[rtems-tools PATCH v2] tester/tftp: Add a session timeout

2023-10-07 Thread chrisj
From: Chris Johns 

- Fix listener done state

- Finish open with the state as finished

Closes #4959
---
 tester/rt/config.py | 42 +-
 tester/rt/report.py |  2 +-
 tester/rt/test.py   |  1 +
 tester/rt/tftp.py   | 44 +++
 tester/rt/tftpserver.py | 57 -
 5 files changed, 110 insertions(+), 36 deletions(-)

diff --git a/tester/rt/config.py b/tester/rt/config.py
index 3b12c6c..139e1fa 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -284,7 +284,12 @@ class file(config.file):
 raise error.general('invalid %tftp port')
 self.kill_on_end = True
 if not self.opts.dry_run():
+if self.defined('session_timeout'):
+session_timeout = int(self.expand('%{session_timeout}'))
+else:
+session_timeout = 120
 self.process = tester.rt.tftp.tftp(bsp_arch, bsp,
+   session_timeout = 
session_timeout,
trace = self.exe_trace('tftp'))
 if not self.in_error:
 if self.console:
@@ -415,28 +420,41 @@ class file(config.file):
 reset_target = True
 else:
 reset_target = False
-if self.target_start_regx is not None:
-if self.target_start_regx.match(text):
-if self.test_started:
-self._capture_console('target start detected')
+if ('*** TIMEOUT TIMEOUT' in text or \
+'*** TEST TOO LONG' in text) and \
+self.defined('target_reset_on_timeout'):
+reset_target = True
+restart = \
+(self.target_start_regx is not None and self.target_start_regx 
is not None)
+if restart:
+if self.test_started:
+self._capture_console('target start detected')
+ok_to_kill = True
+else:
+self.restarts += 1
+if self.restarts > self.max_restarts:
+self._capture_console('target restart maximum count 
reached')
 ok_to_kill = True
 else:
-self.restarts += 1
-if self.restarts > self.max_restarts:
-self._capture_console('target restart maximum 
count reached')
-ok_to_kill = True
-else:
-self.process.target_restart(self.test_started)
+self.process.target_restart(self.test_started)
 if not reset_target and self.target_reset_regx is not None:
 if self.target_reset_regx.match(text):
 self._capture_console('target reset condition detected')
 self._target_command('reset')
 self.process.target_reset(self.test_started)
 if self.kill_on_end:
-if not ok_to_kill and '*** END OF TEST ' in text:
+if not ok_to_kill and \
+   ('*** END OF TEST ' in text or \
+'*** FATAL ***' in text or \
+'*** TIMEOUT TIMEOUT' in text or \
+'*** TEST TOO LONG' in text):
 self._capture_console('test end: %s' % (self.test_label))
 if self.test_label is not None:
-ok_to_kill = '*** END OF TEST %s ***' % 
(self.test_label) in text
+ok_to_kill = \
+'*** END OF TEST %s ***' % (self.test_label) in 
text or \
+'*** FATAL ***' in text or \
+'*** TIMEOUT TIMEOUT' in text or \
+'*** TEST TOO LONG' in text
 self.process.target_end()
 text = [(self.console_prefix, l) for l in text.replace(chr(13), 
'').splitlines()]
 if self.output is not None:
diff --git a/tester/rt/report.py b/tester/rt/report.py
index a688dc8..642ae73 100644
--- a/tester/rt/report.py
+++ b/tester/rt/report.py
@@ -327,7 +327,7 @@ class report(object):
 for name in results:
 if results[name]['result'] == state:
 l += [' %s' % (path.basename(name))]
-return l
+return sorted(l)
 l = []
 if self.failed:
 l += ['Failures:']
diff --git a/tester/rt/test.py b/tester/rt/test.py
index 0e22002..db5939b 100644
--- a/tester/rt/test.py
+++ b/tester/rt/test.py
@@ -151,6 +151,7 @@ class test_run(object):
 name = 'test[%s]' % path.basename(self.executable)
 self.thread = threading.Thread(target = self.runner,
name = name)
+self.thread.daemon = True
 sel

RTEMS Tester TFTP Timeout Fixes

2023-10-07 Thread chrisj
Hi,

This is v2 of the fixes for timouts for TFTP testing. I am testing
i386/pc686 on hardware using grub to PXE boot the executable. This
configuration is different to uboot because a failure to load the
executable stops loading and this hangs the tester. A uboot target
keeps attempting TFTP loads and that recovers while grub does not.
The fixes here add two new user variables:

 session_timeout = 20
 target_reset_on_timeout = yes

The session_timeout is a new timeout for the TFTP session to
timeout if a client does not happen. The second will cause
a reset on a timeout. The timeouts are a console timeout or a test
too long timeout.

Chris

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


[rtems-tools PATCH] tester/tftp: Add a session timeout

2023-10-07 Thread chrisj
From: Chris Johns 

- Fix listener done state

- Finish open with the state as finished

Closes #4959
---
 tester/rt/config.py | 38 ++-
 tester/rt/report.py |  2 +-
 tester/rt/tftp.py   | 41 ++---
 tester/rt/tftpserver.py | 57 -
 4 files changed, 103 insertions(+), 35 deletions(-)

diff --git a/tester/rt/config.py b/tester/rt/config.py
index 3b12c6c..2d3de2f 100644
--- a/tester/rt/config.py
+++ b/tester/rt/config.py
@@ -284,7 +284,12 @@ class file(config.file):
 raise error.general('invalid %tftp port')
 self.kill_on_end = True
 if not self.opts.dry_run():
+if self.defined('session_timeout'):
+session_timeout = int(self.expand('%{session_timeout}'))
+else:
+session_timeout = 120
 self.process = tester.rt.tftp.tftp(bsp_arch, bsp,
+   session_timeout = 
session_timeout,
trace = self.exe_trace('tftp'))
 if not self.in_error:
 if self.console:
@@ -415,28 +420,37 @@ class file(config.file):
 reset_target = True
 else:
 reset_target = False
-if self.target_start_regx is not None:
-if self.target_start_regx.match(text):
-if self.test_started:
-self._capture_console('target start detected')
+if '*** TIMEOUT TIMEOUT' in text and 
self.defined('target_reset_on_timeout'):
+reset_target = True
+restart = \
+(self.target_start_regx is not None and self.target_start_regx 
is not None)
+if restart:
+if self.test_started:
+self._capture_console('target start detected')
+ok_to_kill = True
+else:
+self.restarts += 1
+if self.restarts > self.max_restarts:
+self._capture_console('target restart maximum count 
reached')
 ok_to_kill = True
 else:
-self.restarts += 1
-if self.restarts > self.max_restarts:
-self._capture_console('target restart maximum 
count reached')
-ok_to_kill = True
-else:
-self.process.target_restart(self.test_started)
+self.process.target_restart(self.test_started)
 if not reset_target and self.target_reset_regx is not None:
 if self.target_reset_regx.match(text):
 self._capture_console('target reset condition detected')
 self._target_command('reset')
 self.process.target_reset(self.test_started)
 if self.kill_on_end:
-if not ok_to_kill and '*** END OF TEST ' in text:
+if not ok_to_kill and \
+   ('*** END OF TEST ' in text or \
+'*** FATAL ***' in text or \
+'*** TIMEOUT TIMEOUT' in text):
 self._capture_console('test end: %s' % (self.test_label))
 if self.test_label is not None:
-ok_to_kill = '*** END OF TEST %s ***' % 
(self.test_label) in text
+ok_to_kill = \
+'*** END OF TEST %s ***' % (self.test_label) in 
text or \
+'*** FATAL ***' in text or \
+'*** TIMEOUT TIMEOUT' in text
 self.process.target_end()
 text = [(self.console_prefix, l) for l in text.replace(chr(13), 
'').splitlines()]
 if self.output is not None:
diff --git a/tester/rt/report.py b/tester/rt/report.py
index a688dc8..642ae73 100644
--- a/tester/rt/report.py
+++ b/tester/rt/report.py
@@ -327,7 +327,7 @@ class report(object):
 for name in results:
 if results[name]['result'] == state:
 l += [' %s' % (path.basename(name))]
-return l
+return sorted(l)
 l = []
 if self.failed:
 l += ['Failures:']
diff --git a/tester/rt/tftp.py b/tester/rt/tftp.py
index 5a1c7b7..d12d8e6 100644
--- a/tester/rt/tftp.py
+++ b/tester/rt/tftp.py
@@ -49,7 +49,8 @@ import tester.rt.tftpserver
 class tftp(object):
 '''RTEMS Testing TFTP base.'''
 
-def __init__(self, bsp_arch, bsp, trace = False):
+def __init__(self, bsp_arch, bsp, session_timeout, trace = False):
+self.session_timeout = session_timeout
 self.trace = trace
 self.lock_trace = False
 self.lock = threading.RLock()
@@ -60,7 +61,7 @@ class tftp(object):
 def __del__(self):
 self.kill()
 
-def _init(self):
+ 

[net-legacy PATCH] tests: Add header for RTEMS test printer

2023-10-04 Thread chrisj
From: Chris Johns 

---
 libtest/testbeginend.c | 1 +
 libtest/testwrappers.c | 1 +
 testsuites/loopback/init.c | 1 +
 testsuites/pppd/init.c | 4 +++-
 4 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/libtest/testbeginend.c b/libtest/testbeginend.c
index 89b2468..83f1d3c 100644
--- a/libtest/testbeginend.c
+++ b/libtest/testbeginend.c
@@ -19,6 +19,7 @@
 #endif
 
 #include 
+#include 
 #include 
 #include 
 
diff --git a/libtest/testwrappers.c b/libtest/testwrappers.c
index 9679f75..052ebf8 100644
--- a/libtest/testwrappers.c
+++ b/libtest/testwrappers.c
@@ -11,6 +11,7 @@
 #endif
 
 #include 
+#include 
 
 int __wrap_printf(const char* format, ...);
 int __wrap_puts(const char *str);
diff --git a/testsuites/loopback/init.c b/testsuites/loopback/init.c
index 891225c..d2aafcc 100644
--- a/testsuites/loopback/init.c
+++ b/testsuites/loopback/init.c
@@ -8,6 +8,7 @@
 #include "config.h"
 #endif
 
+#include 
 #include 
 
 const char rtems_test_name[] = "LOOPBACK";
diff --git a/testsuites/pppd/init.c b/testsuites/pppd/init.c
index 95e0d53..12a57e0 100644
--- a/testsuites/pppd/init.c
+++ b/testsuites/pppd/init.c
@@ -21,9 +21,11 @@
 #include 
 #include 
 #include 
-#include "netconfig.h"
+#include 
 #include 
 
+#include "netconfig.h"
+
 const char rtems_test_name[] = "PPPD";
 
 static void notification(int fd, int seconds_remaining, void *arg)
-- 
2.37.1

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


[net-services PATCH] tests/ntp: Update to the new test printer header

2023-10-03 Thread chrisj
From: Chris Johns 

---
 testsuites/ntp01/test_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/testsuites/ntp01/test_main.c b/testsuites/ntp01/test_main.c
index 6a744c8..4824192 100644
--- a/testsuites/ntp01/test_main.c
+++ b/testsuites/ntp01/test_main.c
@@ -38,6 +38,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
-- 
2.37.1

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


[libbsd/6-freebsd-12 PATCH] i386/pc686: Fix kernel bus DMA for the PC686 BSP

2023-10-03 Thread chrisj
From: Chris Johns 

The x86 provides it own bus space support. Use the generic
bus space calls. This however requires the BUS_SPACE_MEM tag
be provided for all architectures. Make the generic value
match the x86 value.
---
 rtemsbsd/include/machine/bus.h| 9 +
 rtemsbsd/rtems/rtems-kernel-bus-dma.c | 6 +-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/rtemsbsd/include/machine/bus.h b/rtemsbsd/include/machine/bus.h
index a0c3d63a..8a61a7d0 100644
--- a/rtemsbsd/include/machine/bus.h
+++ b/rtemsbsd/include/machine/bus.h
@@ -167,6 +167,15 @@
 
 #endif /* BSP_HAS_PC_PCI */
 
+/*
+ * Provide a memory tag for the DMA bus interface
+ */
+#ifdef BSP_BUS_SPACE_MEM
+#define BUS_SPACE_MEM BSP_BUS_SPACE_MEM
+#else
+#define BUS_SPACE_MEM 1
+#endif
+
 /*
  * Bus address alignment.
  */
diff --git a/rtemsbsd/rtems/rtems-kernel-bus-dma.c 
b/rtemsbsd/rtems/rtems-kernel-bus-dma.c
index 1d28f62c..9c9194b0 100644
--- a/rtemsbsd/rtems/rtems-kernel-bus-dma.c
+++ b/rtemsbsd/rtems/rtems-kernel-bus-dma.c
@@ -63,6 +63,10 @@
 #include 
 #endif
 
+#ifdef X86_BUS_SPACE_MEM
+#define BUS_SPACE_MEM X86_BUS_SPACE_MEM
+#endif
+
 /*
  * Convenience function for manipulating driver locks from busdma (during
  * busdma_swi, for example).  Drivers that don't provide their own locks
@@ -261,7 +265,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int 
flags,
unsigned char* mem = *vaddr;
int len = dmat->maxsize;
while (len-- > 0) {
-   bsp_bus_space_write_1(mem, 0);
+   bus_space_write_1(BUS_SPACE_MEM, mem, 0, 0);
mem++;
}
}
-- 
2.37.1

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


[PATCH] bsp/i386/pc686: Clean up warnings

2023-10-03 Thread chrisj
From: Chris Johns 

---
 bsps/i386/include/bsp/irq.h   |  2 ++
 bsps/i386/pc386/console/exar17d15x.c  |  6 +++---
 bsps/i386/pc386/console/fb_vesa_rm.c  | 19 +++
 bsps/i386/pc386/console/i386-stub.c   |  2 +-
 bsps/i386/pc386/console/outch.c   | 14 ++
 bsps/i386/pc386/console/rtd316.c  |  4 ++--
 bsps/i386/pc386/console/tty_drv.c |  4 ++--
 bsps/i386/pc386/console/uart_bus_pci.c| 16 
 bsps/i386/pc386/console/vgacons.c |  8 ++--
 bsps/i386/pc386/include/bsp/rtd316.h  |  4 ++--
 bsps/i386/pc386/include/tm27.h|  2 +-
 bsps/i386/pc386/start/realmode_int.c  |  9 +
 .../score/cpu/i386/include/rtems/score/cpu.h  |  8 
 13 files changed, 65 insertions(+), 33 deletions(-)

diff --git a/bsps/i386/include/bsp/irq.h b/bsps/i386/include/bsp/irq.h
index c5ef954142..4ec25b0c5a 100644
--- a/bsps/i386/include/bsp/irq.h
+++ b/bsps/i386/include/bsp/irq.h
@@ -42,7 +42,9 @@ extern "C" {
 
 #include 
 #include 
+#ifndef BSP_SHARED_HANDLER_SUPPORT
 #define BSP_SHARED_HANDLER_SUPPORT  1
+#endif
 #include 
 #include 
 
diff --git a/bsps/i386/pc386/console/exar17d15x.c 
b/bsps/i386/pc386/console/exar17d15x.c
index 1e6cb6fbeb..787e9a24d0 100644
--- a/bsps/i386/pc386/console/exar17d15x.c
+++ b/bsps/i386/pc386/console/exar17d15x.c
@@ -94,7 +94,7 @@ typedef struct {
 /*
  *  Register Access Routines
  */
-static uint8_t xr17d15x_get_register(uint32_t addr, uint8_t i)
+static uint8_t xr17d15x_get_register(uintptr_t addr, uint8_t i)
 {
   uint8_t  val = 0;
   volatile uint8_t *reg = (volatile uint8_t *)(addr + i);
@@ -104,7 +104,7 @@ static uint8_t xr17d15x_get_register(uint32_t addr, uint8_t 
i)
   return val;
 }
 
-static void xr17d15x_set_register(uint32_t addr, uint8_t i, uint8_t val)
+static void xr17d15x_set_register(uintptr_t addr, uint8_t i, uint8_t val)
 {
   volatile uint8_t *reg = (volatile uint8_t *)(addr + i);
 
@@ -187,7 +187,7 @@ rtems_device_driver exar17d15x_initialize(
 printk(
   "Found Exar 17D15x %d at 0x%08lx IRQ %d with %d ports\n",
   instance,
-  conf[instance].base,
+  (uintptr_t) conf[instance].base,
   conf[instance].irq,
   conf[instance].ports
 );
diff --git a/bsps/i386/pc386/console/fb_vesa_rm.c 
b/bsps/i386/pc386/console/fb_vesa_rm.c
index 3263bc262b..d14aa826d6 100644
--- a/bsps/i386/pc386/console/fb_vesa_rm.c
+++ b/bsps/i386/pc386/console/fb_vesa_rm.c
@@ -63,6 +63,17 @@
 
 #define FB_VESA_NAME"FB_VESA_RM"
 
+/*
+ * GCC complains that access to packed data may not be aligned and
+ * fair enough. The warning is:
+ *
+ *   warning: taking address of packed member of 'struct ' may
+ *   result in an unaligned pointer value [-Waddress-of-packed-member]
+ *
+ * Disable the warning.
+ */
+#pragma GCC diagnostic ignored "-Waddress-of-packed-member"
+
 /**
  * @brief Allows to enable initialization of VESA real mode driver from
  * an application by setting the value of this variable to non null value in
@@ -788,7 +799,7 @@ void vesa_realmode_bootup_init(void)
 (vbe_ret_val>>8)!=VBE_callSuccessful)
 {
 printk(FB_VESA_NAME " Cannot get mode info anymore. ax=0x%lx\n",
-vbe_ret_val);
+   (uintptr_t) vbe_ret_val);
 }
 
 fb_var.xres = mib->XResolution;
@@ -970,9 +981,9 @@ frame_buffer_control(
 {
   rtems_libio_ioctl_args_t *args = arg;
 
-  printk( FB_VESA_NAME " ioctl called, cmd=%" PRIx32 "\n", args->command  );
-printk("fbxres %lu, fbyres %lu\n", fb_var.xres, fb_var.yres);
-printk("fbbpp %lu\n", fb_var.bits_per_pixel);
+  printk( FB_VESA_NAME " ioctl called, cmd=%lx\n", (uintptr_t) args->command  
);
+  printk("fbxres %d, fbyres %d\n", (int) fb_var.xres, (int) fb_var.yres);
+  printk("fbbpp %d\n", (int) fb_var.bits_per_pixel);
 
   switch (args->command)
   {
diff --git a/bsps/i386/pc386/console/i386-stub.c 
b/bsps/i386/pc386/console/i386-stub.c
index 1eff100e9e..4b237e0a34 100644
--- a/bsps/i386/pc386/console/i386-stub.c
+++ b/bsps/i386/pc386/console/i386-stub.c
@@ -502,7 +502,7 @@ getpacket (char *buffer)
   count = 0;
 
   /* now, read until a # or end of buffer is found */
-  while (count < BUFMAX)
+  while (count < (BUFMAX - 1))
{
  ch = getDebugChar () & 0x7f;
  if (ch == '#')
diff --git a/bsps/i386/pc386/console/outch.c b/bsps/i386/pc386/console/outch.c
index 90ffedf250..83dbcdbcdf 100644
--- a/bsps/i386/pc386/console/outch.c
+++ b/bsps/i386/pc386/console/outch.c
@@ -283,7 +283,13 @@ static int escaped = 0;
 void
 _IBMPC_initVideo(void)
 {
-unsigned char* pt = (unsigned char*) (VIDEO_MODE_ADDR);
+/*
+ * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99578#c16
+ */
+unsigned char* volatile pt = (unsigned char*) (VIDEO_MODE_ADDR);
+unsigned short* volatile crt_base = (unsigned short*) 
DISPLAY_CRT_BASE_IO_ADDR;
+uint8_t* volatile nb_max_row = (ui

[RSB PATCH] rtems/tools: Execute use of shlex.join fix for python < 3.8

2023-08-30 Thread chrisj
From: Chris Johns 

Updates #4951
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index b360f7e..9632d5b 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version 3ea0c249346fda427bf0d3c169aa3e7c2a521df8
+ %define rtems_tools_version eda9325e583f761c53ee3db83124cc77cb4fefb5
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-   
+wrMxGHJp5cd/hpgoGwTH65IvwZQsAWOb8JNmDZKdFqUbhUuUYq1zK1p5NJnvCUkHudxgDmghAe/5kaFE5DJ4w==
+   
kdrwOv0iUKYjWud2g/9aSnduIniNWnQKry04zwKEiwlKdg1KnMhGu4b0mpQD2PnsYxGha/ksPEnHLPnahQTarg==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.37.1

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


[rtems-tools PATCH] rtemstoolkit: Provide a shlex.join for python 3.8 and earlier

2023-08-29 Thread chrisj
From: Chris Johns 

---
 rtemstoolkit/execute.py | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index d183b14..31d3a8a 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -125,6 +125,14 @@ class execute(object):
 self.timing_out = False
 self.proc = None
 
+@staticmethod
+def _shlex_join(elements):
+try:
+return shlex.join(elements)
+except AttributeError:
+# Python older than 3.8 does not have shlex.join
+return ' '.join(elements)
+
 def capture(self, proc, command = 'pipe', timeout = None):
 """Create 3 threads to read stdout and stderr and send to the output 
handler
 and call an input handler is provided. Based on the 'communicate' code
@@ -360,11 +368,11 @@ class execute(object):
 if not shell and isinstance(command, str):
 command = shlex.split(command)
 if shell and isinstance(command, list):
-command = shlex.join(command)
+command = execute._shlex_join(command)
 if self.shell_exe:
 command = self.shell_exe + ' ' + command
 if isinstance(command, list):
-cs = shlex.join(command)
+cs = execute._shlex_join(command)
 else:
 cs = command
 what = 'spawn'
-- 
2.37.1

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


[rtems-tools] Fix shlex.join on python 3.8 and earlier

2023-08-29 Thread chrisj
Hi Frabnk and Joel,

Can you please test this patch and let me know if the issue has been
fixed?

Thanks
Chris


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


[RSB PATCH] rtems/tools: Shell execute fixes

2023-08-28 Thread chrisj
From: Chris Johns 

Updates #4951
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index 6eed755..b360f7e 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version 349bbd96543365e830e5ef5e851765e4b742a8a4
+ %define rtems_tools_version 3ea0c249346fda427bf0d3c169aa3e7c2a521df8
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-   
qb5EC4gWfahYLPliYk+mNRsgzaDuouqiRq6GURb8v0Pk4J6Uo6IiKrB6dPvqVPO+wh9Omb1xCs+86W/+fj8sZg==
+   
+wrMxGHJp5cd/hpgoGwTH65IvwZQsAWOb8JNmDZKdFqUbhUuUYq1zK1p5NJnvCUkHudxgDmghAe/5kaFE5DJ4w==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.37.1

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


[rtems-tools PATCH] rtemstoolkit: Fix shell execution

2023-08-27 Thread chrisj
From: Chris Johns 

The fixes to parse the command along with the pipe options broke
a simple shell command such as '/sbin/sysctl hw.ncpu' on FreeBSD.
This patch fixes the shell command by passing a string for the
various options.

The unit test has been updated to catch errors and report them.
---
 rtemstoolkit/execute.py | 80 ++---
 1 file changed, 51 insertions(+), 29 deletions(-)

diff --git a/rtemstoolkit/execute.py b/rtemstoolkit/execute.py
index 3b7dcb0..d183b14 100755
--- a/rtemstoolkit/execute.py
+++ b/rtemstoolkit/execute.py
@@ -356,10 +356,17 @@ class execute(object):
 a string."""
 if self.output is None:
 raise error.general('capture needs an output handler')
-cs = command
-if type(command) is list:
-def add(x, y): return x + ' ' + str(y)
-cs = functools.reduce(add, command, '')[1:]
+# If a string split and not a shell command split
+if not shell and isinstance(command, str):
+command = shlex.split(command)
+if shell and isinstance(command, list):
+command = shlex.join(command)
+if self.shell_exe:
+command = self.shell_exe + ' ' + command
+if isinstance(command, list):
+cs = shlex.join(command)
+else:
+cs = command
 what = 'spawn'
 if shell:
 what = 'shell'
@@ -367,9 +374,6 @@ class execute(object):
 if self.verbose:
 log.output(what + ': ' + cs)
 log.trace('exe: %s' % (cs))
-if shell and self.shell_exe:
-command = arg_list(command)
-command[:0] = self.shell_exe
 if not stdin and self.input:
 stdin = subprocess.PIPE
 if not stdout:
@@ -390,21 +394,21 @@ class execute(object):
 r, e = os.path.splitext(command[0])
 if e not in ['.exe', '.com', '.bat']:
 command[0] = command[0] + '.exe'
-# If a string split
-if isinstance(command, str):
-command = shlex.split(command)
-# See if there is a pipe operator in the command. If present
-# split the commands by the pipe and run them with the pipe.
-# if no pipe it is the normal stdin and stdout
 pipe_commands = []
-current_command = []
-for cmd in command:
-if cmd == '|':
-pipe_commands.append(current_command)
-current_command = []
-else:
-current_command.append(cmd)
-pipe_commands.append(current_command)
+if shell:
+pipe_commands.append(command)
+else:
+# See if there is a pipe operator in the command. If present
+# split the commands by the pipe and run them with the pipe.
+# if no pipe it is the normal stdin and stdout
+current_command = []
+for cmd in command:
+if cmd == '|':
+pipe_commands.append(current_command)
+current_command = []
+else:
+current_command.append(cmd)
+pipe_commands.append(current_command)
 proc = None
 if len(pipe_commands) == 1:
 cmd = pipe_commands[0]
@@ -600,16 +604,28 @@ class capture_execution(execute):
 if __name__ == "__main__":
 def run_tests(e, commands, use_shell):
 for c in commands['shell']:
-e.shell(c)
+ec, out = e.shell(c)
+if ec != 0:
+  raise RuntimeError('ec = {}'.format(ec))
+for c in commands['error']:
+ec, out = e.shell(c)
+if ec == 0:
+  raise RuntimeError('ec = {}'.format(ec))
 for c in commands['spawn']:
-e.spawn(c)
+ec, out = e.spawn(c)
+if ec != 0:
+  raise RuntimeError('ec = {}'.format(ec))
 for c in commands['cmd']:
 if type(c) is str:
-e.command(c, shell = use_shell)
+ec, out = e.command(c, shell = use_shell)
 else:
-e.command(c[0], c[1], shell = use_shell)
+ec, out = e.command(c[0], c[1], shell = use_shell)
+if ec != 0:
+  raise RuntimeError('ec = {}'.format(ec))
 for c in commands['csubsts']:
-e.command_subst(c[0], c[1], shell = use_shell)
+ec, out = e.command_subst(c[0], c[1], shell = use_shell)
+if ec != 0:
+  raise RuntimeError('ec = {}'.format(ec))
 ec, proc = e.command(commands['pipe'][0], commands['pipe'][1],
  capture = False, stdin = subprocess.PIPE)
 if ec == 0:
@@ -623,11 +639,15 @@ if __name__ == "__main__":
 proc.stdi

[PATCH 2/2] cpukit/libdl: Fix incorrect operator precedence access the name

2023-08-27 Thread chrisj
From: Chris Johns 

Coverity Issue: CID 1442635 Out-of-bounds access
---
 cpukit/libdl/rtl-archive.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/libdl/rtl-archive.c b/cpukit/libdl/rtl-archive.c
index f916336f7c..4a6d2cbf0b 100644
--- a/cpukit/libdl/rtl-archive.c
+++ b/cpukit/libdl/rtl-archive.c
@@ -1174,6 +1174,7 @@ rtems_rtl_obj_archive_find_obj (int 
fd,
  */
 if (header[0] == '/')
 {
+  const char* name_ = *name;
   off_t extended_off;
 
   switch (header[1])
@@ -1190,7 +1191,7 @@ rtems_rtl_obj_archive_find_obj (int 
fd,
* return the result.
*/
   *extended_file_names = *ooffset + RTEMS_RTL_AR_FHDR_SIZE;
-  if (*name[0] == '/' && *name[1] == '/')
+  if (name_[0] == '/' && name_[1] == '/')
   {
 *ooffset = *ooffset + RTEMS_RTL_AR_FHDR_SIZE;
 return true;
-- 
2.37.1

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


[PATCH 1/2] cpukit/libdl: Correctly account for section alignments

2023-08-27 Thread chrisj
From: Chris Johns 

- Add the section alignment to the size as the allocator may not
  provide correctly aligned memory

- Only include symbols in the section when locating symbols. The
  powerpc was incorrectly adding SDATA BSS symbols to the BSS offset
  overrunning the section

Closes #4950
---
 cpukit/libdl/rtl-obj.c | 31 --
 testsuites/libtests/dl07/dl-load.c |  1 +
 2 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/cpukit/libdl/rtl-obj.c b/cpukit/libdl/rtl-obj.c
index a35fbf9e8d..c99e9f703f 100644
--- a/cpukit/libdl/rtl-obj.c
+++ b/cpukit/libdl/rtl-obj.c
@@ -1032,6 +1032,7 @@ rtems_rtl_obj_sections_locate (uint32_tmask,
 {
   base_offset = rtems_rtl_obj_align (base_offset, sect->alignment);
   sect->base = base + base_offset;
+  base_offset += sect->size;
 }
 
 if (rtems_rtl_trace (RTEMS_RTL_TRACE_LOAD_SECT))
@@ -1040,9 +1041,6 @@ rtems_rtl_obj_sections_locate (uint32_tmask,
   order, sect->name, sect->base, sect->size,
   sect->flags, sect->alignment, sect->link);
 
-if (sect->base)
-  base_offset += sect->size;
-
 ++order;
 
 node = rtems_chain_first (sections);
@@ -1064,23 +1062,18 @@ rtems_rtl_obj_set_sizes (rtems_rtl_obj* obj)
   size_t data_size;
   size_t bss_size;
 
-  text_size  = rtems_rtl_obj_text_size (obj);
+  /*
+   * The allocator may not align memory to the required boundary. Add
+   * the alignment size to the size allocated.
+   */
+  text_size  = rtems_rtl_obj_text_size (obj) + rtems_rtl_obj_text_alignment 
(obj);
   tramp_size = rtems_rtl_obj_tramp_size (obj);
-
   if (tramp_size != 0)
-  {
-text_size += rtems_rtl_obj_tramp_alignment (obj);
-tramp_size += rtems_rtl_obj_const_alignment (obj);
-  }
-  else
-  {
-text_size += rtems_rtl_obj_const_alignment (obj);
-  }
-
-  const_size = rtems_rtl_obj_const_size (obj) + rtems_rtl_obj_eh_alignment 
(obj);
-  eh_size= rtems_rtl_obj_eh_size (obj) + rtems_rtl_obj_data_alignment 
(obj);
-  data_size  = rtems_rtl_obj_data_size (obj) + rtems_rtl_obj_bss_alignment 
(obj);
-  bss_size   = rtems_rtl_obj_bss_size (obj);
+tramp_size += rtems_rtl_obj_tramp_alignment (obj);
+  const_size = rtems_rtl_obj_const_size (obj) + rtems_rtl_obj_const_alignment 
(obj);
+  eh_size= rtems_rtl_obj_eh_size (obj) + rtems_rtl_obj_eh_alignment (obj);
+  data_size  = rtems_rtl_obj_data_size (obj) + rtems_rtl_obj_data_alignment 
(obj);
+  bss_size   = rtems_rtl_obj_bss_size (obj) + rtems_rtl_obj_bss_alignment 
(obj);
 
   /*
* Set the sizes held in the object data. We need this for a fast reference.
@@ -1098,7 +1091,7 @@ rtems_rtl_obj_set_sizes (rtems_rtl_obj* obj)
 static void
 rtems_rtl_obj_print_sizes (rtems_rtl_obj* obj, const char* label)
 {
-if (rtems_rtl_trace (RTEMS_RTL_TRACE_LOAD_SECT))
+  if (rtems_rtl_trace (RTEMS_RTL_TRACE_LOAD_SECT))
   {
 printf ("rtl: %s sect: text  - b:%p s:%zi a:%" PRIu32 "\n",
 label, obj->text_base, obj->text_size, 
rtems_rtl_obj_text_alignment (obj));
diff --git a/testsuites/libtests/dl07/dl-load.c 
b/testsuites/libtests/dl07/dl-load.c
index 58e3e06f78..2946120ca6 100644
--- a/testsuites/libtests/dl07/dl-load.c
+++ b/testsuites/libtests/dl07/dl-load.c
@@ -32,6 +32,7 @@
   RTEMS_RTL_TRACE_WARNING | \
   RTEMS_RTL_TRACE_LOAD | \
   RTEMS_RTL_TRACE_UNLOAD | \
+  RTEMS_RTL_TRACE_LOAD_SECT | \
   RTEMS_RTL_TRACE_SYMBOL | \
   RTEMS_RTL_TRACE_RELOC | \
   RTEMS_RTL_TRACE_ALLOCATOR | \
-- 
2.37.1

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


[PATCH 2/2] libdl: Realloc text memory if there are trampolines

2023-08-26 Thread chrisj
From: Chris Johns 

- Add resize to the allocator interface

- Rework the trampoline variables in the obj struct
  to make better sense of what is happening

Closes #4944
---
 cpukit/include/rtems/rtl/rtl-allocator.h |  46 +-
 cpukit/include/rtems/rtl/rtl-obj.h   | 199 --
 cpukit/libdl/rtl-alloc-heap.c|   5 +-
 cpukit/libdl/rtl-allocator.c | 135 ---
 cpukit/libdl/rtl-elf.c   |  35 ++--
 cpukit/libdl/rtl-mdreloc-aarch64.c   |  15 +-
 cpukit/libdl/rtl-mdreloc-arm.c   |   6 +
 cpukit/libdl/rtl-mdreloc-bfin.c  |   6 +
 cpukit/libdl/rtl-mdreloc-i386.c  |   6 +
 cpukit/libdl/rtl-mdreloc-lm32.c  |   6 +
 cpukit/libdl/rtl-mdreloc-m68k.c  |   6 +
 cpukit/libdl/rtl-mdreloc-mips.c  |   6 +
 cpukit/libdl/rtl-mdreloc-moxie.c |   6 +
 cpukit/libdl/rtl-mdreloc-powerpc.c   |   6 +
 cpukit/libdl/rtl-mdreloc-riscv.c |   6 +
 cpukit/libdl/rtl-mdreloc-sparc.c |   6 +
 cpukit/libdl/rtl-mdreloc-v850.c  |   6 +
 cpukit/libdl/rtl-obj.c   | 202 +++
 cpukit/libdl/rtl-shell.c |   2 +-
 testsuites/libtests/dl09/dl-load.c   |  16 +-
 20 files changed, 525 insertions(+), 196 deletions(-)

diff --git a/cpukit/include/rtems/rtl/rtl-allocator.h 
b/cpukit/include/rtems/rtl/rtl-allocator.h
index 8ffaf58c3c..7d291c65f4 100644
--- a/cpukit/include/rtems/rtl/rtl-allocator.h
+++ b/cpukit/include/rtems/rtl/rtl-allocator.h
@@ -1,7 +1,7 @@
 /* SPDX-License-Identifier: BSD-2-Clause */
 
 /*
- *  COPYRIGHT (c) 2012, 2018 Chris Johns 
+ *  COPYRIGHT (c) 2012, 2018, 2023 Chris Johns 
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -69,6 +69,7 @@ typedef enum rtems_rtl_alloc_tags rtems_rtl_alloc_tag;
 enum rtems_rtl_alloc_cmd {
   RTEMS_RTL_ALLOC_NEW,/**< Allocate new memory. */
   RTEMS_RTL_ALLOC_DEL,/**< Delete allocated memory. */
+  RTEMS_RTL_ALLOC_RESIZE, /**< Resize allocated memory. */
   RTEMS_RTL_ALLOC_LOCK,   /**< Lock the allocator. */
   RTEMS_RTL_ALLOC_UNLOCK, /**< Unlock the allocator. */
   RTEMS_RTL_ALLOC_WR_ENABLE,  /**< Enable writes to the memory. */
@@ -142,6 +143,25 @@ void* rtems_rtl_alloc_new (rtems_rtl_alloc_tag tag, size_t 
size, bool zero);
  */
 void rtems_rtl_alloc_del (rtems_rtl_alloc_tag tag, void* address);
 
+/**
+ * The Runtime Loader allocator resize resizes allocated memory.
+ *
+ * This call resizes a previously allocated block of memory. If the
+ * provided address cannot be resized it is deleted and a new block is
+ * allocated and the contents of the existing memory is copied.
+ *
+ *
+ * @param tag The type of allocation request.
+ * @param address The memory address to resize. A NULL is ignored.
+ * @param size The size of the allocation.
+ * @param zero If true the memory is cleared.
+ * @return void* The memory address or NULL is not memory available.
+ */
+void* rtems_rtl_alloc_resize (rtems_rtl_alloc_tag tag,
+  void*   address,
+  size_t  size,
+  boolzero);
+
 /**
  * The Runtime Loader allocator lock. An allocator that depends on a
  * separate allocation process, for example the heap, may need to be
@@ -266,6 +286,30 @@ bool rtems_rtl_alloc_module_new (void** text_base, size_t 
text_size,
  void** data_base, size_t data_size,
  void** bss_base, size_t bss_size);
 
+/**
+ * Resize the allocated memory for a module given the new size of the text,
+ * const, data and bss sections. If any part of the allocation fails the
+ * allocated is deleted.
+ *
+ * @param text_base Pointer to the text base pointer.
+ * @param text_size The size of the read/exec section.
+ * @param const_base Pointer to the const base pointer.
+ * @param const_size The size of the read only section.
+ * @param eh_base Pointer to the eh base pointer.
+ * @param eh_size The size of the eh section.
+ * @param data_base Pointer to the data base pointer.
+ * @param data_size The size of the read/write secton.
+ * @param bss_base Pointer to the bss base pointer.
+ * @param bss_size The size of the read/write.
+ * @retval true The memory has been allocated.
+ * @retval false The allocation of memory has failed.
+ */
+bool rtems_rtl_alloc_module_resize (void** text_base, size_t text_size,
+void** const_base, size_t const_size,
+void** eh_base, size_t eh_size,
+void** data_base, size_t data_size,
+void** bss_base, size_t bss_size);
+
 /**
  * Free the memory allocated to a module.
  *
diff --git a/cpukit/include/rtems/rtl/rtl-obj.h 
b/cpukit/include/rtems/rtl/rtl-obj.h
inde

[PATCH 1/2] spec/testsuite/dl: Fix optimization flags

2023-08-26 Thread chrisj
From: Chris Johns 

Updates #4944
---
 spec/build/testsuites/grp.yml   | 1 +
 spec/build/testsuites/libtests/dl01.yml | 3 ++-
 spec/build/testsuites/libtests/dl02.yml | 3 ++-
 spec/build/testsuites/libtests/dl03.yml | 3 ++-
 spec/build/testsuites/libtests/dl04.yml | 3 ++-
 spec/build/testsuites/libtests/dl05.yml | 3 ++-
 spec/build/testsuites/libtests/dl06.yml | 3 ++-
 spec/build/testsuites/libtests/dl07.yml | 3 ++-
 spec/build/testsuites/libtests/dl08.yml | 3 ++-
 spec/build/testsuites/libtests/dl09.yml | 3 ++-
 spec/build/testsuites/libtests/dl10.yml | 3 ++-
 spec/build/testsuites/libtests/dl11.yml | 3 ++-
 12 files changed, 23 insertions(+), 11 deletions(-)

diff --git a/spec/build/testsuites/grp.yml b/spec/build/testsuites/grp.yml
index c50693420c..85b50e01e8 100644
--- a/spec/build/testsuites/grp.yml
+++ b/spec/build/testsuites/grp.yml
@@ -12,6 +12,7 @@ includes:
 - ${BSP_INCLUDES}
 install: []
 ldflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 - ${COVERAGE_LINKER_FLAGS}
 links:
 - role: build-dependency
diff --git a/spec/build/testsuites/libtests/dl01.yml 
b/spec/build/testsuites/libtests/dl01.yml
index 3cc04a6611..ae3d125a65 100644
--- a/spec/build/testsuites/libtests/dl01.yml
+++ b/spec/build/testsuites/libtests/dl01.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl02.yml 
b/spec/build/testsuites/libtests/dl02.yml
index 9fd81dc7c8..59ddf27a96 100644
--- a/spec/build/testsuites/libtests/dl02.yml
+++ b/spec/build/testsuites/libtests/dl02.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl03.yml 
b/spec/build/testsuites/libtests/dl03.yml
index 363e3a925f..edeceeef3b 100644
--- a/spec/build/testsuites/libtests/dl03.yml
+++ b/spec/build/testsuites/libtests/dl03.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: test-program
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl04.yml 
b/spec/build/testsuites/libtests/dl04.yml
index 7dd41e3338..c31dab7e69 100644
--- a/spec/build/testsuites/libtests/dl04.yml
+++ b/spec/build/testsuites/libtests/dl04.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl05.yml 
b/spec/build/testsuites/libtests/dl05.yml
index 80f72131d0..db64528dd1 100644
--- a/spec/build/testsuites/libtests/dl05.yml
+++ b/spec/build/testsuites/libtests/dl05.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl06.yml 
b/spec/build/testsuites/libtests/dl06.yml
index 0fc5af1478..11243412b1 100644
--- a/spec/build/testsuites/libtests/dl06.yml
+++ b/spec/build/testsuites/libtests/dl06.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl07.yml 
b/spec/build/testsuites/libtests/dl07.yml
index 82dd3ccdde..31b8e28942 100644
--- a/spec/build/testsuites/libtests/dl07.yml
+++ b/spec/build/testsuites/libtests/dl07.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl08.yml 
b/spec/build/testsuites/libtests/dl08.yml
index d3982f2357..0467ca3c4c 100644
--- a/spec/build/testsuites/libtests/dl08.yml
+++ b/spec/build/testsuites/libtests/dl08.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded brains GmbH & Co. KG
 cppflags: []
diff --git a/spec/build/testsuites/libtests/dl09.yml 
b/spec/build/testsuites/libtests/dl09.yml
index 11066d2c0d..bada446d16 100644
--- a/spec/build/testsuites/libtests/dl09.yml
+++ b/spec/build/testsuites/libtests/dl09.yml
@@ -1,6 +1,7 @@
 SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
 build-type: script
-cflags: []
+cflags:
+- ${TEST_OPTIMIZATION_FLAGS}
 copyrights:
 - Copyright (C) 2020 embedded 

[RSB PATCH] rtems/tools: Pick up the rtems-syms and rtems-test sis changes

2023-08-20 Thread chrisj
From: Chris Johns 

Updates #4920
---
 rtems/config/tools/rtems-tools-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-tools-6.cfg 
b/rtems/config/tools/rtems-tools-6.cfg
index b786a47..6eed755 100644
--- a/rtems/config/tools/rtems-tools-6.cfg
+++ b/rtems/config/tools/rtems-tools-6.cfg
@@ -10,14 +10,14 @@
  %define rtems_tools_source rtems-tools-%{rtems_tools_version}
  %define rtems_tools_ext xz
 %else
- %define rtems_tools_version eaf14a654b528b44de14f9da9919555e54324e0d
+ %define rtems_tools_version 349bbd96543365e830e5ef5e851765e4b742a8a4
  %define rtems_tools_ext bz2
 %endif
 
 %define rtems_tools_source rtems-tools-%{rtems_tools_version}
 %source set rtems-tools 
https://git.rtems.org/rtems-tools/snapshot/%{rtems_tools_source}.tar.%{rtems_tools_ext}
 %hash   sha512 rtems-tools-%{rtems_tools_version}.tar.bz2 \
-   
bcjVLITKdjQLKlalfUptMKLAmvDT0FidARukQHP4rK/8SWpYckPAc8BMMRhS3RX+Ga6NDuxD1Ss/bRlxG6qsdg==
+   
qb5EC4gWfahYLPliYk+mNRsgzaDuouqiRq6GURb8v0Pk4J6Uo6IiKrB6dPvqVPO+wh9Omb1xCs+86W/+fj8sZg==
 
 #
 # Optionally enable/disable building the RTEMS Tools via the command line.
-- 
2.37.1

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


[rtems-tools PATCH] tester/sis: Use the RTEMS SIS command

2023-08-16 Thread chrisj
From: Chris Johns 

Make sis and sis-run the same as there is no SIS support in
gdb anymore.

Closes #4945
---
 tester/rtems/testing/bsps/sis-run.ini | 2 +-
 tester/rtems/testing/bsps/sis.ini | 6 ++
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/tester/rtems/testing/bsps/sis-run.ini 
b/tester/rtems/testing/bsps/sis-run.ini
index c34eae4..4861231 100644
--- a/tester/rtems/testing/bsps/sis-run.ini
+++ b/tester/rtems/testing/bsps/sis-run.ini
@@ -35,4 +35,4 @@
 bsp  = sis
 arch = sparc
 tester   = %{_rtscripts}/sis.cfg
-bsp_run_opts = -a
+bsp_run_opts =
diff --git a/tester/rtems/testing/bsps/sis.ini 
b/tester/rtems/testing/bsps/sis.ini
index b5d700f..086cb45 100644
--- a/tester/rtems/testing/bsps/sis.ini
+++ b/tester/rtems/testing/bsps/sis.ini
@@ -34,8 +34,6 @@
 [sis]
 bsp= sis
 arch   = sparc
-tester = %{_rtscripts}/gdb.cfg
+tester = %{_rtscripts}/sis.cfg
 gdb_script = bsp_gdb_script
-bsp_gdb_script = target sim -a -nouartrx
- load
- run
+bsp_run_opts =
-- 
2.37.1

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


[rtems-tools PATCH v2] linker: Add TLS support to the symbol table generator

2023-08-16 Thread chrisj
From: Chris Johns 

Updates #4920
---
 linkers/rtems-syms.cpp | 179 ++---
 1 file changed, 134 insertions(+), 45 deletions(-)

diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp
index e5170e1..c72ee55 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -60,10 +60,22 @@ static const char* c_header[] =
   " *  Automatically generated. Do not edit..",
   " */",
   "",
+  "#include ",
+  "#include ",
+  "",
+  "extern void* rtems_rtl_tls_get_base (void);",
+  "",
   "extern const unsigned char rtems__rtl_base_globals[];",
   "extern const unsigned int rtems__rtl_base_globals_size[];",
   "",
-  "void rtems_rtl_base_sym_global_add (const unsigned char* , unsigned int );",
+  "typedef size_t (*rtems_rtl_tls_offset_func)(void);",
+  "typedef struct rtems_rtl_tls_offset {",
+  "  size_t index;",
+  "  rtems_rtl_tls_offset_func offset;",
+  "} rtems_rtl_tls_offset;",
+  "",
+  "void rtems_rtl_base_sym_global_add (const unsigned char* , unsigned int,",
+  "rtems_rtl_tls_offset*, size_t );",
   "",
   "asm(\".section \\\".rodata\\\"\");",
   "",
@@ -78,35 +90,60 @@ static const char* c_header[] =
   0
 };
 
-static const char* c_trailer[] =
+static const char* c_sym_table_end[] =
 {
   "asm(\"  .byte0\");",
   "asm(\"  .ascii   \\\"\\xde\\xad\\xbe\\xef\\\"\");",
-#if BROKEN_ON_SOME_ASSEMBLERS
-  "asm(\"  .typertems__rtl_base_globals, #object\");",
-  "asm(\"  .sizertems__rtl_base_globals, . - rtems__rtl_base_globals\");",
-#endif
   "",
+  0
+};
+
+static const char* c_tls_call_table_start[] =
+{
+  "rtems_rtl_tls_offset rtems_rtl_tls_offsets[] = {",
+  0
+};
+
+static const char* c_tls_call_table_end[] =
+{
+  "};",
+  "#define RTEMS_RTL_TLS_OFFSETS_NUM " \
+  "(sizeof(rtems_rtl_tls_offsets) / (sizeof(rtems_rtl_tls_offsets[0])))",
+  "",
+  0
+};
+
+static const char* c_trailer[] =
+{
   "/*",
   " * Symbol table size.",
   " */",
   "asm(\"  .align   4\");",
   "asm(\"  .local   rtems__rtl_base_globals_size\");",
-#if BROKEN_ON_SOME_ASSEMBLERS
-  "asm(\"  .typertems__rtl_base_globals_size, #object\");",
-  "asm(\"  .sizertems__rtl_base_globals_size, 4\");",
-#endif
   "asm(\"rtems__rtl_base_globals_size:\");",
   "asm(\"  .long rtems__rtl_base_globals_size - rtems__rtl_base_globals\");",
   "",
   0
 };
 
+static const char* c_rtl_call_body_embeded[] =
+{
+  "{",
+  "  rtems_rtl_base_sym_global_add (&rtems__rtl_base_globals[0],",
+  " rtems__rtl_base_globals_size[0],",
+  " &rtems_rtl_tls_offsets[0],",
+  " RTEMS_RTL_TLS_OFFSETS_NUM);",
+  "}",
+  0
+};
+
 static const char* c_rtl_call_body[] =
 {
   "{",
   "  rtems_rtl_base_sym_global_add (&rtems__rtl_base_globals[0],",
-  " rtems__rtl_base_globals_size[0]);",
+  " rtems__rtl_base_globals_size[0],",
+  " NULL",
+  " 0);",
   "}",
   0
 };
@@ -140,7 +177,7 @@ c_embedded_trailer (rld::process::tempfile& c)
 {
   c.write_line ("void rtems_rtl_base_global_syms_init(void);");
   c.write_line ("void rtems_rtl_base_global_syms_init(void)");
-  temporary_file_paint (c, c_rtl_call_body);
+  temporary_file_paint (c, c_rtl_call_body_embeded);
 }
 
 /**
@@ -214,16 +251,27 @@ symbol_filter::filter (const rld::symbols::symtab& 
symbols,
 
 struct output_sym
 {
+  enum struct output_mode {
+symbol,
+tls_func,
+tls_call_table
+  };
   rld::process::tempfile& c;
   const bool  embed;
   const bool  weak;
-
-  output_sym(rld::process::tempfile& c,
- boolembed,
- boolweak)
-: c (c),
-  embed (embed),
-  weak (weak) {
+  const output_mode   mode;
+  size_t& index;
+
+  output_sym(rld::process::tempfile& c_,
+ boolembed_,
+ boolweak_,
+ output_mode mode_,
+ size_t& index_)
+: c (c_),
+  embed (embed_),
+  weak (weak_),
+  mode (mode_),
+  index (index_) {
   }
 
   void operator ()(const rld::symbols::symtab::value_type& value);
@@ -240,34 +288,56 @@ output_sym::operator ()(const 
rld::symbols::symtab::value_type& value)
   if (weak && sym.value () == 0)
 return;
 
-  c.write_line ("asm(\"  .asciz \\\"" + sym.name () + "\\\"\");");
-
-  if (sym.type() == STT_TLS)
-  {
-c.write_line ("asm(\"  .type \\\"" + sym.name () + "\\\", 
%tls_object\");");
-  }
-
-  if (embed)
-  {
-c.write_line ("#if __SIZEOF_POINTER__ == 8");
-c.write_line ("asm(\"  .quad " + sym.name () + "\");");
-c.write_line ("#else");
-c.write_line ("asm(\"  .long " + sym.name () + "\");");
-c.write_line ("#endif");
-  }
-  else
-  {
-std::stringstream oss;
-oss << std::hex << std::setfi

v2 libdl support for base image TLS variables

2023-08-16 Thread chrisj
These patches add support to rtems.git and rtems-tools.git to 
provide access to TLS variables in the base from loaded code.
The changes contain the ground work to resolving #4920 which is 
a blocker for the release of 6.

This change is required due to the regression in libdl due to the
change in newlib to use TLS variables for reenterant data.

The rtems.git patch can be applied before the rtems-tools.git
patch. If the tools are updated and the libdl code is not present
the tests fail with linker errors. If the tools change is
not present the test will link but it will continue to fail.

The currently supported archs that build are:

 - aarch64
 - arm
 - powerpc
 - sparc

Test results are in #4920. The following do not have newlib TLS
support so are OK:

 - i386
 - m68k

The follow are to be completed and do not build:

 - bfin
 - lm32
 - mips
 - moxie
 - riscv

These are to be removed and so not tested or built:

 - v850  

We need to add support for these architectures if they support TLS or 
list them as not needing support like the m68k.

v2:
 - Review commment updates

Chris


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


[PATCH v2] libdl: Add support to import base image TLS symbols

2023-08-16 Thread chrisj
From: Chris Johns 

This change requires an rtems-tools update for symbol generation.

Working architectures:
 - aarch64
 - arm
 - powerpc
 - sparc

No newlib TLS support but checked:
 - i386
 - m69k

Updates #4920
---
 cpukit/include/rtems/rtl/rtl-sym.h |  26 -
 cpukit/include/rtems/rtl/rtl.h |   8 +-
 cpukit/libdl/rtl-elf.c |  20 +++-
 cpukit/libdl/rtl-mdreloc-aarch64.c |   6 +-
 cpukit/libdl/rtl-mdreloc-arm.c |   3 +-
 cpukit/libdl/rtl-mdreloc-powerpc.c |  18 +++-
 cpukit/libdl/rtl-mdreloc-sparc.c   | 154 -
 cpukit/libdl/rtl-sym.c |  40 ++--
 cpukit/libdl/rtl-tls.c | 114 +
 cpukit/libdl/rtl-tls.h |  51 ++
 cpukit/libdl/rtl.c |   8 +-
 spec/build/cpukit/objdl.yml|   1 +
 testsuites/libtests/dl11/dl-load.c |  27 -
 13 files changed, 418 insertions(+), 58 deletions(-)
 create mode 100644 cpukit/libdl/rtl-tls.c
 create mode 100644 cpukit/libdl/rtl-tls.h

diff --git a/cpukit/include/rtems/rtl/rtl-sym.h 
b/cpukit/include/rtems/rtl/rtl-sym.h
index 0d29a6ae40..3502b303b8 100644
--- a/cpukit/include/rtems/rtl/rtl-sym.h
+++ b/cpukit/include/rtems/rtl/rtl-sym.h
@@ -62,6 +62,22 @@ typedef struct rtems_rtl_symbols
   size_t   nbuckets;
 } rtems_rtl_symbols;
 
+/**
+ * A TLS variable offset call. There is one per base image TLS
+ * variable.
+ */
+typedef size_t (*rtems_rtl_tls_offset_func)(void);
+
+/**
+ * A TLS symbol offset entry. It is used with an exported symbol table
+ * to find a TSL table offset for a variable at runtime.
+ */
+typedef struct rtems_rtl_tls_offset
+{
+  size_tindex;  /** exported symbol table index */
+  rtems_rtl_tls_offset_func offset; /** TLS offset function */
+} rtems_rtl_tls_offset;
+
 /**
  * Open a symbol table with the specified number of buckets.
  *
@@ -101,10 +117,14 @@ void rtems_rtl_symbol_table_close (rtems_rtl_symbols* 
symbols);
  * @param obj The object table the symbols are for.
  * @param esyms The exported symbol table.
  * @param size The size of the table in bytes.
+ * @param tls_offsets The TLS offsets table. If NULL none provided.
+ * @param tls_size The number TLS offset entries in the table.
  */
-bool rtems_rtl_symbol_global_add (rtems_rtl_obj*   obj,
-  const unsigned char* esyms,
-  unsigned int size);
+bool rtems_rtl_symbol_global_add (rtems_rtl_obj*obj,
+  const unsigned char*  esyms,
+  unsigned int  size,
+  rtems_rtl_tls_offset* tls_offsets,
+  unsigned int  tls_size);
 
 /**
  * Find a symbol given the symbol label in the global symbol table.
diff --git a/cpukit/include/rtems/rtl/rtl.h b/cpukit/include/rtems/rtl/rtl.h
index 0fd4e74cdf..bd3dce588a 100644
--- a/cpukit/include/rtems/rtl/rtl.h
+++ b/cpukit/include/rtems/rtl/rtl.h
@@ -393,9 +393,13 @@ bool rtems_rtl_path_prepend (const char* path);
  *
  * @param esyms The exported symbol table.
  * @param count The size of the exported symbol table.
+ * @param tls_offsets The TLS offsets table. If NULL none provided.
+ * @param tls_size The number TLS offset entries in the table.
  */
-void rtems_rtl_base_sym_global_add (const unsigned char* esyms,
-unsigned int count);
+void rtems_rtl_base_sym_global_add (const unsigned char*  esyms,
+unsigned int  count,
+rtems_rtl_tls_offset* tls_offsets,
+unsigned int  tls_size);
 
 /**
  * Return the object file descriptor for the base image. The object file
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c
index 5754070518..b46d2ac3a0 100644
--- a/cpukit/libdl/rtl-elf.c
+++ b/cpukit/libdl/rtl-elf.c
@@ -178,12 +178,19 @@ rtems_rtl_elf_find_symbol (rtems_rtl_obj*  obj,
 
   /*
* If the symbol type is STT_NOTYPE the symbol references a global
-   * symbol. The gobal symbol table is searched to find it and that value
+   * symbol. The global symbol table is searched to find it and that value
* returned. If the symbol is local to the object module the section for the
* symbol is located and it's base added to the symbol's value giving an
* absolute location.
+   *
+   * If the symbols type of TLS return the symbols value. It is the
+   * offset from the thread's TLS area base. The offset is set by the
+   * linker for the base image and by the TLS allocator for loaded
+   * modules. There is no section and no absolute base.
*/
-  if (ELF_ST_TYPE(sym->st_info) == STT_NOTYPE || sym->st_shndx == SHN_COMMON)
+  if (ELF_ST_TYPE (sym->st_info) == STT_NOTYPE ||
+  sym->st_shndx == SHN_COMMON ||
+  ELF_ST_TYPE (sym->st_info) == STT_TLS)
   {
 /*
  * Search the object f

[PATCH] libdl: Add support to import base image TLS symbols

2023-08-14 Thread chrisj
From: Chris Johns 

This change requires an rtems-tools update for symbol generation.

Working architectures:
 - aarch64
 - arm
 - powerpc
 - sparc

Updates #4920
---
 cpukit/include/rtems/rtl/rtl-sym.h |  23 -
 cpukit/include/rtems/rtl/rtl.h |   6 +-
 cpukit/libdl/rtl-elf.c |  20 +++-
 cpukit/libdl/rtl-mdreloc-aarch64.c |   6 +-
 cpukit/libdl/rtl-mdreloc-arm.c |   3 +-
 cpukit/libdl/rtl-mdreloc-powerpc.c |  18 +++-
 cpukit/libdl/rtl-mdreloc-sparc.c   | 152 -
 cpukit/libdl/rtl-sym.c |  36 ++-
 cpukit/libdl/rtl-tls.c | 111 +
 cpukit/libdl/rtl-tls.h |  51 ++
 cpukit/libdl/rtl.c |   6 +-
 spec/build/cpukit/objdl.yml|   1 +
 testsuites/libtests/dl11/dl-load.c |  27 -
 13 files changed, 408 insertions(+), 52 deletions(-)
 create mode 100644 cpukit/libdl/rtl-tls.c
 create mode 100644 cpukit/libdl/rtl-tls.h

diff --git a/cpukit/include/rtems/rtl/rtl-sym.h 
b/cpukit/include/rtems/rtl/rtl-sym.h
index 0d29a6ae40..9eef9a1b7b 100644
--- a/cpukit/include/rtems/rtl/rtl-sym.h
+++ b/cpukit/include/rtems/rtl/rtl-sym.h
@@ -62,6 +62,22 @@ typedef struct rtems_rtl_symbols
   size_t   nbuckets;
 } rtems_rtl_symbols;
 
+/**
+ * A TLS variable offset call. There is one per base image TLS
+ * variable.
+ */
+typedef size_t (*rtems_tls_offset_func)(void);
+
+/**
+ * A TLS symbol offset entry. It is used with an exported symbol table
+ * to find a TSL table offset for a variable at runtime.
+ */
+typedef struct rtems_tls_offset
+{
+  size_tindex;  /** exported symbol table index */
+  rtems_tls_offset_func offset; /** TLS offset function */
+} rtems_tls_offset;
+
 /**
  * Open a symbol table with the specified number of buckets.
  *
@@ -101,10 +117,15 @@ void rtems_rtl_symbol_table_close (rtems_rtl_symbols* 
symbols);
  * @param obj The object table the symbols are for.
  * @param esyms The exported symbol table.
  * @param size The size of the table in bytes.
+ * @param tls_offsets The TLS offsets table. If NULL none provided.
+ * @param tls_size The number TLS offset entries in the table..
+
  */
 bool rtems_rtl_symbol_global_add (rtems_rtl_obj*   obj,
   const unsigned char* esyms,
-  unsigned int size);
+  unsigned int size,
+  rtems_tls_offset*tls_offsets,
+  unsigned int tls_size);
 
 /**
  * Find a symbol given the symbol label in the global symbol table.
diff --git a/cpukit/include/rtems/rtl/rtl.h b/cpukit/include/rtems/rtl/rtl.h
index 0fd4e74cdf..aaaeb7b592 100644
--- a/cpukit/include/rtems/rtl/rtl.h
+++ b/cpukit/include/rtems/rtl/rtl.h
@@ -393,9 +393,13 @@ bool rtems_rtl_path_prepend (const char* path);
  *
  * @param esyms The exported symbol table.
  * @param count The size of the exported symbol table.
+ * @param tls_offsets The TLS offsets table. If NULL none provided.
+ * @param tls_size The number TLS offset entries in the table..
  */
 void rtems_rtl_base_sym_global_add (const unsigned char* esyms,
-unsigned int count);
+unsigned int count,
+rtems_tls_offset*tls_offsets,
+unsigned int tls_size);
 
 /**
  * Return the object file descriptor for the base image. The object file
diff --git a/cpukit/libdl/rtl-elf.c b/cpukit/libdl/rtl-elf.c
index 5754070518..b46d2ac3a0 100644
--- a/cpukit/libdl/rtl-elf.c
+++ b/cpukit/libdl/rtl-elf.c
@@ -178,12 +178,19 @@ rtems_rtl_elf_find_symbol (rtems_rtl_obj*  obj,
 
   /*
* If the symbol type is STT_NOTYPE the symbol references a global
-   * symbol. The gobal symbol table is searched to find it and that value
+   * symbol. The global symbol table is searched to find it and that value
* returned. If the symbol is local to the object module the section for the
* symbol is located and it's base added to the symbol's value giving an
* absolute location.
+   *
+   * If the symbols type of TLS return the symbols value. It is the
+   * offset from the thread's TLS area base. The offset is set by the
+   * linker for the base image and by the TLS allocator for loaded
+   * modules. There is no section and no absolute base.
*/
-  if (ELF_ST_TYPE(sym->st_info) == STT_NOTYPE || sym->st_shndx == SHN_COMMON)
+  if (ELF_ST_TYPE (sym->st_info) == STT_NOTYPE ||
+  sym->st_shndx == SHN_COMMON ||
+  ELF_ST_TYPE (sym->st_info) == STT_TLS)
   {
 /*
  * Search the object file then the global table for the symbol.
@@ -246,6 +253,13 @@ rtems_rtl_elf_reloc_parser (rtems_rtl_obj*  obj,
   rtems_rtl_wordrel_words[3];
   rtems_rtl_elf_rel_status  rs;
 
+  /*
+   * TLS are not parsed.
+   */
+  if (ELF_ST_TYPE (sym->st_info) 

[rtems-tools PATCH] linker: Add TLS support to the symbol table generator

2023-08-14 Thread chrisj
From: Chris Johns 

This is not complete as it has aarch64 code that should be in the
kernel.
---
 linkers/rtems-syms.cpp | 179 ++---
 1 file changed, 134 insertions(+), 45 deletions(-)

diff --git a/linkers/rtems-syms.cpp b/linkers/rtems-syms.cpp
index e5170e1..1c54ffc 100644
--- a/linkers/rtems-syms.cpp
+++ b/linkers/rtems-syms.cpp
@@ -60,10 +60,22 @@ static const char* c_header[] =
   " *  Automatically generated. Do not edit..",
   " */",
   "",
+  "#include ",
+  "#include ",
+  "",
+  "extern void* rtems_rtl_tls_get_base (void);",
+  "",
   "extern const unsigned char rtems__rtl_base_globals[];",
   "extern const unsigned int rtems__rtl_base_globals_size[];",
   "",
-  "void rtems_rtl_base_sym_global_add (const unsigned char* , unsigned int );",
+  "typedef size_t (*rtems_tls_offset_func)(void);",
+  "typedef struct rtems_tls_offset {",
+  "  size_t index;",
+  "  rtems_tls_offset_func offset;",
+  "} rtems_tls_offset;",
+  "",
+  "void rtems_rtl_base_sym_global_add (const unsigned char* , unsigned int,",
+  "rtems_tls_offset*, size_t );",
   "",
   "asm(\".section \\\".rodata\\\"\");",
   "",
@@ -78,35 +90,60 @@ static const char* c_header[] =
   0
 };
 
-static const char* c_trailer[] =
+static const char* c_sym_table_end[] =
 {
   "asm(\"  .byte0\");",
   "asm(\"  .ascii   \\\"\\xde\\xad\\xbe\\xef\\\"\");",
-#if BROKEN_ON_SOME_ASSEMBLERS
-  "asm(\"  .typertems__rtl_base_globals, #object\");",
-  "asm(\"  .sizertems__rtl_base_globals, . - rtems__rtl_base_globals\");",
-#endif
   "",
+  0
+};
+
+static const char* c_tls_call_table_start[] =
+{
+  "rtems_tls_offset rtems_tls_offsets[] = {",
+  0
+};
+
+static const char* c_tls_call_table_end[] =
+{
+  "};",
+  "#define RTEMS_TLS_OFFSETS_NUM " \
+  "(sizeof(rtems_tls_offsets) / (sizeof(rtems_tls_offsets[0])))",
+  "",
+  0
+};
+
+static const char* c_trailer[] =
+{
   "/*",
   " * Symbol table size.",
   " */",
   "asm(\"  .align   4\");",
   "asm(\"  .local   rtems__rtl_base_globals_size\");",
-#if BROKEN_ON_SOME_ASSEMBLERS
-  "asm(\"  .typertems__rtl_base_globals_size, #object\");",
-  "asm(\"  .sizertems__rtl_base_globals_size, 4\");",
-#endif
   "asm(\"rtems__rtl_base_globals_size:\");",
   "asm(\"  .long rtems__rtl_base_globals_size - rtems__rtl_base_globals\");",
   "",
   0
 };
 
+static const char* c_rtl_call_body_embeded[] =
+{
+  "{",
+  "  rtems_rtl_base_sym_global_add (&rtems__rtl_base_globals[0],",
+  " rtems__rtl_base_globals_size[0],",
+  " &rtems_tls_offsets[0],",
+  " RTEMS_TLS_OFFSETS_NUM);",
+  "}",
+  0
+};
+
 static const char* c_rtl_call_body[] =
 {
   "{",
   "  rtems_rtl_base_sym_global_add (&rtems__rtl_base_globals[0],",
-  " rtems__rtl_base_globals_size[0]);",
+  " rtems__rtl_base_globals_size[0],",
+  " NULL",
+  " 0);",
   "}",
   0
 };
@@ -140,7 +177,7 @@ c_embedded_trailer (rld::process::tempfile& c)
 {
   c.write_line ("void rtems_rtl_base_global_syms_init(void);");
   c.write_line ("void rtems_rtl_base_global_syms_init(void)");
-  temporary_file_paint (c, c_rtl_call_body);
+  temporary_file_paint (c, c_rtl_call_body_embeded);
 }
 
 /**
@@ -214,16 +251,27 @@ symbol_filter::filter (const rld::symbols::symtab& 
symbols,
 
 struct output_sym
 {
+  enum struct output_mode {
+symbol,
+tls_func,
+tls_call_table
+  };
   rld::process::tempfile& c;
   const bool  embed;
   const bool  weak;
-
-  output_sym(rld::process::tempfile& c,
- boolembed,
- boolweak)
-: c (c),
-  embed (embed),
-  weak (weak) {
+  const output_mode   mode;
+  size_t& index;
+
+  output_sym(rld::process::tempfile& c_,
+ boolembed_,
+ boolweak_,
+ output_mode mode_,
+ size_t& index_)
+: c (c_),
+  embed (embed_),
+  weak (weak_),
+  mode (mode_),
+  index (index_) {
   }
 
   void operator ()(const rld::symbols::symtab::value_type& value);
@@ -240,34 +288,56 @@ output_sym::operator ()(const 
rld::symbols::symtab::value_type& value)
   if (weak && sym.value () == 0)
 return;
 
-  c.write_line ("asm(\"  .asciz \\\"" + sym.name () + "\\\"\");");
-
-  if (sym.type() == STT_TLS)
-  {
-c.write_line ("asm(\"  .type \\\"" + sym.name () + "\\\", 
%tls_object\");");
-  }
-
-  if (embed)
-  {
-c.write_line ("#if __SIZEOF_POINTER__ == 8");
-c.write_line ("asm(\"  .quad " + sym.name () + "\");");
-c.write_line ("#else");
-c.write_line ("asm(\"  .long " + sym.name () + "\");");
-c.write_line ("#endif");
-  }
-  else
-  {
-std::stringstream oss;
-oss << std::hex <

libdl support for base image TLS variables

2023-08-14 Thread chrisj
These patches add support to rtems.git and rtems-tools.git to 
provide access to TLS variables in the base from loaded code.
The changes contain the ground work to resolving #4920 which is 
a blocker for the release of 6.

This change is required due to the regression in libdl due to the
change in newlib to use TLS variables for reneterant data.

The rtems.git patch can be applied before the rtems-tools.git
patch. If the tools are updated and the libdl code is not present
the tests fail with linker errors. If the tools change is
not present the test will link but it will continue to fail.

The currently supported archs that build are:

 - aarch64
 - arm
 - powerpc
 - sparc

The follow are to be completed and do not build:

 - bfin
 - i386
 - lm32
 - m68k
 - mips
 - moxie
 - riscv
 - v850  

We need to add support for these architectures if they support TLS.

Chris


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


[PATCH] cpukit/libdl: AARCH64 unwind uses DWARF 2 tables

2023-08-11 Thread chrisj
From: Chris Johns 

Closes #4943
---
 cpukit/libdl/rtl-mdreloc-aarch64.c | 17 +
 spec/build/cpukit/objdlaarch64.yml |  1 -
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/cpukit/libdl/rtl-mdreloc-aarch64.c 
b/cpukit/libdl/rtl-mdreloc-aarch64.c
index 46f87e9178..15396c3de9 100644
--- a/cpukit/libdl/rtl-mdreloc-aarch64.c
+++ b/cpukit/libdl/rtl-mdreloc-aarch64.c
@@ -561,3 +561,20 @@ rtems_rtl_elf_relocate_rel (rtems_rtl_obj*obj,
   rtems_rtl_set_error (EINVAL, "rela type record not supported");
   return rtems_rtl_elf_rel_failure;
 }
+
+bool
+rtems_rtl_elf_unwind_parse (const rtems_rtl_obj* obj,
+const char*  name,
+uint32_t flags) {
+  return rtems_rtl_elf_unwind_dw2_parse (obj, name, flags);
+}
+
+bool
+rtems_rtl_elf_unwind_register (rtems_rtl_obj* obj) {
+  return rtems_rtl_elf_unwind_dw2_register (obj);
+}
+
+bool
+rtems_rtl_elf_unwind_deregister (rtems_rtl_obj* obj) {
+  return rtems_rtl_elf_unwind_dw2_deregister (obj);
+}
diff --git a/spec/build/cpukit/objdlaarch64.yml 
b/spec/build/cpukit/objdlaarch64.yml
index 1715eefd3a..2909a902f2 100644
--- a/spec/build/cpukit/objdlaarch64.yml
+++ b/spec/build/cpukit/objdlaarch64.yml
@@ -12,5 +12,4 @@ install: []
 links: []
 source:
 - cpukit/libdl/rtl-mdreloc-aarch64.c
-- cpukit/libdl/rtl-unwind-arm.c
 type: build
-- 
2.37.1

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


[PATCH rtems-libbsd 6-freebsd-12 v2 2/3] testsuite/nfs: Check the path returned by getcwd

2023-08-06 Thread chrisj
From: Chris Johns 

---
 testsuite/nfs01/test_main.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/testsuite/nfs01/test_main.c b/testsuite/nfs01/test_main.c
index cdcbb1cd..a3d75ddd 100644
--- a/testsuite/nfs01/test_main.c
+++ b/testsuite/nfs01/test_main.c
@@ -317,21 +317,28 @@ static void
 test_path_eval(const char *base, int depth)
 {
char path[MAXPATHLEN];
+   char curpath[MAXPATHLEN];
+   char getpath[MAXPATHLEN];
int l;
 
-   printf("test path eval\n");
+   printf("test path eval: %s\n", base);
 
test_setup(base);
 
+   sprintf(curpath, "%s/%s", base, test_top);
+
for (l = 1; l <= depth; ++l) {
snprintf(path, sizeof(path), "%d", l);
-   printf("test: nfs: mkdir: %s\n", path);
+   strcat(curpath, "/");
+   strcat(curpath, path);
+   printf("test: nfs: mkdir: %s (%s)\n", path, curpath);
rtems_test_errno_assert(mkdir(path, 0777) == 0);
-   printf("test: nfs: chdir: %s\n", path);
+   printf("test: nfs: chdir: %s (%s)\n", path, curpath);
rtems_test_errno_assert(chdir(path) == 0);
-   printf("test: nfs: getcwd: %s\n", path);
-   assert(getcwd(path, sizeof(path)) != NULL);
-   printf("test: nfs: getcwd: %s\n", path);
+   printf("test: nfs: getcwd: %s (%s)\n", path, curpath);
+   assert(getcwd(getpath, sizeof(getpath)) != NULL);
+   printf("test: nfs: getcwd: %s (want: %s)\n", getpath, curpath);
+   assert(strcmp(curpath, getpath) == 0);
}
 
test_cleanup(base);
-- 
2.37.1

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


[PATCH rtems-libbsd 6-freebsd-12 v2 1/3] rtemsbsd/syscall: Set unitialised variable in open

2023-08-06 Thread chrisj
From: Chris Johns 

The open path length was not set when at the root node and this
sometimes failed the current directory checks.
---
 rtemsbsd/rtems/rtems-bsd-syscall-api.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rtemsbsd/rtems/rtems-bsd-syscall-api.c 
b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
index 81361e94..800aa323 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscall-api.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
@@ -918,6 +918,7 @@ rtems_bsd_sysgen_open_node(
if (rtems_bsd_libio_loc_to_vnode(&iop->pathinfo) ==
rtems_bsd_libio_loc_to_vnode(rootloc)) {
opath = ".";
+   opathlen = 1;
} else {
opath = path + strlen(path);
opathlen = 0;
-- 
2.37.1

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


[PATCH rtems-libbsd 6-freebsd-12 v2 3/3] rtemsbsd/vfs: Use VOP_REMOVE to remove file nodes

2023-08-06 Thread chrisj
From: Chris Johns 

---
 rtemsbsd/rtems/rtems-kernel-vfs.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/rtemsbsd/rtems/rtems-kernel-vfs.c 
b/rtemsbsd/rtems/rtems-kernel-vfs.c
index 0817df81..69c9ba56 100644
--- a/rtemsbsd/rtems/rtems-kernel-vfs.c
+++ b/rtemsbsd/rtems/rtems-kernel-vfs.c
@@ -679,7 +679,11 @@ restart:
goto restart;
}
vfs_notify_upper(vp, VFS_NOTIFY_UPPER_UNLINK);
-   error = VOP_RMDIR(dvp, vp, &cn);
+   if (vp->v_type == VDIR) {
+   error = VOP_RMDIR(dvp, vp, &cn);
+   } else {
+   error = VOP_REMOVE(dvp, vp, &cn);
+   }
vn_finished_write(mp);
 out:
return rtems_bsd_error_to_status_and_errno(error);
-- 
2.37.1

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


[PATCH rtems-libbsd 6-freebsd-12 2/2] testsuite/nfs: Check the path returned by getcwd

2023-08-05 Thread chrisj
From: Chris Johns 

---
 testsuite/nfs01/test_main.c | 19 +--
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/testsuite/nfs01/test_main.c b/testsuite/nfs01/test_main.c
index cdcbb1cd..a3d75ddd 100644
--- a/testsuite/nfs01/test_main.c
+++ b/testsuite/nfs01/test_main.c
@@ -317,21 +317,28 @@ static void
 test_path_eval(const char *base, int depth)
 {
char path[MAXPATHLEN];
+   char curpath[MAXPATHLEN];
+   char getpath[MAXPATHLEN];
int l;
 
-   printf("test path eval\n");
+   printf("test path eval: %s\n", base);
 
test_setup(base);
 
+   sprintf(curpath, "%s/%s", base, test_top);
+
for (l = 1; l <= depth; ++l) {
snprintf(path, sizeof(path), "%d", l);
-   printf("test: nfs: mkdir: %s\n", path);
+   strcat(curpath, "/");
+   strcat(curpath, path);
+   printf("test: nfs: mkdir: %s (%s)\n", path, curpath);
rtems_test_errno_assert(mkdir(path, 0777) == 0);
-   printf("test: nfs: chdir: %s\n", path);
+   printf("test: nfs: chdir: %s (%s)\n", path, curpath);
rtems_test_errno_assert(chdir(path) == 0);
-   printf("test: nfs: getcwd: %s\n", path);
-   assert(getcwd(path, sizeof(path)) != NULL);
-   printf("test: nfs: getcwd: %s\n", path);
+   printf("test: nfs: getcwd: %s (%s)\n", path, curpath);
+   assert(getcwd(getpath, sizeof(getpath)) != NULL);
+   printf("test: nfs: getcwd: %s (want: %s)\n", getpath, curpath);
+   assert(strcmp(curpath, getpath) == 0);
}
 
test_cleanup(base);
-- 
2.37.1

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


[PATCH rtems-libbsd 6-freebsd-12 1/2] rtemsbsd/syscall: Set unitialised variable in open

2023-08-05 Thread chrisj
From: Chris Johns 

The open path length was not set when at the root node and this
sometimes failed the current directory checks.
---
 rtemsbsd/rtems/rtems-bsd-syscall-api.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rtemsbsd/rtems/rtems-bsd-syscall-api.c 
b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
index 81361e94..800aa323 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscall-api.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
@@ -918,6 +918,7 @@ rtems_bsd_sysgen_open_node(
if (rtems_bsd_libio_loc_to_vnode(&iop->pathinfo) ==
rtems_bsd_libio_loc_to_vnode(rootloc)) {
opath = ".";
+   opathlen = 1;
} else {
opath = path + strlen(path);
opathlen = 0;
-- 
2.37.1

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


[RSB PATCH] rtems/kernel: Update to the current kernel

2023-07-24 Thread chrisj
From: Chris Johns 

- Pick up the Beatnik support for the legacy driver
---
 rtems/config/tools/rtems-kernel-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index f2174c7..c9c884f 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 6
 #
 
-%define rtems_kernel_version a83dc4a469429e29cdd18eddbd1b9fff3f4328d8
+%define rtems_kernel_version c1d9dcbbb2a436256b49d9a0c322c78261509264
 
 %hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-   
baWt7QkFo2YlzV4pTnnZ8agonhdrWN4Z8yMgV6/vgZs+cRw59xRq69KfWzgqVZDpaA0l3nuiLqNaxqEh2fMXMw==
+   
dH0PgnSQ1k6pTCP/NhIgWzhDjHqFuLI03RBhbjaRFvRs5CUbZIG+x8opTb13czga/cUhOBd9JC7x557FkX0seA==
 #
 # The RTEMS build instructions.
 #
-- 
2.37.1

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


[PATCH] bsps/arm: Fix CMSIS v5 install files list

2023-07-24 Thread chrisj
From: Chris Johns 

---
 spec/build/bsps/arm/grp.yml | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/spec/build/bsps/arm/grp.yml b/spec/build/bsps/arm/grp.yml
index 1058f58d92..a48cd80d74 100644
--- a/spec/build/bsps/arm/grp.yml
+++ b/spec/build/bsps/arm/grp.yml
@@ -10,12 +10,13 @@ includes: []
 install:
 - destination: ${BSP_INCLUDEDIR}
   source:
+  - bsps/arm/include/cachel1_armv7.h
+  - bsps/arm/include/cmsis_compiler.h
   - bsps/arm/include/cmsis_gcc.h
+  - bsps/arm/include/cmsis_version.h
   - bsps/arm/include/core_cm7.h
   - bsps/arm/include/core_cm4.h
-  - bsps/arm/include/core_cmFunc.h
-  - bsps/arm/include/core_cmInstr.h
-  - bsps/arm/include/core_cmSimd.h
+  - bsps/arm/include/mpu_armv7.h
   - bsps/arm/include/uart.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
-- 
2.37.1

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


[PATCH rtems-libbsd/6-freebsd-12 v2 3/4] freebsd/vfs: Pass in the td's cred to the VFS calls

2023-07-20 Thread chrisj
From: Chris Johns 

Closes #4723
---
 rtemsbsd/rtems/rtems-kernel-vfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtemsbsd/rtems/rtems-kernel-vfs.c 
b/rtemsbsd/rtems/rtems-kernel-vfs.c
index 2f4d009b..0817df81 100644
--- a/rtemsbsd/rtems/rtems-kernel-vfs.c
+++ b/rtemsbsd/rtems/rtems-kernel-vfs.c
@@ -490,7 +490,7 @@ rtems_bsd_vfs_fchmod(const rtems_filesystem_location_info_t 
*loc, mode_t mode)
}
return rtems_bsd_error_to_status_and_errno(ENOMEM);
}
-   error = setfmode(td, NULL, vp, mode);
+   error = setfmode(td, td->td_ucred, vp, mode);
return rtems_bsd_error_to_status_and_errno(error);
 }
 
@@ -511,7 +511,7 @@ rtems_bsd_vfs_chown(
}
return rtems_bsd_error_to_status_and_errno(ENOMEM);
}
-   error = setfown(td, NULL, vp, owner, group);
+   error = setfown(td, td->td_ucred, vp, owner, group);
return rtems_bsd_error_to_status_and_errno(error);
 }
 
-- 
2.37.1

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


[PATCH rtems-libbsd/6-freebsd-12 v2 4/4] nfs: Support multiple mounts with the same path basename

2023-07-20 Thread chrisj
From: Chris Johns 

NFSv4 mounts NFS file systems to the flat root of a pseudo file
system. This change allow the same basename to be used.
---
 rtemsbsd/fs/nfsclient/nfs.c| 31 +++--
 rtemsbsd/rtems/rtems-bsd-syscall-api.c | 32 +++---
 2 files changed, 37 insertions(+), 26 deletions(-)

diff --git a/rtemsbsd/fs/nfsclient/nfs.c b/rtemsbsd/fs/nfsclient/nfs.c
index ffbf7f4d..a3a29b62 100644
--- a/rtemsbsd/fs/nfsclient/nfs.c
+++ b/rtemsbsd/fs/nfsclient/nfs.c
@@ -830,8 +830,10 @@ rtems_nfs_initialize(
 rtems_filesystem_mount_table_entry_t *mt_entry, const void *data)
 {
struct nfs_args args;
-   const char *fspath = NULL;
+   static int mount_counter;
+   char fspath[NAME_MAX + 1];
char *at;
+   int len;
int error;
 
if (RTEMS_DEBUG) {
@@ -923,15 +925,30 @@ rtems_nfs_initialize(
 
rtems_bsd_vfs_mount_init(mt_entry);
 
-   fspath = mt_entry->target;
-   if (*fspath == '/') {
-   ++fspath;
+   at = mt_entry->target + strlen(mt_entry->target);
+   len = 0;
+   while (at != mt_entry->target && 
!rtems_filesystem_is_delimiter(at[-1])) {
+   at--;
+   len++;
}
-   if (strchr(fspath, '/') != 0) {
+
+   /*
+* Account for the mount number and leading `/`
+*/
+   if (len >= sizeof(fspath) - (6 + 2)) {
error = EINVAL;
goto out;
}
 
+   /*
+* Append a unique number to the end of the path created in
+* the FreeBSD root file system. All mounts are in the root
+* directory of the root file system and so flat. A user could
+* use different mount paths with the same end name. Without
+* the counter appended they would clash.
+*/
+   snprintf(fspath, sizeof(fspath), "/%s-%d", at, mount_counter++);
+
if (getnfsargs(mt_entry->dev, &args) < 0) {
if (RTEMS_DEBUG)
printf(
@@ -949,7 +966,7 @@ rtems_nfs_initialize(
 * export then find the vnode and hold it. Make sure we find the root
 * node of the NFS share and the not the root file system's mount node.
 */
-   error = rtems_bsd_rootfs_mkdir(fspath);
+   error = rtems_bsd_rootfs_mkdir(fspath + 1);
if (error == 0) {
struct addrinfo *ai;
enum tryret tryret;
@@ -964,7 +981,7 @@ rtems_nfs_initialize(
if (tryret == TRYRET_SUCCESS) {
error = nfs_trymount(mt_entry, ai, &args, 
fspath, data);
if (RTEMS_DEBUG)
-   printf("nfs: mount: (%d) %s\n", 
error, strerror(error));
+   printf("nfs: mount: (%d) %s\n", error, 
strerror(error));
break;
} else {
error = EIO;
diff --git a/rtemsbsd/rtems/rtems-bsd-syscall-api.c 
b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
index 142e4faf..81361e94 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscall-api.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
@@ -889,6 +889,7 @@ rtems_bsd_sysgen_open_node(
struct vnode *cdir;
struct vnode *rdir;
const char *opath;
+   rtems_filesystem_location_info_t *rootloc;
int opathlen;
int fd;
int error;
@@ -902,6 +903,8 @@ rtems_bsd_sysgen_open_node(
 
fdp = td->td_proc->p_fd;
 
+   rootloc = &iop->pathinfo.mt_entry->mt_fs_root->location;
+
/*
 * There is no easy or clean means to open a vnode and follow the
 * POSIX open semantics. See `kern_openat`. You can open a vnode but
@@ -912,11 +915,16 @@ rtems_bsd_sysgen_open_node(
 * parent directory vnode to position ourselves in the parent
 * directory. The pathloc vnode points to the '.' or '..'  directory.
 */
-   opath = path + strlen(path);
-   opathlen = 0;
-   while (opath != path && !rtems_filesystem_is_delimiter(opath[-1])) {
-   opath--;
-   opathlen++;
+   if (rtems_bsd_libio_loc_to_vnode(&iop->pathinfo) ==
+   rtems_bsd_libio_loc_to_vnode(rootloc)) {
+   opath = ".";
+   } else {
+   opath = path + strlen(path);
+   opathlen = 0;
+   while (opath != path && 
!rtems_filesystem_is_delimiter(opath[-1])) {
+   opath--;
+   opathlen++;
+   }
}
if (rtems_filesystem_is_current_directory(opath, opathlen) ||
rtems_filesystem_is_parent_directory(opath, opathlen)) {
@@ -929,8 +937,6 @@ rtems_bsd_sysgen_open_node(
opath = ".";
cdir = rtems_bsd_libio_loc_to_vnode(&iop->pathinfo);
} else {
-   rtems_filesystem_location_info_t *rootloc =
-   &iop->pathinfo.mt_entry->mt_fs_root->locat

v2 Patches to fix #4723

2023-07-20 Thread chrisj
Hi,

This verison:

1. Fixes the comment after the review
2. The nfs01 test exits when finished rather than stopping in the shell
3. Add a fix to allow multiple mounts with the same mount basename

Chris

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


[PATCH rtems-libbsd/6-freebsd-12 v2 2/4] syscall/open: Reference the path info directory vnode

2023-07-20 Thread chrisj
From: Chris Johns 

The kernel open call requires a path so to open a file we need to
set the current directory to the parent vnode. If the open mode is
create the path info vnode is the directory to perform the open
create in. Using the parent node creates the file in wrong path.

Updates #4723
---
 rtemsbsd/rtems/rtems-bsd-syscall-api.c | 24 ++--
 testsuite/nfs01/test_main.c| 81 +-
 2 files changed, 71 insertions(+), 34 deletions(-)

diff --git a/rtemsbsd/rtems/rtems-bsd-syscall-api.c 
b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
index 76fc8ad7..142e4faf 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscall-api.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
@@ -931,9 +931,18 @@ rtems_bsd_sysgen_open_node(
} else {
rtems_filesystem_location_info_t *rootloc =
&iop->pathinfo.mt_entry->mt_fs_root->location;
+   /*
+* We need the parent directory so open can find the
+* entry. If we are creating the file the pathinfo
+* vnode entry is the directory open uses to create
+* the file in.
+*/
cdir = rtems_bsd_libio_loc_to_vnode_dir(&iop->pathinfo);
+   if (cdir == NULL || creat) {
+   cdir = rtems_bsd_libio_loc_to_vnode(&iop->pathinfo);
+   }
if (fdp->fd_cdir == NULL) {
-   cdir = rtems_bsd_libio_loc_to_vnode(rootloc);
+   cdir = rtems_bsd_libio_loc_to_vnode_dir(rootloc);
} else if (rtems_bsd_libio_loc_to_vnode(&iop->pathinfo) ==
rtems_bsd_libio_loc_to_vnode(rootloc)) {
/*
@@ -958,11 +967,14 @@ rtems_bsd_sysgen_open_node(
FILEDESC_XUNLOCK(fdp);
 
if (RTEMS_BSD_SYSCALL_TRACE) {
-   printf("bsd: sys: open: path=%s opath=%s vn=%p cwd=%p"
-  " flags=%08x mode=%08x isdir=%s\n",
-   path, opath,
-   creat ? NULL : rtems_bsd_libio_loc_to_vnode(&iop->pathinfo),
-   fdp->fd_cdir, oflag, mode, isdir ? "yes" : "no");
+   struct vnode* _vn = 
rtems_bsd_libio_loc_to_vnode(&iop->pathinfo);
+   struct vnode* _dvn = 
rtems_bsd_libio_loc_to_vnode_dir(&iop->pathinfo);
+   printf("bsd: sys: open: path=%s opath=%s vn=%p (%c) dvn=%p (%c) 
cwd=%p"
+  " flags=%08x mode=%o isdir=%s\n",
+  path, opath,
+  _vn, creat ? 'c' : _vn ? (_vn->v_type == VDIR ? 'd' : 
'r') : 'n',
+  _dvn,  _dvn ? (_dvn->v_type == VDIR ? 'd' : 'r') : 'n',
+  fdp->fd_cdir, oflag, mode, isdir ? "yes" : "no");
}
 
VREF(fdp->fd_cdir);
diff --git a/testsuite/nfs01/test_main.c b/testsuite/nfs01/test_main.c
index cfa163e1..cdcbb1cd 100644
--- a/testsuite/nfs01/test_main.c
+++ b/testsuite/nfs01/test_main.c
@@ -46,18 +46,27 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
 #include 
 
+#define END_TEST_IN_SHELL 0
+
 #define TEST_NAME "LIBBSD NFS 1"
 #define TEST_STATE_USER_INPUT 1
 #define TEST_WAIT_FOR_LINKNET_CFG_INTERFACE_0
 
 static const char *test_top = "test-nfs01";
 
+#define rtems_test_assert(__exp) \
+  do { \
+if (!(__exp)) { \
+  printf( "%s: %d %s\n", __FILE__, __LINE__, #__exp ); \
+  assert(1 == 0); \
+} \
+  } while (0)
+
 #define rtems_test_errno_assert(__exp) \
   do { \
 if (!(__exp)) { \
@@ -328,10 +337,46 @@ test_path_eval(const char *base, int depth)
test_cleanup(base);
 }
 
+static void
+test_path_file_copy(const char *base, int depth)
+{
+   char path[MAXPATHLEN];
+   struct stat sb;
+   FILE* f;
+   int l;
+
+   printf("test path eval\n");
+
+   test_setup(base);
+
+   memset(path, 0, sizeof(path));
+
+   for (l = 1; l <= depth; ++l) {
+   char* p = path + strlen(path);
+   if (l > 1) {
+   *p++ = '/';
+   }
+   snprintf(p, sizeof(path), "%d", l);
+   printf("test: nfs: mkdir: %s\n", path);
+   rtems_test_errno_assert(mkdir(path, 0777) == 0);
+   }
+
+   strlcat(path, "/test-file.txt", sizeof(path));
+   printf("Create file %s\n", path);
+   rtems_test_errno_assert((f = fopen(path, "w")) != NULL);
+   rtems_test_errno_assert(fprintf(f, "The contents of %s\nNFS test\n", 
path) > 0);
+   rtems_test_errno_assert(fclose(f) == 0);
+   printf("Checking %s has been copied\n", path);
+   rtems_test_errno_assert(stat(path, &sb) == 0);
+
+   test_cleanup(base);
+}
+
 static void
 test_nfs(const char *base)
 {
test_path_eval(base, 5);
+   test_path_file_copy(base, 3);
 #if NFS_TREE_WALK
test_printer_data pd;
memset(&pd, 0, sizeof(pd));
@@ -339,30 +384,6 @@ test_nfs(const char *base)
 #endif
 }
 
-static void
-telnet_shell(char *name, void *arg)
-{
-   

[PATCH rtems-libbsd/6-freebsd-12 v2 1/4] freenbsd/vfs: VFS attributes need to have the same size mode_t variable

2023-07-20 Thread chrisj
From: Chris Johns 

If the size in the attributes struct does not match the mode_t the
VNOVAL checks fail because size of the values are not the same.

Updates #4723
---
 freebsd/sys/sys/vnode.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/freebsd/sys/sys/vnode.h b/freebsd/sys/sys/vnode.h
index d297c931..ddb9ac30 100644
--- a/freebsd/sys/sys/vnode.h
+++ b/freebsd/sys/sys/vnode.h
@@ -266,8 +266,12 @@ struct xvnode {
  */
 struct vattr {
enum vtype  va_type;/* vnode type (for create) */
+#ifndef __rtems__
u_short va_mode;/* files access mode and type */
u_short va_padding0;
+#else /* __rtems__ */
+   mode_t  va_mode;/* files access mode and type */
+#endif /* __rtems__ */
uid_t   va_uid; /* owner user id */
gid_t   va_gid; /* owner group id */
nlink_t va_nlink;   /* number of references to file */
-- 
2.37.1

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


[PATCH rtems-libbsd/6-freebsd-12 2/3] syscall/open: Reference the path info directory vnode

2023-07-19 Thread chrisj
From: Chris Johns 

The kernel open call requires a path so to open a file we need to
set the current directory to the parent vnode. If the open mode is
create the path info vnode is the directory to perform the open
create in. Using the parent node creates the file in wrong path.

Updates #4723
---
 rtemsbsd/rtems/rtems-bsd-syscall-api.c | 24 ++---
 testsuite/nfs01/test_main.c| 75 --
 2 files changed, 64 insertions(+), 35 deletions(-)

diff --git a/rtemsbsd/rtems/rtems-bsd-syscall-api.c 
b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
index 76fc8ad7..cfceb768 100644
--- a/rtemsbsd/rtems/rtems-bsd-syscall-api.c
+++ b/rtemsbsd/rtems/rtems-bsd-syscall-api.c
@@ -931,9 +931,18 @@ rtems_bsd_sysgen_open_node(
} else {
rtems_filesystem_location_info_t *rootloc =
&iop->pathinfo.mt_entry->mt_fs_root->location;
+   /*
+* We need the parent directory so open can find the
+* the entry. If we are creating the file the pathinfo
+* vnode entry is the directory to create open the
+* file in.
+*/
cdir = rtems_bsd_libio_loc_to_vnode_dir(&iop->pathinfo);
+   if (cdir == NULL || creat) {
+   cdir = rtems_bsd_libio_loc_to_vnode(&iop->pathinfo);
+   }
if (fdp->fd_cdir == NULL) {
-   cdir = rtems_bsd_libio_loc_to_vnode(rootloc);
+   cdir = rtems_bsd_libio_loc_to_vnode_dir(rootloc);
} else if (rtems_bsd_libio_loc_to_vnode(&iop->pathinfo) ==
rtems_bsd_libio_loc_to_vnode(rootloc)) {
/*
@@ -958,11 +967,14 @@ rtems_bsd_sysgen_open_node(
FILEDESC_XUNLOCK(fdp);
 
if (RTEMS_BSD_SYSCALL_TRACE) {
-   printf("bsd: sys: open: path=%s opath=%s vn=%p cwd=%p"
-  " flags=%08x mode=%08x isdir=%s\n",
-   path, opath,
-   creat ? NULL : rtems_bsd_libio_loc_to_vnode(&iop->pathinfo),
-   fdp->fd_cdir, oflag, mode, isdir ? "yes" : "no");
+   struct vnode* _vn = 
rtems_bsd_libio_loc_to_vnode(&iop->pathinfo);
+   struct vnode* _dvn = 
rtems_bsd_libio_loc_to_vnode_dir(&iop->pathinfo);
+   printf("bsd: sys: open: path=%s opath=%s vn=%p (%c) dvn=%p (%c) 
cwd=%p"
+  " flags=%08x mode=%o isdir=%s\n",
+  path, opath,
+  _vn, creat ? 'c' : _vn ? (_vn->v_type == VDIR ? 'd' : 
'r') : 'n',
+  _dvn,  _dvn ? (_dvn->v_type == VDIR ? 'd' : 'r') : 'n',
+  fdp->fd_cdir, oflag, mode, isdir ? "yes" : "no");
}
 
VREF(fdp->fd_cdir);
diff --git a/testsuite/nfs01/test_main.c b/testsuite/nfs01/test_main.c
index cfa163e1..4ef82b44 100644
--- a/testsuite/nfs01/test_main.c
+++ b/testsuite/nfs01/test_main.c
@@ -46,7 +46,6 @@
 
 #include 
 #include 
-#include 
 
 #include 
 
@@ -58,6 +57,14 @@
 
 static const char *test_top = "test-nfs01";
 
+#define rtems_test_assert(__exp) \
+  do { \
+if (!(__exp)) { \
+  printf( "%s: %d %s\n", __FILE__, __LINE__, #__exp ); \
+  assert(1 == 0); \
+} \
+  } while (0)
+
 #define rtems_test_errno_assert(__exp) \
   do { \
 if (!(__exp)) { \
@@ -328,10 +335,46 @@ test_path_eval(const char *base, int depth)
test_cleanup(base);
 }
 
+static void
+test_path_file_copy(const char *base, int depth)
+{
+   char path[MAXPATHLEN];
+   struct stat sb;
+   FILE* f;
+   int l;
+
+   printf("test path eval\n");
+
+   test_setup(base);
+
+   memset(path, 0, sizeof(path));
+
+   for (l = 1; l <= depth; ++l) {
+   char* p = path + strlen(path);
+   if (l > 1) {
+   *p++ = '/';
+   }
+   snprintf(p, sizeof(path), "%d", l);
+   printf("test: nfs: mkdir: %s\n", path);
+   rtems_test_errno_assert(mkdir(path, 0777) == 0);
+   }
+
+   strlcat(path, "/test-file.txt", sizeof(path));
+   printf("Create file %s\n", path);
+   rtems_test_errno_assert((f = fopen(path, "w")) != NULL);
+   rtems_test_errno_assert(fprintf(f, "The contents of %s\nNFS test\n", 
path) > 0);
+   rtems_test_errno_assert(fclose(f) == 0);
+   printf("Checking %s has been copied\n", path);
+   rtems_test_errno_assert(stat(path, &sb) == 0);
+
+   test_cleanup(base);
+}
+
 static void
 test_nfs(const char *base)
 {
test_path_eval(base, 5);
+   test_path_file_copy(base, 3);
 #if NFS_TREE_WALK
test_printer_data pd;
memset(&pd, 0, sizeof(pd));
@@ -339,30 +382,6 @@ test_nfs(const char *base)
 #endif
 }
 
-static void
-telnet_shell(char *name, void *arg)
-{
-   rtems_shell_env_t env;
-
-   rtems_shell_dup_current_env(&env);
-
-   env.devname = name;
-   env.taskname = "TLNT";
-   env.

[PATCH rtems-libbsd/6-freebsd-12 1/3] freenbsd/vfs: VFS attributes need to have the same size mode_t variable

2023-07-19 Thread chrisj
From: Chris Johns 

If the size in the attributes struct does not match the mode_t the
VNOVAL checks fail because sie of the values are not the same.

Updates #4723
---
 freebsd/sys/sys/vnode.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/freebsd/sys/sys/vnode.h b/freebsd/sys/sys/vnode.h
index d297c931..ddb9ac30 100644
--- a/freebsd/sys/sys/vnode.h
+++ b/freebsd/sys/sys/vnode.h
@@ -266,8 +266,12 @@ struct xvnode {
  */
 struct vattr {
enum vtype  va_type;/* vnode type (for create) */
+#ifndef __rtems__
u_short va_mode;/* files access mode and type */
u_short va_padding0;
+#else /* __rtems__ */
+   mode_t  va_mode;/* files access mode and type */
+#endif /* __rtems__ */
uid_t   va_uid; /* owner user id */
gid_t   va_gid; /* owner group id */
nlink_t va_nlink;   /* number of references to file */
-- 
2.37.1

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


[PATCH rtems-libbsd/6-freebsd-12 3/3] freebsd/vfs: Pass in the td's cred to the VFS calls

2023-07-19 Thread chrisj
From: Chris Johns 

Closes #4723
---
 rtemsbsd/rtems/rtems-kernel-vfs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtemsbsd/rtems/rtems-kernel-vfs.c 
b/rtemsbsd/rtems/rtems-kernel-vfs.c
index 2f4d009b..0817df81 100644
--- a/rtemsbsd/rtems/rtems-kernel-vfs.c
+++ b/rtemsbsd/rtems/rtems-kernel-vfs.c
@@ -490,7 +490,7 @@ rtems_bsd_vfs_fchmod(const rtems_filesystem_location_info_t 
*loc, mode_t mode)
}
return rtems_bsd_error_to_status_and_errno(ENOMEM);
}
-   error = setfmode(td, NULL, vp, mode);
+   error = setfmode(td, td->td_ucred, vp, mode);
return rtems_bsd_error_to_status_and_errno(error);
 }
 
@@ -511,7 +511,7 @@ rtems_bsd_vfs_chown(
}
return rtems_bsd_error_to_status_and_errno(ENOMEM);
}
-   error = setfown(td, NULL, vp, owner, group);
+   error = setfown(td, td->td_ucred, vp, owner, group);
return rtems_bsd_error_to_status_and_errno(error);
 }
 
-- 
2.37.1

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


[RSB PATCH] rtems/net-services: Add to the ntpq query an output buffer and size

2023-06-08 Thread chrisj
From: Chris Johns 

---
 rtems/config/net/net-services-1.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/net/net-services-1.cfg 
b/rtems/config/net/net-services-1.cfg
index c342547..bf1bdc8 100644
--- a/rtems/config/net/net-services-1.cfg
+++ b/rtems/config/net/net-services-1.cfg
@@ -9,9 +9,9 @@
 #
 # Net Services Version
 #
-%define rtems_net_services_version e35f89b6bf8170b5556a90535ed2f1f6b7473d81
+%define rtems_net_services_version fe0706060e5687a99c01d155e05d25bc34915ae1
 %hash sha512 rtems-net-services-%{rtems_net_services_version}.tar.bz2 \
-   
CqubUTOMm3zohNpOYft5QPTqhl9qEuBo3wcQ5tOTZGRwOMzwQ+3tRyl8ZrcgdTtoV7fIZCoJt5Ty5zTeANdMCQ==
+   
5R/rhW3Supzw7KvDdkVYrWt3y3mxZ8hubwA8HpWtAZosWVlEauGvUpCfh1CthrHKHJ6uW1NpmewoAaZ9T25jsA==
 
 %define rtems_waf_version 68654b4f995382765605dc16917baad4bdbf7f7c
 %hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 \
-- 
2.37.1

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


[RSB PATCH 2/2] rtems/kernel: Update kernel

2023-06-04 Thread chrisj
From: Chris Johns 

- Zynq ARM fixes

- AARCH64 MMU fix

- Updated imxrt drivers

- x86_64 EFI support

- Flash driver

- Updated validation tests

- Microblaze updates
---
 rtems/config/tools/rtems-kernel-6.cfg | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index e2f1d68..f2174c7 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 6
 #
 
-%define rtems_kernel_version 5a37722b066f5792aad80fb5b32fb3c056cf1607
+%define rtems_kernel_version a83dc4a469429e29cdd18eddbd1b9fff3f4328d8
 
 %hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-   
UcZlhl2FZhvDKXZnPLnJSYnMQwSgWluTBGfoLII9vNbx4ypxQPE+egN4dZ06H3l5MprrJY96mgNZTfLjI2itcQ==
+   
baWt7QkFo2YlzV4pTnnZ8agonhdrWN4Z8yMgV6/vgZs+cRw59xRq69KfWzgqVZDpaA0l3nuiLqNaxqEh2fMXMw==
 #
 # The RTEMS build instructions.
 #
-- 
2.37.1

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


[RSB PATCH 1/2] rtrems/net-legacy: Update rtems-net-legacy

2023-06-04 Thread chrisj
From: Chris Johns 

- Add getaddrinfom, gai_strerror, ipv6_addr, if_nametoindex and BSD programs

- Update sysctl

- Move legacy net
---
 rtems/config/tools/rtems-net-legacy-6.cfg | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/rtems/config/tools/rtems-net-legacy-6.cfg 
b/rtems/config/tools/rtems-net-legacy-6.cfg
index 984ba09..8834228 100644
--- a/rtems/config/tools/rtems-net-legacy-6.cfg
+++ b/rtems/config/tools/rtems-net-legacy-6.cfg
@@ -3,10 +3,10 @@
 #
 
 #  branch: main
-%define rtems_net_version d22fbcb0412e309850c0f49ab61bc410184b9b5c
+%define rtems_net_version ad5ae9e4d81f227b521e2dc7441aca2accb0966e
 %hash sha512 rtems-net-legacy-%{rtems_net_version}.tar.bz2 \
- 
eKESsJ4ra5kbF+IjMvhlLriGUxC2vCfKy/7bnkZyrhcBnfkpIWWqzEj1eB2iqfpy/1p+hcnxIh00ysJF66ptkw==
+   
H6CgbCziHrFgvDqZkGJq0Y5vbl/WxNTobdjeu7Adb0FGsp6l4pOoQvZ/G1J4CgBuwJLrKi9sCVrW4VatqOwH4Q==
 %define rtems_waf_version 2c15b90de5c369aa78cd2252a50bba677e9b13f3
 %hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 \
- 
gSpj/vTcB9T985HC9xi//gMcYj9rl6AedULvPdFppJ7D1CFIueE+MyfGn+okVtZvnG+tZk1JkR2gvIQNV3mXbQ==
+   
gSpj/vTcB9T985HC9xi//gMcYj9rl6AedULvPdFppJ7D1CFIueE+MyfGn+okVtZvnG+tZk1JkR2gvIQNV3mXbQ==
 %include tools/rtems-net-legacy-common.cfg
-- 
2.37.1

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


[RSB PATCH] rtems/net: Add net services build support

2023-06-04 Thread chrisj
From: Chris Johns 

---
 rtems/config/net/net-services-1.cfg   | 23 ++
 rtems/config/net/net-services.bset| 15 
 rtems/config/tools/rtems-net-services.cfg | 91 +++
 3 files changed, 129 insertions(+)
 create mode 100644 rtems/config/net/net-services-1.cfg
 create mode 100644 rtems/config/net/net-services.bset
 create mode 100644 rtems/config/tools/rtems-net-services.cfg

diff --git a/rtems/config/net/net-services-1.cfg 
b/rtems/config/net/net-services-1.cfg
new file mode 100644
index 000..c342547
--- /dev/null
+++ b/rtems/config/net/net-services-1.cfg
@@ -0,0 +1,23 @@
+#
+# RTEMS Net Services
+#
+
+%if %{release} == %{nil}
+ %define release 1
+%endif
+
+#
+# Net Services Version
+#
+%define rtems_net_services_version e35f89b6bf8170b5556a90535ed2f1f6b7473d81
+%hash sha512 rtems-net-services-%{rtems_net_services_version}.tar.bz2 \
+   
CqubUTOMm3zohNpOYft5QPTqhl9qEuBo3wcQ5tOTZGRwOMzwQ+3tRyl8ZrcgdTtoV7fIZCoJt5Ty5zTeANdMCQ==
+
+%define rtems_waf_version 68654b4f995382765605dc16917baad4bdbf7f7c
+%hash sha512 rtems-waf-%{rtems_waf_version}.tar.bz2 \
+   
NAuyFxjfSiQd6VfYZl4fJClywPrLF2fN+GjXHjq3ddceqaBrSeHZ+XpYpU3XTnk2qKICsUSTLV+CskDuWdwqvQ==
+
+#
+# Net Services Build configuration
+#
+%include %{_configdir}/tools/rtems-net-services.cfg
diff --git a/rtems/config/net/net-services.bset 
b/rtems/config/net/net-services.bset
new file mode 100644
index 000..7d90399
--- /dev/null
+++ b/rtems/config/net/net-services.bset
@@ -0,0 +1,15 @@
+#
+# Build set for RTEMS Net Services
+#
+
+%define release 1
+
+#
+# The RTEMS Package defines
+#
+%include rtems-package.bset
+
+#
+# Build Net Services
+#
+net/net-services-1
diff --git a/rtems/config/tools/rtems-net-services.cfg 
b/rtems/config/tools/rtems-net-services.cfg
new file mode 100644
index 000..2acfbd8
--- /dev/null
+++ b/rtems/config/tools/rtems-net-services.cfg
@@ -0,0 +1,91 @@
+#
+# RTEMS Net Services
+#
+# This configuration file configure's, build's and install's
+# networking services libraries
+#
+
+%if %{release} == %{nil}
+%define release 1
+%endif
+
+Name:  rtems-net-services-%{rtems_net_services_version}-%{_host}-%{release}
+Summary:   RTEMS Net Services provides networking services for RTEMS networking
+   stacks.
+Version:   %{rtems_net_services_version}
+Release:   %{release}
+URL:   https://git.rtems.org/rtems-net-services.git/
+
+#
+# Net services is packaged as the release version when released.
+#
+%if %{rsb_released}
+ %define rtems_net_services_version %{rsb_version}
+ %define rtems_net_services_ext xz
+ %define rtems_waf_ext xz
+%else
+ %define rtems_net_services_ext bz2
+ %define rtems_waf_ext bz2
+%endif
+
+#
+# RTEMS BSP support.
+#
+%include rtems-bsp.cfg
+
+#
+# Net services Source.
+#
+#  If not a release collect and install rtems_waf as cgit snapshots to not
+#  capture submodules.
+#
+#  Releases package submodules in the top level tarfile.
+#
+%source set rtems_net_services 
--rsb-file=rtems-net-services-%{rtems_net_services_version}.tar.%{rtems_net_services_ext}
 \
+  
https://git.rtems.org/rtems-net-services/snapshot/rtems-net-services-%{rtems_net_services_version}.tar.%{rtems_net_services_ext}
+%if !%{rsb_released}
+ %source set rtems_waf \
+  
https://git.rtems.org/rtems_waf/snapshot/rtems_waf-%{rtems_waf_version}.tar.%{rtems_waf_ext}
+%endif
+
+#
+# Prepare the source code.
+#
+%prep
+  build_top=$(pwd)
+
+  source_dir_net_services="rtems-net-services-%{rtems_net_services_version}"
+  %source setup rtems_net_services -q -n 
rtems-net-services-%{rtems_net_services_version}
+  %if !%{rsb_released}
+   %source setup rtems_waf -q -s 1 -c -a -n 
rtems-net-services-%{rtems_net_services_version}/rtems_waf
+  %endif
+  cd ${build_top}
+
+#
+# Build the source code.
+#
+%build
+  build_top=$(pwd)
+
+  %{host_build_flags}
+
+  cd ${source_dir_net_services}
+
+  ./waf distclean configure \
+--prefix=%{_prefix} \
+%{rtems_waf_tools} \
+%{rtems_waf_rtems} \
+--rtems-bsp=%{rtems_bsp_arch_bsp}
+
+  ./waf build
+
+  cd ${build_top}
+
+%install
+  build_top=$(pwd)
+
+  %{__rmdir} ${SB_BUILD_ROOT}
+
+  cd ${source_dir_net_services}
+  ./waf --destdir=$SB_BUILD_ROOT%{rtems_waf_build_root_suffix} install
+  cd ${build_top}
-- 
2.37.1

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


[rtems-net-legacy PATCH] testsuites: Build testsuites/support as a static library

2023-06-04 Thread chrisj
From: Chris Johns 

This avoids dependency issues if the source files are added
to separate program builds.
---
 netlegacy.py| 56 +
 testsuites/ftp01/wscript|  4 ++-
 testsuites/loopback/wscript |  5 +--
 testsuites/networking01/wscript |  5 +--
 testsuites/pppd/wscript |  4 ++-
 testsuites/resolve/wscript  |  8 ++---
 testsuites/support/wscript  | 47 +++
 testsuites/syscall01/wscript|  5 +--
 testsuites/telnetd01/wscript|  4 ++-
 testsuites/telnetd02/wscript|  8 ++---
 testsuites/wscript  | 50 -
 11 files changed, 130 insertions(+), 66 deletions(-)
 create mode 100644 testsuites/support/wscript

diff --git a/netlegacy.py b/netlegacy.py
index c1882e6..009b8b7 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -51,48 +51,7 @@ def version_header(bld):
 bld(target='include/machine/rtems-net-legacy.h',
 source='include/machine/rtems-net-legacy.h.in',
 rule=sed + ' < ${SRC} > ${TGT}',
-update_outputs=True)
-
-
-def net_config_header(bld):
-if not os.path.exists(bld.env.NET_CONFIG):
-bld.fatal('network configuraiton \'%s\' not found' %
-  (bld.env.NET_CONFIG))
-net_tags = [
-'NET_CFG_IFACE', 'NET_CFG_BOOT_PROT', 'NET_CFG_SELF_IP',
-'NET_CFG_NETMASK', 'NET_CFG_MAC_ADDR', 'NET_CFG_GATEWAY_IP',
-'NET_CFG_DOMAINNAME', 'NET_CFG_DNS_IP', 'NET_CFG_NTP_IP'
-]
-try:
-net_cfg_lines = open(bld.env.NET_CONFIG).readlines()
-except:
-bld.fatal('network configuraiton \'%s\' read failed' %
-  (bld.env.NET_CONFIG))
-lc = 0
-sed = 'sed '
-net_defaults = {}
-for l in net_cfg_lines:
-lc += 1
-if not l.strip().startswith('NET_CFG_'):
-bld.fatal('network configuration \'%s\' ' \
-  'invalid config: %d: %s' % (bld.env.NET_CONFIG, lc, l))
-ls = l.split('=')
-if len(ls) != 2:
-bld.fatal('network configuration \'%s\' ' \
-  'parse error: %d: %s' % (bld.env.NET_CONFIG, lc, l))
-lhs = ls[0].strip()
-rhs = ls[1].strip()
-if lhs in net_tags:
-net_defaults[lhs] = rhs
-else:
-bld.fatal('network configuration \'%s\' ' \
-  'invalid config: %d: %s' % (bld.env.NET_CONFIG, lc, l))
-for cfg in net_defaults:
-sed += "-e 's/@%s@/%s/' " % (cfg, net_defaults[cfg])
-bld(target=bld.env.NETWORK_CONFIG,
-source='testsuites/include/network-config.h.in',
-rule=sed + ' < ${SRC} > ${TGT}',
-update_outputs=True)
+shell=True)
 
 
 def options(opt):
@@ -105,10 +64,11 @@ def options(opt):
  default='-O2',
  dest='optimization',
  help='Optimaization level (default: %default)')
-copts.add_option('--enable-warnings',
- action='store_true',
- dest='warnings',
- help='Enable warnings for all sources (default: 
%default)')
+copts.add_option(
+'--enable-warnings',
+action='store_true',
+dest='warnings',
+help='Enable warnings for all sources (default: %default)')
 
 
 def bsp_configure(conf, arch_bsp, mandatory=True):
@@ -164,7 +124,6 @@ def build(bld):
 ab = rtems.arch_bsp_name(bld.env.RTEMS_ARCH_BSP)
 
 version_header(bld)
-net_config_header(bld)
 
 bld.add_group()
 
@@ -215,6 +174,7 @@ def build(bld):
 header)
 bld.install_as(
 os.path.join(bld.env.PREFIX, arch_inc_path, 'machine',
- 'rtems-net-legacy.h'), 
'include/machine/rtems-net-legacy.h')
+ 'rtems-net-legacy.h'),
+'include/machine/rtems-net-legacy.h')
 
 bld.add_group()
diff --git a/testsuites/ftp01/wscript b/testsuites/ftp01/wscript
index 550b0b5..6826584 100644
--- a/testsuites/ftp01/wscript
+++ b/testsuites/ftp01/wscript
@@ -39,11 +39,13 @@ def configure(conf):
 
 def build(bld):
 source = ['init.c']
+cflags = bld.env.OPTIMIZATION + bld.env.WARNINGS + ['-g']
 bld.program(target='ftp01.exe',
 features='c cprogram',
-cflags=bld.env.OPTIMIZATION + ['-g'],
+cflags=cflags,
 includes=bld.env.IFLAGS,
 lib=['ftpfs', 'ftpd', 'networking'],
 libpath=['.'],
+use=['testsupport'],
 source=source,
 install_path=False)
diff --git a/testsuites/loopback/wscript b/testsuites/loopback/wscript
index bc7bd9a..0350388 100644
--- a/testsuites/loopback/wscript
+++ b/testsuites/loopback/wscript
@@ -39,10 +39,11 @@ def configure(conf):
 
 def build(bld):
 source = ['init.c']
+cflags = bld.env.OPTIMIZATION + bld.env.WARNINGS + ['-g']
 bld.program(target='loopback.exe',
 features='c cprogram',
-  

[rtems-net-legacy PATCH] waf: Move rtems/rtems-net-legacy.h to machine/rtems-net-legacy.h

2023-05-24 Thread chrisj
From: Chris Johns 

This patch installs the header in the same path as the libbsd header
machine/rtems-version.h. These headers can be used to detect
which network stack is installed.
---
 include/{rtems => machine}/rtems-net-legacy.h.in | 0
 netlegacy.py | 8 
 2 files changed, 4 insertions(+), 4 deletions(-)
 rename include/{rtems => machine}/rtems-net-legacy.h.in (100%)

diff --git a/include/rtems/rtems-net-legacy.h.in 
b/include/machine/rtems-net-legacy.h.in
similarity index 100%
rename from include/rtems/rtems-net-legacy.h.in
rename to include/machine/rtems-net-legacy.h.in
diff --git a/netlegacy.py b/netlegacy.py
index 8533f4c..c1882e6 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -48,8 +48,8 @@ def version_header(bld):
 sed = 'sed '
 for cfg in versions:
 sed += "-e 's/@%s@/%s/' " % (cfg, versions[cfg])
-bld(target='include/rtems/rtems-net-legacy.h',
-source='include/rtems/rtems-net-legacy.h.in',
+bld(target='include/machine/rtems-net-legacy.h',
+source='include/machine/rtems-net-legacy.h.in',
 rule=sed + ' < ${SRC} > ${TGT}',
 update_outputs=True)
 
@@ -214,7 +214,7 @@ def build(bld):
 os.path.join(bld.env.PREFIX, arch_inc_path, inc_dir, hname),
 header)
 bld.install_as(
-os.path.join(bld.env.PREFIX, arch_inc_path, 'rtems',
- 'rtems-net-legacy.h'), 'include/rtems/rtems-net-legacy.h')
+os.path.join(bld.env.PREFIX, arch_inc_path, 'machine',
+ 'rtems-net-legacy.h'), 
'include/machine/rtems-net-legacy.h')
 
 bld.add_group()
-- 
2.37.1

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


[PATCH] bsps/powerpc: Fix warnings with PPC_SPECIAL_PURPOSE_REGISTER

2023-04-24 Thread chrisj
From: Chris Johns 

---
 bsps/powerpc/gen83xx/start/bsprestart.c   |  2 +-
 bsps/powerpc/gen83xx/start/cpuinit.c  |  2 +-
 bsps/powerpc/mpc55xxevb/start/bspstart.c  |  2 +-
 bsps/powerpc/mpc55xxevb/start/flash_support.c | 10 +-
 bsps/powerpc/qoriq/irq/irq.c  |  2 +-
 bsps/powerpc/qoriq/start/mmu.c|  7 ---
 6 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/bsps/powerpc/gen83xx/start/bsprestart.c 
b/bsps/powerpc/gen83xx/start/bsprestart.c
index dec25e8c13..ab0c994ea0 100644
--- a/bsps/powerpc/gen83xx/start/bsprestart.c
+++ b/bsps/powerpc/gen83xx/start/bsprestart.c
@@ -46,7 +46,7 @@ void bsp_restart(void *addr)
   rtems_interrupt_disable(level);
   (void) level; /* avoid set but not used warning */
 
-  hid0 = PPC_SPECIAL_PURPOSE_REGISTER(HID0);
+  PPC_SPECIAL_PURPOSE_REGISTER(HID0, hid0);
 
   if ((hid0 & HID0_DCE) != 0) {
 rtems_cache_flush_multiple_data_lines(mem_begin, mem_size);
diff --git a/bsps/powerpc/gen83xx/start/cpuinit.c 
b/bsps/powerpc/gen83xx/start/cpuinit.c
index 1e867bb323..feeda59766 100644
--- a/bsps/powerpc/gen83xx/start/cpuinit.c
+++ b/bsps/powerpc/gen83xx/start/cpuinit.c
@@ -93,7 +93,7 @@ void cpu_init( void)
   clear_mmu_regs();
 
   /* Clear caches */
-  hid0 = PPC_SPECIAL_PURPOSE_REGISTER(HID0);
+  PPC_SPECIAL_PURPOSE_REGISTER(HID0, hid0);
   if ((hid0 & (HID0_ICE | HID0_DCE)) == 0) {
 hid0 &= ~(HID0_ILOCK | HID0_DLOCK | HID0_ICE | HID0_DCE);
 PPC_SET_SPECIAL_PURPOSE_REGISTER(HID0, hid0);
diff --git a/bsps/powerpc/mpc55xxevb/start/bspstart.c 
b/bsps/powerpc/mpc55xxevb/start/bspstart.c
index 4c4bd87462..a24d3a394a 100644
--- a/bsps/powerpc/mpc55xxevb/start/bspstart.c
+++ b/bsps/powerpc/mpc55xxevb/start/bspstart.c
@@ -69,7 +69,7 @@ static void null_pointer_protection(void)
 
PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS0, mmu.MAS0.R);
__asm__ volatile ("tlbre");
-   mmu.MAS1.R = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1);
+   PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, mmu.MAS1.R);
mmu.MAS1.B.VALID = 0;
PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, mmu.MAS1.R);
__asm__ volatile ("tlbwe");
diff --git a/bsps/powerpc/mpc55xxevb/start/flash_support.c 
b/bsps/powerpc/mpc55xxevb/start/flash_support.c
index c7382ca4d4..a6dfe119e5 100644
--- a/bsps/powerpc/mpc55xxevb/start/flash_support.c
+++ b/bsps/powerpc/mpc55xxevb/start/flash_support.c
@@ -297,9 +297,9 @@ addr_map(
   rtems_interrupt_disable(level);
   PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS0, mas0);
   asm volatile("tlbre");
-  mas1 = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1);
-  mas2 = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS2);
-  mas3 = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS3);
+  PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, mas1);
+  PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS2, mas2);
+  PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS3, mas3);
   rtems_interrupt_enable(level);
 
   if (mas1 & 0x8000) {
@@ -671,7 +671,7 @@ mpc55xx_flash_writable(void)
 rtems_interrupt_disable(level);
 PPC_SET_SPECIAL_PURPOSE_REGISTER( FSL_EIS_MAS0, 0x1001);
 asm volatile("tlbre");
-mas3 = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS3);
+PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS3, mas3);
 rtems_interrupt_enable(level);
 
 return ((mas3 & 0x000C) == 0x000C) ? 1 : 0;
@@ -689,7 +689,7 @@ mpc55xx_flash_address(void)
 rtems_interrupt_disable(level);
 PPC_SET_SPECIAL_PURPOSE_REGISTER( FSL_EIS_MAS0, 0x1001);
 asm volatile("tlbre");
-mas2 = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS2);
+PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS2, mas2);
 rtems_interrupt_enable(level);
 
 return mas2 & 0xF000;
diff --git a/bsps/powerpc/qoriq/irq/irq.c b/bsps/powerpc/qoriq/irq/irq.c
index 6f7f6a1378..dcc213e7ed 100644
--- a/bsps/powerpc/qoriq/irq/irq.c
+++ b/bsps/powerpc/qoriq/irq/irq.c
@@ -180,7 +180,7 @@ void bsp_interrupt_dispatch(uintptr_t exception_number)
 * This works only if the "has-external-proxy" property is present in 
the
 * "epapr,hv-pic" device tree node.
 */
-   vector = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_EPR);
+   PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_EPR, vector);
 
if (vector != SPURIOUS) {
uint32_t msr;
diff --git a/bsps/powerpc/qoriq/start/mmu.c b/bsps/powerpc/qoriq/start/mmu.c
index acd481fe12..14a147681d 100644
--- a/bsps/powerpc/qoriq/start/mmu.c
+++ b/bsps/powerpc/qoriq/start/mmu.c
@@ -367,10 +367,11 @@ void qoriq_mmu_change_perm(uint32_t test, uint32_t set, 
uint32_t clear)
ppc_tlbre();
ppc_synchronize_instructions();
 
-   mas1 = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1);
+   PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, mas1);
if ((mas1 & FSL_EIS_MAS1_V) != 0) {
uint32_t mask = 0x3ff;
-   uint32_t mas3 = 
PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MA

[rtems-net-legacy PATCH 3/4] net: Update sysctl to use the latest libbsd linker set

2023-04-22 Thread chrisj
From: Chris Johns 

- Update linker_set.h to the latest from libbsd so the linker
  scripts work.

- Add a sysctl command to check on sysctls

- Add set defines to the networking stack
---
 netsources.py|1 +
 rtems/rtems_bsdnet.h |1 +
 rtems/rtems_glue.c   |7 +-
 rtems/rtems_showsysctl.c | 1340 ++
 sys/linker_set.h |  131 +++-
 testsuites/telnetd02/init.c  |4 +
 testsuites/telnetd02/wscript |1 +
 7 files changed, 1455 insertions(+), 30 deletions(-)
 create mode 100755 rtems/rtems_showsysctl.c

diff --git a/netsources.py b/netsources.py
index 54dbbf1..550c741 100644
--- a/netsources.py
+++ b/netsources.py
@@ -46,6 +46,7 @@ class source:
 'rtems/rtems_showipstat.c',
 'rtems/rtems_showmbuf.c',
 'rtems/rtems_showroute.c',
+'rtems/rtems_showsysctl.c',
 'rtems/rtems_showtcpstat.c',
 'rtems/rtems_showudpstat.c',
 'rtems/rtems_socketpair.c',
diff --git a/rtems/rtems_bsdnet.h b/rtems/rtems_bsdnet.h
index 4607f42..9bd3dee 100644
--- a/rtems/rtems_bsdnet.h
+++ b/rtems/rtems_bsdnet.h
@@ -48,6 +48,7 @@ void rtems_bsdnet_show_ip_stats (void);
 void rtems_bsdnet_show_icmp_stats (void);
 void rtems_bsdnet_show_udp_stats (void);
 void rtems_bsdnet_show_tcp_stats (void);
+int rtems_shell_main_sysctl(int argc, char *argv[]);
 
 /*
  * Network configuration
diff --git a/rtems/rtems_glue.c b/rtems/rtems_glue.c
index ee6c8f5..e05a2c4 100644
--- a/rtems/rtems_glue.c
+++ b/rtems/rtems_glue.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -56,6 +57,11 @@ static size_t  networkDaemonCpusetSize = 0;
 #endif
 static void networkDaemon (void *task_argument);
 
+/*
+ * SYSCTL data
+ */
+RTEMS_BSD_DEFINE_SET(sysctl_set, struct sysctl_oid *);
+
 /*
  * Network timing
  */
@@ -1261,4 +1267,3 @@ m_clalloc(int ncl, int nowait)
}
return 1;
 }
-
diff --git a/rtems/rtems_showsysctl.c b/rtems/rtems_showsysctl.c
new file mode 100755
index 000..cf3d6e2
--- /dev/null
+++ b/rtems/rtems_showsysctl.c
@@ -0,0 +1,1340 @@
+#include 
+
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (c) 1993
+ * The Regents of the University of California.  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.
+ * 3. Neither the name of the University nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS 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 REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef lint
+static const char copyright[] =
+"@(#) Copyright (c) 1993\n\
+   The Regents of the University of California.  All rights reserved.\n";
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)from: sysctl.c 8.1 (Berkeley) 6/6/93";
+#endif
+static const char rcsid[] =
+  "$FreeBSD$";
+#endif /* not lint */
+
+#ifdef __rtems__
+#define __need_getopt_newlib
+#include 
+#include 
+#include 
+#define CHAR_BIT 8
+#endif /* __rtems__ */
+#include 
+#include 
+#include 
+#include 
+
+#ifdef __amd64__
+#include 
+#include 
+#endif
+
+#if defined(__amd64__) || defined(__i386__)
+#ifndef __rtems__
+#include 
+#endif /* __rtems__ */
+#endif
+
+#include 
+#include 
+#ifndef __rtems__
+#include 
+#endif /* __rtems__ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#ifndef __rtems__
+#include 
+#endif /* __rtems__ */
+#include 
+
+#ifndef __rtems__
+static const char *conffile;
+
+static int aflag, bflag, Bflag, dflag, eflag, hflag, iflag;
+static int Nflag, nflag, oflag, qflag, tflag, Tflag, Wflag, xflag;
+#endif /* __rtems__ */
+
+static int oidfmt(int *, int, char *, u_int *);
+stati

[rtems-net-legacy PATCH 4/4] net: Update socketpair to the lwip code

2023-04-22 Thread chrisj
From: Chris Johns 

---
 rtems/rtems_socketpair.c | 133 ++-
 1 file changed, 105 insertions(+), 28 deletions(-)

diff --git a/rtems/rtems_socketpair.c b/rtems/rtems_socketpair.c
index 1dcaf6e..5b8bac3 100644
--- a/rtems/rtems_socketpair.c
+++ b/rtems/rtems_socketpair.c
@@ -1,53 +1,130 @@
 #include 
 
 /*
- *  socketpair() for RTEMS
  *
- *  This file exists primarily to document what is required to provide
- *  a functional implementation of socketpair() for RTEMS.
+ * RTEMS Project (https://www.rtems.org/)
  *
- *  The socketpair() service requires that the "local domain" sockets
- *  be functional.  This is denoted by the domain constants AF_LOCAL
- *  and AF_UNIX and the protocol constants PF_LOCAL and PF_UNIX.  The
- *  local domain functionality is implemented in the file kern/uipc_usrreq.c
- *  which was not part of the initial port of the FreeBSD stack to
- *  RTEMS.
+ * Copyright (c) 2021 Vijay Kumar Banerjee .
+ * All rights reserved.
  *
- *  The FreeBSD socketpair implementation appears to be dependent on
- *  file system features which are not available currently in RTEMS.
+ *  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.
  *
- *  COPYRIGHT (c) 1989-2007.
- *  On-Line Applications Research Corporation (OAR).
- *
- *  The license and distribution terms for this file may be
- *  found in the file LICENSE in this distribution or at
- *  http://www.rtems.org/license/LICENSE.
+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ *  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ *  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ *  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ *  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ *  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ *  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ *  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ *  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
+#include 
+#include 
+#include 
+
+#include 
+
 #include 
+#include 
 #include 
 #include 
 
 #include "rtems_syscall.h"
 
-int socketpair (int domain, int type, int protocol, int *rsv)
+static int setup_socketpair(int listener, int *socket_vector)
+{
+  union {
+struct sockaddr addr;
+struct sockaddr_in inaddr;
+  } a;
+  int reuse = 1;
+  socklen_t addrlen = sizeof(a.inaddr);
+
+  memset(&a, 0, sizeof(a));
+  a.inaddr.sin_family = AF_INET;
+  a.inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+  a.inaddr.sin_port = 0;
+
+  if (setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,
+   (char*) &reuse, (socklen_t) sizeof(reuse)) == -1) {
+return 1;
+  }
+
+  if  (bind(listener, &a.addr, sizeof(a.inaddr)) == -1) {
+return 1;
+  }
+
+  memset(&a, 0, sizeof(a));
+  if  (getsockname(listener, &a.addr, &addrlen) == -1) {
+return 1;
+  }
+
+  a.inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
+  a.inaddr.sin_family = AF_INET;
+
+  if (listen(listener, 1) == -1) {
+return 1;
+  }
+
+  socket_vector[0] = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+  if (socket_vector[0] == -1) {
+return 1;
+  }
+
+  if (connect(socket_vector[0], &a.addr, sizeof(a.inaddr)) == -1) {
+return 1;
+  }
+
+  socket_vector[1] = accept(listener, NULL, NULL);
+  if (socket_vector[1] == -1) {
+return 1;
+  }
+
+  close(listener);
+  return 0;
+}
+
+/* Fake socketpair() support with a loopback TCP socket */
+int
+socketpair(int domain, int type, int protocol, int *socket_vector)
 {
-  if ( !rsv ) {
-errno = EFAULT;
+  int listener;
+  int saved_errno;
+
+  if (socket_vector == NULL) {
+errno = EINVAL;
 return -1;
   }
+  socket_vector[0] = socket_vector[1] = -1;
+
+  listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
+  if (listener == -1)
+return -1;
+
+  if (setup_socketpair(listener, socket_vector) == 0) {
+return 0;
+  }
 
-  /*
-   *  Yes, we do not support socketpair() so this is really paranoid.
-   *  But it ensures that someone calling this routine and ignoring
-   *  the return status will get errors from subsequent socket calls.
-   */
-  rsv[ 0 ] = -1;
-  rsv[ 1 ] = -1;
-  errno = ENOSYS;
+  saved_errno = errno;
+  close(listener);
+  close(s

[rtems-net-legacy PATCH 1/4] tests/resolv: Fix test configuration

2023-04-22 Thread chrisj
From: Chris Johns 

---
 config.inc | 1 +
 netlegacy.py   | 3 ++-
 testsuites/include/network-config.h.in | 6 ++
 testsuites/resolve/init.c  | 3 ---
 testsuites/support/net-legacy-config.c | 6 ++
 5 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/config.inc b/config.inc
index 56497b3..7d348b7 100644
--- a/config.inc
+++ b/config.inc
@@ -4,3 +4,4 @@ NET_CFG_SELF_IP = 127.0.0.1
 NET_CFG_NETMASK = 255.0.0.0
 NET_CFG_MAC_ADDR = 00:00:00:00:00:00
 NET_CFG_GATEWAY_IP = 0.0.0.0
+NET_CFG_DOMAINNAME = localnet
diff --git a/netlegacy.py b/netlegacy.py
index c21e26c..bf816f4 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -60,7 +60,8 @@ def net_config_header(bld):
   (bld.env.NET_CONFIG))
 net_tags = [
 'NET_CFG_IFACE', 'NET_CFG_BOOT_PROT', 'NET_CFG_SELF_IP',
-'NET_CFG_NETMASK', 'NET_CFG_MAC_ADDR', 'NET_CFG_GATEWAY_IP'
+'NET_CFG_NETMASK', 'NET_CFG_MAC_ADDR', 'NET_CFG_GATEWAY_IP',
+'NET_CFG_DOMAINNAME', 'NET_CFG_DNS_IP', 'NET_CFG_NTP_IP'
 ]
 try:
 net_cfg_lines = open(bld.env.NET_CONFIG).readlines()
diff --git a/testsuites/include/network-config.h.in 
b/testsuites/include/network-config.h.in
index 756e3b5..e61dcce 100755
--- a/testsuites/include/network-config.h.in
+++ b/testsuites/include/network-config.h.in
@@ -38,4 +38,10 @@
 
 #define NET_CFG_GATEWAY_IP "@NET_CFG_GATEWAY_IP@"
 
+#define NET_CFG_DNS_IP "@NET_CFG_DNS_IP@"
+
+#define NET_CFG_DOMAINNAME "@NET_CFG_DOMAINNAME@"
+
+#define NET_CFG_NTP_IP "@NET_CFG_NTP_IP@"
+
 #endif /* _TEST_NETWORK_CONFIG_H_ */
diff --git a/testsuites/resolve/init.c b/testsuites/resolve/init.c
index beb0e9a..da5adb1 100644
--- a/testsuites/resolve/init.c
+++ b/testsuites/resolve/init.c
@@ -113,9 +113,6 @@ static rtems_task Init(rtems_task_argument argument)
 
   rtems_test_assert(rtems_net_legacy_config(&rtems_bsdnet_config));
 
-  rtems_bsdnet_config.domainname = "gemini.edu";
-  rtems_bsdnet_config.name_server[0] = "10.1.5.8";
-
   rv = rtems_bsdnet_initialize_network();
   rtems_test_assert(rv == 0);
 
diff --git a/testsuites/support/net-legacy-config.c 
b/testsuites/support/net-legacy-config.c
index bb512d2..1ae2468 100644
--- a/testsuites/support/net-legacy-config.c
+++ b/testsuites/support/net-legacy-config.c
@@ -25,6 +25,9 @@ static char* boot_prot = NET_CFG_BOOT_PROT;
 static char* ip = NET_CFG_SELF_IP;
 static char* netmask = NET_CFG_NETMASK;
 static char* gateway = NET_CFG_GATEWAY_IP;
+static char* domainname = NET_CFG_DOMAINNAME;
+static char* dns_ip = NET_CFG_DNS_IP;
+static char* ntp = NET_CFG_NTP_IP;
 static struct rtems_bsdnet_ifconfig ifcfg = {
   RTEMS_BSP_NETWORK_DRIVER_NAME,
   RTEMS_BSP_NETWORK_DRIVER_ATTACH
@@ -38,6 +41,9 @@ bool rtems_net_legacy_config(struct rtems_bsdnet_config* bsd) 
{
   ifcfg.ip_address = ip;
   ifcfg.ip_netmask = netmask;
   bsd->gateway = gateway;
+  bsd->domainname = domainname;
+  bsd->name_server[0] = dns_ip;
+  bsd->ntp_server[0] = ntp;
   if (strcmp(boot_prot, "static") == 0) {
 bsd->bootp = NULL;
   } else if (strcmp(boot_prot, "bootp") == 0) {
-- 
2.37.1

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


[rtems-net-legacy PATCH 2/4] waf: Build libs before tests

2023-04-22 Thread chrisj
From: Chris Johns 

The built libs are in lib and use when linking to get a working
order. Make sure they are built before building an tests.
---
 netlegacy.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/netlegacy.py b/netlegacy.py
index bf816f4..8533f4c 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -216,3 +216,5 @@ def build(bld):
 bld.install_as(
 os.path.join(bld.env.PREFIX, arch_inc_path, 'rtems',
  'rtems-net-legacy.h'), 'include/rtems/rtems-net-legacy.h')
+
+bld.add_group()
-- 
2.37.1

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


[PATCH 4/4] sb/pkg-config: Add --cflags-only-I and --cflags-only-other option

2023-04-21 Thread chrisj
From: Chris Johns 

---
 source-builder/pkg-config | 36 
 1 file changed, 36 insertions(+)

diff --git a/source-builder/pkg-config b/source-builder/pkg-config
index 10db546..8d0a174 100755
--- a/source-builder/pkg-config
+++ b/source-builder/pkg-config
@@ -86,6 +86,19 @@ def log(s, lf = True):
 sys.stdout.flush()
 print(s, end = '', file = out)
 
+def cflags_filter(cflags, prefixes, include=True):
+cflags = cflags.split(' ')
+f_cflags = []
+for f in cflags:
+for p in prefixes:
+if f.startswith(p):
+f_cflags += [f]
+if not include:
+not_f_cflags = [f for f in cflags if f not in f_cflags]
+f_cflags = not_f_cflags
+return ' '.join(f_cflags)
+
+
 def run(argv):
 
 class version_action(argparse.Action):
@@ -110,6 +123,7 @@ def run(argv):
   help = 'Make error messages short.')
 opts.add_argument('--silence-errors', dest = 'silence_errors', action = 
'store_true',
   default = False,
+
   help = 'Do not print any errors.')
 opts.add_argument('--errors-to-stdout', dest = 'errors_to_stdout', action 
= 'store_true',
   default = False,
@@ -118,6 +132,14 @@ def run(argv):
   default = False,
   help = 'This prints pre-processor and compile flags 
required to' \
  ' compile the package(s)')
+opts.add_argument('--cflags-only-I', dest = 'cflags_only_i', action = 
'store_true',
+  default = False,
+  help = 'This prints the -I part of "--cflags". That is, 
it defines the header' \
+ 'search path but doesn\'t specify anything else.')
+opts.add_argument('--cflags-only-other', dest = 'cflags_only_other', 
action = 'store_true',
+  default = False,
+  help = 'Return all compiler flags, other than the 
include path flags, ' \
+ 'required to compile against the package.')
 opts.add_argument('--libs', dest = 'libs', action = 'store_true',
   default = False,
   help = 'This option is identical to "--cflags", only it 
prints the' \
@@ -193,6 +215,20 @@ def run(argv):
 log('cflags: %s' % (flags['cflags']))
 else:
 log('cflags: empty')
+if args.cflags_only_i:
+cflags = cflags_filter(flags['cflags'], ['-I', '-system'], 
True)
+if len(cflags):
+print(cflags)
+log('cflags: %s' % (flags['cflags']))
+else:
+log('cflags: empty')
+if args.cflags_only_other:
+cflags = cflags_filter(flags['cflags'], ['-I', '-system'], 
False)
+if len(cflags):
+print(cflags)
+log('cflags: %s' % (flags['cflags']))
+else:
+log('cflags: empty')
 if args.libs:
 if len(flags['libs']):
 print(flags['libs'])
-- 
2.37.1

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


[PATCH 3/4] sb/option: Add the arch to the macros from the --rtems-bsp option

2023-04-21 Thread chrisj
From: Chris Johns 

---
 source-builder/sb/options.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source-builder/sb/options.py b/source-builder/sb/options.py
index 00cc611..d554097 100644
--- a/source-builder/sb/options.py
+++ b/source-builder/sb/options.py
@@ -634,6 +634,7 @@ class command_line:
 if len(ab) != 2:
 raise error.general('invalid --rtems-bsp option')
 self.args.append('--target=%s-rtems%s' % (ab[0], rtems_version))
+self.args.append('--with-rtems-arch=%s' % (ab[0]))
 self.args.append('--with-rtems-bsp=%s' % (ab[1]))
 
 def load(args, optargs = None, defaults = '%{_sbdir}/defaults.mc', logfile = 
True):
-- 
2.37.1

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


[PATCH 1/4] sb/path: Handle unicode filenames in a source path

2023-04-21 Thread chrisj
From: Chris Johns 

The change leaves the encoding in that currently exists because
I cannot remember why it is there. If an encoding error happens
return the same path to see if it will work.
---
 source-builder/sb/path.py | 26 --
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/source-builder/sb/path.py b/source-builder/sb/path.py
index d36e12a..d9e926e 100644
--- a/source-builder/sb/path.py
+++ b/source-builder/sb/path.py
@@ -71,6 +71,20 @@ def shell(path):
 path = path.replace('//', '/')
 return path
 
+def host_encode(dpath):
+'''Encoding the path was present in the RSB however on a ZFS pool I am
+   seeing a failure with a go test in gcc:
+  gcc/testsuite/go.test/test/fixedbugs/issue27836.dir
+   Not encoding works however I am not sure why the encoding was added
+   so the following keeps the encoding and falls back to not encoded
+   if there is an error.0
+'''
+try:
+return host(dpath).encode('utf8')
+except:
+pass
+return dpath
+
 def basename(path):
 path = shell(path)
 return shell(os.path.basename(host(path)))
@@ -189,11 +203,11 @@ def removeall(path):
 # get to the max path length on Windows.
 #
 def _isdir(path):
-hpath = host(path).encode('utf8')
+hpath = host_encode(path)
 return os.path.isdir(hpath) and not os.path.islink(hpath)
 
 def _remove_node(path):
-hpath = host(path).encode('utf8')
+hpath = host_encode(path)
 if not os.path.islink(hpath) and not os.access(hpath, os.W_OK):
 os.chmod(hpath, stat.S_IWUSR)
 if _isdir(path):
@@ -216,7 +230,7 @@ def removeall(path):
 _remove_node(dir)
 
 path = shell(path)
-hpath = host(path).encode('utf8')
+hpath = host_encode(path)
 
 if os.path.exists(hpath):
 _remove(path)
@@ -317,11 +331,11 @@ def get_size(path, depth = -1):
 # get to the max path length on Windows.
 #
 def _isdir(path):
-hpath = host(path).encode('utf8')
+hpath = host_encode(path)
 return os.path.isdir(hpath) and not os.path.islink(hpath)
 
 def _node_size(path):
-hpath = host(path).encode('utf8')
+hpath = host_encode(path)
 size = 0
 if not os.path.islink(hpath):
 size = os.path.getsize(hpath)
@@ -345,7 +359,7 @@ def get_size(path, depth = -1):
 return size
 
 path = shell(path)
-hpath = host(path).encode('utf8')
+hpath = host_encode(path)
 size = 0
 
 if os.path.exists(hpath):
-- 
2.37.1

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


Minor RBS fixes

2023-04-21 Thread chrisj
Hi

These patches fix a few minor issues in the RSB.

Chris

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


[PATCH 2/4] sb: Fix the library handling in rtems-build-dep

2023-04-21 Thread chrisj
From: Chris Johns 

---
 source-builder/sb/rtems-build-dep | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/source-builder/sb/rtems-build-dep 
b/source-builder/sb/rtems-build-dep
index 48a0823..71c8890 100755
--- a/source-builder/sb/rtems-build-dep
+++ b/source-builder/sb/rtems-build-dep
@@ -154,13 +154,16 @@ if [ ${op} = "library" ]; then
  awk 'BEGIN {FS="-L"} {for (i=0;++i<=NF;) if (length($i) > 
0) print $i;}')
 for p in ${lib_paths_1} ${lib_paths_2}
 do
-   if [ ${verbose} = yes ]; then
-   echo "Library: ${p}/${name}"
-   fi
-   if ls ${p}/${name} 1> /dev/null 2>&1; then
-   echo "found"
-   exit 0
-   fi
+   for lname in ${name} lib${name}.a
+   do
+   if [ ${verbose} = yes ]; then
+   echo "Library: ${p}/${lname}"
+   fi
+   if ls ${p}/${lname} 1> /dev/null 2>&1; then
+   echo "found"
+   exit 0
+   fi
+   done
 done
 echo "not-found"
 exit 0
-- 
2.37.1

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


[rtems-net-legacy PATCH 1/3] bsd: Add getaddrinfom, gai_strerror, ipv6_addr, if_nametoindex and BSD programs

2023-04-19 Thread chrisj
From: Chris Johns 

- These additions let the net services repo build with the legacy
  stack
---
 include/machine/rtems-bsd-thread.h|   34 +
 libc/gai_strerror.c   |  125 +
 libc/getaddrinfo.c| 3086 +
 libc/nsswitch.h   |  246 ++
 libc/vars.c   |   47 +
 net/if_nametoindex.c  |  111 +
 netsources.py |7 +-
 resolv.h  |3 +-
 rtems/rtems-kernel-program.c  |   86 +
 rtems_waf |2 +-
 testsuites/resolve/getaddrinfo_test.c |  573 +
 testsuites/resolve/init.c |  176 ++
 testsuites/resolve/resolve.doc|   11 +
 testsuites/resolve/resolve.scn|  166 ++
 testsuites/resolve/wscript|   49 +
 testsuites/wscript|2 +-
 16 files changed, 4720 insertions(+), 4 deletions(-)
 create mode 100644 include/machine/rtems-bsd-thread.h
 create mode 100644 libc/gai_strerror.c
 create mode 100644 libc/getaddrinfo.c
 create mode 100644 libc/nsswitch.h
 create mode 100644 libc/vars.c
 create mode 100644 net/if_nametoindex.c
 create mode 100644 rtems/rtems-kernel-program.c
 create mode 100644 testsuites/resolve/getaddrinfo_test.c
 create mode 100644 testsuites/resolve/init.c
 create mode 100644 testsuites/resolve/resolve.doc
 create mode 100644 testsuites/resolve/resolve.scn
 create mode 100644 testsuites/resolve/wscript

diff --git a/include/machine/rtems-bsd-thread.h 
b/include/machine/rtems-bsd-thread.h
new file mode 100644
index 000..ed3e8b3
--- /dev/null
+++ b/include/machine/rtems-bsd-thread.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2022 On-Line Applications Research Corporation (OAR)
+ * Written by Kinsey Moore 
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTEMSLWIP_RTEMS_BSD_THREAD_H
+#define _RTEMSLWIP_RTEMS_BSD_THREAD_H
+#include 
+#include 
+#include 
+
+#define BSD_TASK_NAME rtems_build_name('_', 'B', 'S', 'D')
+#endif
diff --git a/libc/gai_strerror.c b/libc/gai_strerror.c
new file mode 100644
index 000..070e237
--- /dev/null
+++ b/libc/gai_strerror.c
@@ -0,0 +1,125 @@
+/*-
+ * SPDX-License-Identifier: BSD-3-Clause
+ *
+ * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
+ * 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.
+ * 3. Neither the name of the project nor the names of its contributors
+ *may be used to endorse or promote products derived from this software
+ *without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE PROJECT 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 PROJECT 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

[rtems-net-legacy PATCH 2/3] waf: Enable warnings as an option

2023-04-19 Thread chrisj
From: Chris Johns 

---
 netlegacy.py | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/netlegacy.py b/netlegacy.py
index 9f27ffc..3ce54c6 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -104,6 +104,10 @@ def options(opt):
  default='-O2',
  dest='optimization',
  help='Optimaization level (default: %default)')
+copts.add_option('--enable-warnings',
+ action='store_true',
+ dest='warnings',
+ help='Enable warnings for all sources (default: 
%default)')
 
 
 def bsp_configure(conf, arch_bsp, mandatory=True):
@@ -129,6 +133,11 @@ def bsp_configure(conf, arch_bsp, mandatory=True):
] + [str(conf.path.find_node(i))
 for i in includes] + conf.env.IFLAGS
 conf.env.OPTIMIZATION = [conf.options.optimization]
+if conf.options.warnings:
+warnings = '-Wall'
+else:
+warnings = '-w'
+conf.env.WARNINGS = [warnings]
 #
 # BSPs must define:
 #  - RTEMS_BSP_NETWORK_DRIVER_NAME
@@ -156,16 +165,18 @@ def build(bld):
 version_header(bld)
 net_config_header(bld)
 
+cflags = bld.env.OPTIMIZATION + bld.env.WARNINGS + ['-g']
+
 if ab in bsp_drivers.source:
 bld(target='bspobjs',
 features='c',
-cflags=bld.env.OPTIMIZATION + ['-g'],
+cflags=cflags,
 includes=bld.env.IFLAGS,
 source=bsp_drivers.source[ab])
 
 bld(target='netobjs',
 features='c',
-cflags=bld.env.OPTIMIZATION + ['-g'],
+cflags=cflags,
 includes=bld.env.IFLAGS,
 defines=['IN_HISTORICAL_NETS=1'],
 source=netsources.source.network)
@@ -174,14 +185,14 @@ def build(bld):
 
 bld.stlib(target='pppd',
   features='c',
-  cflags=bld.env.OPTIMIZATION + ['-g'],
+  cflags=cflags,
   includes=bld.env.IFLAGS,
   use=['networking'],
   source=netsources.source.pppd)
 
 bld.stlib(target='nfs',
   features='c',
-  cflags=bld.env.OPTIMIZATION + ['-g'],
+  cflags=cflags,
   includes=bld.env.IFLAGS,
   use=['networking'],
   source=netsources.source.nfsclient)
-- 
2.37.1

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


[rtems-net-legacy PATCH 3/3] waf: Build header files before anything else

2023-04-19 Thread chrisj
From: Chris Johns 

---
 netlegacy.py | 2 ++
 wscript  | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/netlegacy.py b/netlegacy.py
index 3ce54c6..c21e26c 100644
--- a/netlegacy.py
+++ b/netlegacy.py
@@ -165,6 +165,8 @@ def build(bld):
 version_header(bld)
 net_config_header(bld)
 
+bld.add_group()
+
 cflags = bld.env.OPTIMIZATION + bld.env.WARNINGS + ['-g']
 
 if ab in bsp_drivers.source:
diff --git a/wscript b/wscript
index d41f93e..47982a8 100644
--- a/wscript
+++ b/wscript
@@ -77,5 +77,4 @@ def recurse(ctx):
 def build(bld):
 rtems.build(bld)
 netlegacy.build(bld)
-bld.add_group()
 recurse(bld)
-- 
2.37.1

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


[rtems-net-legacy] Add getaddrinfo, gai_strerror and ipv6_addr

2023-04-19 Thread chrisj
Hi,

The move of the networking header files to the system headers means
the functionality exposed is all that can be provided. This breaks the
backward compatibility of the legacy stack. The solution is to add
what is needed when needed to the legacy stack.

This patch adds getaddrinfo, gai_strerror and ipv6_addr to the
legacy stack.

The getaddrinfo implementation is form a current FreeBSD and so 
is the test code.

There are a couple of housekeeping patches. One to move warnings
to a configure option and a fix for the generated headers 
dependency.

Chris


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


  1   2   3   4   5   6   7   >