Re: [PATCH v2] spec/pkgconfig: Allow builds to override headers

2022-11-09 Thread Kinsey Moore
Ping. I'd like to get some kind of commentary on this if only just an "ok"
since I wouldn't feel comfortable committing it without some kind of
acknowledgement. It now takes care of both existing build descriptions
(makefile and pkgconfig). I also have a reversion of the libbsd workaround
ready to go in once this is ok'd. This issue was just hit again on
rtems-lwip.

Kinsey

On Tue, Oct 25, 2022 at 2:03 PM Kinsey Moore 
wrote:

> This allows any builds targeting an installed RTEMS BSP to override
> headers in the installed BSP reliably, including headers previously
> installed by that or other builds. This includes applications, network
> stacks, libraries, and any other builds.
> ---
>  spec/build/bsps/makecustom.yml | 2 +-
>  spec/build/bsps/pkgconfig.yml  | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/spec/build/bsps/makecustom.yml
> b/spec/build/bsps/makecustom.yml
> index 139629b597..9f5f2f2e59 100644
> --- a/spec/build/bsps/makecustom.yml
> +++ b/spec/build/bsps/makecustom.yml
> @@ -2,7 +2,7 @@ SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
>  build-type: config-file
>  content: |
>include $$(RTEMS_ROOT)/make/custom/default.cfg
> -  CPU_DEFINES = -I$$(exec_prefix)/$$(RTEMS_BSP)/lib/include
> +  CPU_DEFINES = -isystem$$(exec_prefix)/$$(RTEMS_BSP)/lib/include
>CPU_CFLAGS = ${ABI_FLAGS}
>CFLAGS_OPTIMIZE_V = ${OPTIMIZATION_FLAGS}
>LDFLAGS = -B$$(exec_prefix)/$$(RTEMS_BSP)/lib ${PKGCONFIG_LDFLAGS}
> diff --git a/spec/build/bsps/pkgconfig.yml b/spec/build/bsps/pkgconfig.yml
> index a9462fcc95..8a3c3677a4 100644
> --- a/spec/build/bsps/pkgconfig.yml
> +++ b/spec/build/bsps/pkgconfig.yml
> @@ -22,7 +22,7 @@ content: |
>Name: ${ARCH}-rtems${__RTEMS_MAJOR__}-${BSP_NAME}
>Version: ${RTEMS_VERSION}
>Description: RTEMS BSP ${ARCH}/${BSP_NAME}
> -  Cflags: $${ABI_FLAGS} -I$${includedir}
> +  Cflags: $${ABI_FLAGS} -isystem$${includedir}
>Ldflags: -B$${libdir} ${PKGCONFIG_LDFLAGS}
>Libs: -B$${libdir} ${PKGCONFIG_LDFLAGS}
>  copyrights:
> --
> 2.30.2
>
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH rtems-lwip] rtemslwip: Add note to intentionally blank files

2022-11-09 Thread Kinsey Moore
---
 rtemslwip/bsd_compat_include/arpa/nameser.h   | 1 +
 rtemslwip/bsd_compat_include/machine/rtems-bsd-kernel-space.h | 1 +
 rtemslwip/bsd_compat_include/machine/rtems-bsd-user-space.h   | 1 +
 rtemslwip/bsd_compat_include/net/if_var.h | 1 +
 rtemslwip/bsd_compat_include/netinet/in_systm.h   | 1 +
 rtemslwip/bsd_compat_include/netinet/in_var.h | 1 +
 rtemslwip/bsd_compat_include/netinet/ip.h | 1 +
 rtemslwip/bsd_compat_include/sys/kernel.h | 1 +
 rtemslwip/bsd_compat_include/sysexits.h   | 1 +
 rtemslwip/include/arch/eth_lwip_default.h | 1 +
 rtemslwip/include/bspconfig.h | 1 +
 rtemslwip/xilinx/semphr.h | 1 +
 rtemslwip/xilinx/timers.h | 1 +
 rtemslwip/xilinx/xil_smc.h| 1 +
 rtemslwip/xilinx/xil_spinlock.h   | 1 +
 15 files changed, 15 insertions(+)

diff --git a/rtemslwip/bsd_compat_include/arpa/nameser.h 
b/rtemslwip/bsd_compat_include/arpa/nameser.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/arpa/nameser.h
+++ b/rtemslwip/bsd_compat_include/arpa/nameser.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/machine/rtems-bsd-kernel-space.h 
b/rtemslwip/bsd_compat_include/machine/rtems-bsd-kernel-space.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/machine/rtems-bsd-kernel-space.h
+++ b/rtemslwip/bsd_compat_include/machine/rtems-bsd-kernel-space.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/machine/rtems-bsd-user-space.h 
b/rtemslwip/bsd_compat_include/machine/rtems-bsd-user-space.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/machine/rtems-bsd-user-space.h
+++ b/rtemslwip/bsd_compat_include/machine/rtems-bsd-user-space.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/net/if_var.h 
b/rtemslwip/bsd_compat_include/net/if_var.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/net/if_var.h
+++ b/rtemslwip/bsd_compat_include/net/if_var.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/netinet/in_systm.h 
b/rtemslwip/bsd_compat_include/netinet/in_systm.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/netinet/in_systm.h
+++ b/rtemslwip/bsd_compat_include/netinet/in_systm.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/netinet/in_var.h 
b/rtemslwip/bsd_compat_include/netinet/in_var.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/netinet/in_var.h
+++ b/rtemslwip/bsd_compat_include/netinet/in_var.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/netinet/ip.h 
b/rtemslwip/bsd_compat_include/netinet/ip.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/netinet/ip.h
+++ b/rtemslwip/bsd_compat_include/netinet/ip.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/sys/kernel.h 
b/rtemslwip/bsd_compat_include/sys/kernel.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/sys/kernel.h
+++ b/rtemslwip/bsd_compat_include/sys/kernel.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/bsd_compat_include/sysexits.h 
b/rtemslwip/bsd_compat_include/sysexits.h
index e69de29..d35e631 100644
--- a/rtemslwip/bsd_compat_include/sysexits.h
+++ b/rtemslwip/bsd_compat_include/sysexits.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/include/arch/eth_lwip_default.h 
b/rtemslwip/include/arch/eth_lwip_default.h
index e69de29..d35e631 100644
--- a/rtemslwip/include/arch/eth_lwip_default.h
+++ b/rtemslwip/include/arch/eth_lwip_default.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/include/bspconfig.h b/rtemslwip/include/bspconfig.h
index e69de29..d35e631 100644
--- a/rtemslwip/include/bspconfig.h
+++ b/rtemslwip/include/bspconfig.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/xilinx/semphr.h b/rtemslwip/xilinx/semphr.h
index e69de29..d35e631 100644
--- a/rtemslwip/xilinx/semphr.h
+++ b/rtemslwip/xilinx/semphr.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/xilinx/timers.h b/rtemslwip/xilinx/timers.h
index e69de29..d35e631 100644
--- a/rtemslwip/xilinx/timers.h
+++ b/rtemslwip/xilinx/timers.h
@@ -0,0 +1 @@
+/* This file is a stub and intentionally left blank */
diff --git a/rtemslwip/xilinx/xil_smc.h b/rtemslwip/xilinx/xil

Re: [5 DOCS PATCH] waf: Backport from main build fixes

2022-11-09 Thread Gedare Bloom
looks fine. i'm not sure where
+   "review":   ("Gerrit Code Review",
"https://review.rtems.org/";),
came from, but I see it in before too.

On Wed, Nov 9, 2022 at 9:36 PM  wrote:
>
> From: Chris Johns 
>
> Closes #4752
> ---
>  common/conf.py| 17 ++--
>  common/latex.py   |  7 +++--
>  common/rtemsdomain.py | 64 +++
>  common/version.py |  5 +++-
>  common/waf.py | 20 ++
>  5 files changed, 78 insertions(+), 35 deletions(-)
>
> diff --git a/common/conf.py b/common/conf.py
> index 257bc4e..565e06d 100644
> --- a/common/conf.py
> +++ b/common/conf.py
> @@ -1,4 +1,4 @@
> -import version as rtems_version
> +import datetime
>
>  extensions = [
> "sphinx.ext.autodoc",
> @@ -12,6 +12,8 @@ extensions = [
> "rtemsdomain",
>  ]
>
> +bibtex_bibfiles = ['../common/refs.bib']
> +
>  extlinks = {'release_path': ('https://ftp.rtems.org/pub/rtems/releases', 
> None) }
>
>  # Add any paths that contain templates here, relative to this directory.
> @@ -28,21 +30,17 @@ master_doc = 'index'
>
>  # General information about the project.
>  project = u'RTEMS Documentation Project'
> -copyright = u'1988, 2020 RTEMS Project and contributors'
> +copyright = u'1988, ' + str(datetime.datetime.now().year) + ' RTEMS Project 
> and contributors'
>
>  # The version info for the project you're documenting, acts as replacement 
> for
>  # |version| and |release|, also used in various other places throughout the
>  # built documents.
>  #
>  # The short X.Y version.
> -version = rtems_version.version()
> +#version = rtems_version.version()
>
>  # The full version, including alpha/beta/rc tags.
> -release = rtems_version.string()
> -
> -major = rtems_version.major()
> -minor = rtems_version.minor()
> -revision = rtems_version.revision()
> +#release = rtems_version.string()
>
>  # The language for content autogenerated by Sphinx. Refer to documentation
>  # for a list of supported languages.
> @@ -75,6 +73,9 @@ exclude_patterns = []
>  # The name of the Pygments (syntax highlighting) style to use.
>  pygments_style = 'sphinx'
>
> +# http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-numfig
> +numfig = True
> +
>  # A list of ignored prefixes for module index sorting.
>  #modindex_common_prefix = []
>
> diff --git a/common/latex.py b/common/latex.py
> index a042510..17d3015 100644
> --- a/common/latex.py
> +++ b/common/latex.py
> @@ -3,7 +3,6 @@
>  #
>
>  import os
> -import platform
>  import re
>
>  package_test_preamble = ['\\newif\\ifsphinxKeepOldNames 
> \\sphinxKeepOldNamestrue',
> @@ -82,7 +81,11 @@ def tex_test(test):
>  def host_name():
>  uname = os.uname()
>  if uname[0] == 'Linux':
> -distro = platform.dist()
> +try:
> +from distro import linux_distribution
> +except:
> +from platform import linux_distribution
> +distro = linux_distribution()
>  name = '%s/%s' % (uname[0], distro[0])
>  version = distro[1]
>  else:
> diff --git a/common/rtemsdomain.py b/common/rtemsdomain.py
> index 9b092a3..630f1e3 100644
> --- a/common/rtemsdomain.py
> +++ b/common/rtemsdomain.py
> @@ -8,6 +8,8 @@ from sphinx.domains import Domain, ObjType, Index
>  from sphinx.util.nodes import make_refnode
>  from sphinx.util.docfields import Field, TypedField
>
> +import version as rtems_version
> +
>  """
>  :r:bsp:`sparc/sis`
>
> @@ -30,28 +32,28 @@ role_name = {
>  }
>
>  role_url = {
> -   "trac": ("Trac",  
>   "https://devel.rtems.org";),
> -   "devel":("Developer Site",  
> "https://devel.rtems.org";),
> -   "www":  ("RTEMS Home",  
> "https://www.rtems.org/";),
> -   "buildbot": ("Buildbot Instance",   
> "https://buildbot.rtems.org/";),
> -   "builder":  ("Builder Site",
> "https://builder.rtems.org/";),
> -   "docs": ("Documentation Site",  
> "https://docs.rtems.org/";),
> -   "lists":("Mailing Lists",   
> "https://lists.rtems.org/";),
> -   "git":  ("Git Repositories",
> "https://git.rtems.org/";),
> -   "ftp":  ("FTP File Server", 
> "https://ftp.rtems.org/";),
> -   "review":   ("Gerrit Code Review",  
> "https://review.rtems.org/";),
> -   "bugs": ("Bugs Database",   
> "https://devel.rtems.org/wiki/Bugs/";),
> -   "gsoc": ("Google Summer of Code", 
> "https://devel.rtems.org/wiki/GSoC/";),
> -   "socis":("ESA SOCIS",   
> "https://devel.rtems.org/wiki/SOCIS/";)
> +   "trac": ("Trac",
> "https://devel.rtems.org";),
> +   "devel": 

[5 DOCS PATCH] waf: Backport from main build fixes

2022-11-09 Thread chrisj
From: Chris Johns 

Closes #4752
---
 common/conf.py| 17 ++--
 common/latex.py   |  7 +++--
 common/rtemsdomain.py | 64 +++
 common/version.py |  5 +++-
 common/waf.py | 20 ++
 5 files changed, 78 insertions(+), 35 deletions(-)

diff --git a/common/conf.py b/common/conf.py
index 257bc4e..565e06d 100644
--- a/common/conf.py
+++ b/common/conf.py
@@ -1,4 +1,4 @@
-import version as rtems_version
+import datetime
 
 extensions = [
"sphinx.ext.autodoc",
@@ -12,6 +12,8 @@ extensions = [
"rtemsdomain",
 ]
 
+bibtex_bibfiles = ['../common/refs.bib']
+
 extlinks = {'release_path': ('https://ftp.rtems.org/pub/rtems/releases', None) 
}
 
 # Add any paths that contain templates here, relative to this directory.
@@ -28,21 +30,17 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'RTEMS Documentation Project'
-copyright = u'1988, 2020 RTEMS Project and contributors'
+copyright = u'1988, ' + str(datetime.datetime.now().year) + ' RTEMS Project 
and contributors'
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the
 # built documents.
 #
 # The short X.Y version.
-version = rtems_version.version()
+#version = rtems_version.version()
 
 # The full version, including alpha/beta/rc tags.
-release = rtems_version.string()
-
-major = rtems_version.major()
-minor = rtems_version.minor()
-revision = rtems_version.revision()
+#release = rtems_version.string()
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
@@ -75,6 +73,9 @@ exclude_patterns = []
 # The name of the Pygments (syntax highlighting) style to use.
 pygments_style = 'sphinx'
 
+# http://www.sphinx-doc.org/en/master/usage/configuration.html#confval-numfig
+numfig = True
+
 # A list of ignored prefixes for module index sorting.
 #modindex_common_prefix = []
 
diff --git a/common/latex.py b/common/latex.py
index a042510..17d3015 100644
--- a/common/latex.py
+++ b/common/latex.py
@@ -3,7 +3,6 @@
 #
 
 import os
-import platform
 import re
 
 package_test_preamble = ['\\newif\\ifsphinxKeepOldNames 
\\sphinxKeepOldNamestrue',
@@ -82,7 +81,11 @@ def tex_test(test):
 def host_name():
 uname = os.uname()
 if uname[0] == 'Linux':
-distro = platform.dist()
+try:
+from distro import linux_distribution
+except:
+from platform import linux_distribution
+distro = linux_distribution()
 name = '%s/%s' % (uname[0], distro[0])
 version = distro[1]
 else:
diff --git a/common/rtemsdomain.py b/common/rtemsdomain.py
index 9b092a3..630f1e3 100644
--- a/common/rtemsdomain.py
+++ b/common/rtemsdomain.py
@@ -8,6 +8,8 @@ from sphinx.domains import Domain, ObjType, Index
 from sphinx.util.nodes import make_refnode
 from sphinx.util.docfields import Field, TypedField
 
+import version as rtems_version
+
 """
 :r:bsp:`sparc/sis`
 
@@ -30,28 +32,28 @@ role_name = {
 }
 
 role_url = {
-   "trac": ("Trac",
"https://devel.rtems.org";),
-   "devel":("Developer Site",  
"https://devel.rtems.org";),
-   "www":  ("RTEMS Home",  
"https://www.rtems.org/";),
-   "buildbot": ("Buildbot Instance",   
"https://buildbot.rtems.org/";),
-   "builder":  ("Builder Site",
"https://builder.rtems.org/";),
-   "docs": ("Documentation Site",  
"https://docs.rtems.org/";),
-   "lists":("Mailing Lists",   
"https://lists.rtems.org/";),
-   "git":  ("Git Repositories",
"https://git.rtems.org/";),
-   "ftp":  ("FTP File Server", 
"https://ftp.rtems.org/";),
-   "review":   ("Gerrit Code Review",  
"https://review.rtems.org/";),
-   "bugs": ("Bugs Database",   
"https://devel.rtems.org/wiki/Bugs/";),
-   "gsoc": ("Google Summer of Code", 
"https://devel.rtems.org/wiki/GSoC/";),
-   "socis":("ESA SOCIS",   
"https://devel.rtems.org/wiki/SOCIS/";)
+   "trac": ("Trac",
"https://devel.rtems.org";),
+   "devel":("Developer Site",  
"https://devel.rtems.org";),
+   "www":  ("RTEMS Home",  
"https://www.rtems.org/";),
+   "buildbot": ("Buildbot Instance",   
"https://buildbot.rtems.org/";),
+   "builder":  ("Builder Site",
"https://builder.rtems.org/";),
+   "docs": ("Documentation Site",  
"https://docs.rtems.org/";),
+   "lists":("

[PATCH rtems-lwip v2] lwip.py: Move bsp-specific information out

2022-11-09 Thread Kinsey Moore
This moves all BSP-specific information out of lwip.py and into JSON
descriptions of the files required to compile the drivers for each BSP.

Note that file-import.json is kept separate because it is used to manage
updating from upstream.
---
 COPYING.defs  |  23 
 ORIGIN.defs   |   1 +
 defs/bsps/aarch64/xilinx_zynqmp_base.json |  30 
 .../aarch64/xilinx_zynqmp_ilp32_qemu.json |  11 ++
 .../aarch64/xilinx_zynqmp_ilp32_zu3eg.json|  11 ++
 .../bsps/aarch64/xilinx_zynqmp_lp64_qemu.json |  11 ++
 .../aarch64/xilinx_zynqmp_lp64_zu3eg.json |  11 ++
 defs/bsps/arm/beaglebone_bw_base.json |  10 ++
 defs/bsps/arm/beagleboneblack.json|   5 +
 defs/bsps/arm/beaglebonewhite.json|   5 +
 defs/bsps/arm/tms570_base.json|   9 ++
 defs/bsps/arm/tms570ls3137_hdk.json   |   5 +
 defs/bsps/arm/tms570ls3137_hdk_intram.json|   5 +
 defs/bsps/arm/tms570ls3137_hdk_sdram.json |   5 +
 .../arm/tms570ls3137_hdk_with_loader.json |   5 +
 defs/common/lwip.json |  17 +++
 lwip.py   | 129 --
 17 files changed, 194 insertions(+), 99 deletions(-)
 create mode 100644 COPYING.defs
 create mode 100644 ORIGIN.defs
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_base.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_ilp32_qemu.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_ilp32_zu3eg.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_qemu.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_zu3eg.json
 create mode 100644 defs/bsps/arm/beaglebone_bw_base.json
 create mode 100644 defs/bsps/arm/beagleboneblack.json
 create mode 100644 defs/bsps/arm/beaglebonewhite.json
 create mode 100644 defs/bsps/arm/tms570_base.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk_intram.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk_sdram.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk_with_loader.json
 create mode 100644 defs/common/lwip.json

diff --git a/COPYING.defs b/COPYING.defs
new file mode 100644
index 000..d971823
--- /dev/null
+++ b/COPYING.defs
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
diff --git a/ORIGIN.defs b/ORIGIN.defs
new file mode 100644
index 000..33c421c
--- /dev/null
+++ b/ORIGIN.defs
@@ -0,0 +1 @@
+The files under the defs/ directory are written specifically for this project.
diff --git a/defs/bsps/aarch64/xilinx_zynqmp_base.json 
b/defs/bsps/aarch64/xilinx_zynqmp_base.json
new file mode 100644
index 000..515ad6e
--- /dev/null
+++ b/defs/bsps/aarch64/xilinx_zynqmp_base.json
@@ -0,0 +1,30 @@
+{
+   "header-paths-to-import": [
+   
"embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/include",
+   "embeddedsw/lib/bsp/standalone/src/common",
+   "embeddedsw/XilinxProcessorIPLib/drivers/common/src/",
+   "embeddedsw/XilinxProcessorIPLib/drivers/scugic/src",
+   "embeddedsw/XilinxProcessorIPLib/drivers/emacps/src",
+   "rtemslwip/xilinx",
+   "rtemslwip/zynqmp",
+   "embeddedsw/lib/bsp/standalone/src/arm/ARMv8/64bit",
+   "embeddedsw/lib/bsp/standalone/src/arm/common/gcc",
+   "embeddedsw/lib/bsp/standalone/src/arm/common"
+   ],
+   "source-paths-to-import": [
+   "rtemslwip/zynqmp"
+   ],
+   "source-files-to-import": [
+   
"embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xadapter.c",
+   

Re: [PATCH rtems-libbsd v2 0/3] CFC400X support

2022-11-09 Thread Chris Johns

Looks good.

Thanks
Chris

On 9/11/2022 4:10 pm, Kinsey Moore wrote:

In this revised patch set, SGMII support has been reworked to use device
trees while preserving existing static instantiation used by Zynq and
Versal BSPs.

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

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


Re: Add Formal Verification chapter v2

2022-11-09 Thread Chris Johns

On 9/11/2022 9:48 pm, andrew.butterfi...@scss.tcd.ie wrote:

ping

(my fault really, i've let this sit!)



Thank you for raising this and I am sorry we have not been as proactive 
as we should be.



But I have been busy, interacting with a group doing a follow-up IV&V project 
with the qualification data package we produced.
A conseuience of this is that I am helping them to add two extra manager models 
developed by students, for Barriers and Message Queues.

This would add two more entries to the model guide, and raises the question of 
the best place to document the models.
Is the RTEMS Software Engineering manual the best location for those? If not, 
where should they live?

Another side effect fo all this is that there is now a definitive version of 
the formal models and test generation in a public repo:

https://github.com/andrewbutterfield/RTEMS-SMP-Formal



Excellent.

I have no expertise in this area and I am more than happy to defer to 
you and your team in this area.


I have no objections to this working being merge as is. I see it as 
green field work and yours is the first here. I am sure updates or 
changes can be made over time by you or others as the work is absorbed 
and reviewed.


Thank you for all the efforts you and those with you have made. I 
personally think it is fantastic to have this work happen and being made 
public in this way so thank you from me.


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


Re: [rtems-docs commit] Update build system related sections for RTEMS 6

2022-11-09 Thread Chris Johns

On 9/11/2022 4:28 pm, Sebastian Huber wrote:

On 09/11/2022 01:35, Chris Johns wrote:


Was this posted for review? I do not remember seeing it?


Yes, on September 12.


Thanks. Sorry, I must have missed it.


There are a number of things that could be improved with this change.


I am sure things can be improved, but removing completely out of date 
stuff can't be that bad.


The change is needed, thanks.

I had a couple of points. Both minor in the context of the needed change.

The first is the maintenance of embedded the version numbers in the 
documentation. If we can avoid doing that the work per release or dot 
release is less.


The second is the changing of `kernel` to `src`. The use of `kernel` was 
specific because it removes any ambiguity when a new user attempts to 
build a package like libbsd in the same tree. Source can mean it is the 
place where all source is placed. I think `kernel` should be used and 
returned.


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


[PATCH rtems-lwip] lwip.py: Move bsp-specific information out

2022-11-09 Thread Kinsey Moore
This moves all BSP-specific information out of lwip.py and into JSON
descriptions of the files required to compile the drivers for each BSP.

Note that file-import.json is kept separate because it is used to manage
updating from upstream.
---
 COPYING.defs  |  23 
 ORIGIN.defs   |   1 +
 defs/bsps/aarch64/xilinx_zynqmp_base.json |  30 
 .../aarch64/xilinx_zynqmp_ilp32_qemu.json |  11 ++
 .../aarch64/xilinx_zynqmp_ilp32_zu3eg.json|  11 ++
 .../bsps/aarch64/xilinx_zynqmp_lp64_qemu.json |  11 ++
 .../aarch64/xilinx_zynqmp_lp64_zu3eg.json |  11 ++
 defs/bsps/arm/beaglebone_bw_base.json |  10 ++
 defs/bsps/arm/beagleboneblack.json|   5 +
 defs/bsps/arm/beaglebonewhite.json|   5 +
 defs/bsps/arm/tms570_base.json|   9 ++
 defs/bsps/arm/tms570ls3137_hdk.json   |   5 +
 defs/bsps/arm/tms570ls3137_hdk_intram.json|   5 +
 defs/bsps/arm/tms570ls3137_hdk_sdram.json |   5 +
 .../arm/tms570ls3137_hdk_with_loader.json |   5 +
 defs/common/lwip.json |  17 +++
 lwip.py   | 129 --
 17 files changed, 194 insertions(+), 99 deletions(-)
 create mode 100644 COPYING.defs
 create mode 100644 ORIGIN.defs
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_base.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_ilp32_qemu.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_ilp32_zu3eg.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_qemu.json
 create mode 100644 defs/bsps/aarch64/xilinx_zynqmp_lp64_zu3eg.json
 create mode 100644 defs/bsps/arm/beaglebone_bw_base.json
 create mode 100644 defs/bsps/arm/beagleboneblack.json
 create mode 100644 defs/bsps/arm/beaglebonewhite.json
 create mode 100644 defs/bsps/arm/tms570_base.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk_intram.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk_sdram.json
 create mode 100644 defs/bsps/arm/tms570ls3137_hdk_with_loader.json
 create mode 100644 defs/common/lwip.json

diff --git a/COPYING.defs b/COPYING.defs
new file mode 100644
index 000..d971823
--- /dev/null
+++ b/COPYING.defs
@@ -0,0 +1,23 @@
+/*
+ * 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.
+ */
+
diff --git a/ORIGIN.defs b/ORIGIN.defs
new file mode 100644
index 000..33c421c
--- /dev/null
+++ b/ORIGIN.defs
@@ -0,0 +1 @@
+The files under the defs/ directory are written specifically for this project.
diff --git a/defs/bsps/aarch64/xilinx_zynqmp_base.json 
b/defs/bsps/aarch64/xilinx_zynqmp_base.json
new file mode 100644
index 000..515ad6e
--- /dev/null
+++ b/defs/bsps/aarch64/xilinx_zynqmp_base.json
@@ -0,0 +1,30 @@
+{
+   "header-paths-to-import": [
+   
"embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/include",
+   "embeddedsw/lib/bsp/standalone/src/common",
+   "embeddedsw/XilinxProcessorIPLib/drivers/common/src/",
+   "embeddedsw/XilinxProcessorIPLib/drivers/scugic/src",
+   "embeddedsw/XilinxProcessorIPLib/drivers/emacps/src",
+   "rtemslwip/xilinx",
+   "rtemslwip/zynqmp",
+   "embeddedsw/lib/bsp/standalone/src/arm/ARMv8/64bit",
+   "embeddedsw/lib/bsp/standalone/src/arm/common/gcc",
+   "embeddedsw/lib/bsp/standalone/src/arm/common"
+   ],
+   "source-paths-to-import": [
+   "rtemslwip/zynqmp"
+   ],
+   "source-files-to-import": [
+   
"embeddedsw/ThirdParty/sw_services/lwip211/src/contrib/ports/xilinx/netif/xadapter.c",
+   

RE: _Timecounter_* behaviour with sleeping cores (windup delayed)

2022-11-09 Thread Silistru, Lucian-Raul
Hi,

The one this is happening on is a 4.11 ... might be worth trying that change.

As for the second part, thanks for the info. Will verify current idea and 
possibly have to manage monotony of time when exiting sleep.

Best regards,
Lucian Silistru
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


Re: _Timecounter_* behaviour with sleeping cores (windup delayed)

2022-11-09 Thread Sebastian Huber

Hello Lucian Silistru,

which RTEMS version do you use? Is it maybe this bug:

http://devel.rtems.org/ticket/4617

If there is a full rollover of the hardware counter, then there is 
nothing we can do.


--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

_Timecounter_* behaviour with sleeping cores (windup delayed)

2022-11-09 Thread Silistru, Lucian-Raul
I've seen a strange behaviour with _Timecounter_Binuptime where time can go 
back in a setup where the core is sometimes sleeping (with no periodic 
interrupts enabled - tick is off). The timecounter keeps running.

My current guess would be that the tick is skipped enough times that the 
timecounter almost does a full rollover, at which point time will restart from 
an earlier value i.e for a specific previous "th_offset_count" there are a few 
binuptime() calls where delta goes from 1 to 0x_ (resulting in a time 
increase) then delta rolls over to a small value again, which gives the time 
jump.

I am trying to find out if there's any obvious mechanism I am not 
seeing/finding that would prevent the above from happening?

Thank you
Lucian Silistru
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH] cpukit/fdt: Fix typos and clarify params

2022-11-09 Thread Kinsey Moore
---
 cpukit/include/rtems/rtems-fdt.h | 24 +++-
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/cpukit/include/rtems/rtems-fdt.h b/cpukit/include/rtems/rtems-fdt.h
index 3919593582..18e04352aa 100644
--- a/cpukit/include/rtems/rtems-fdt.h
+++ b/cpukit/include/rtems/rtems-fdt.h
@@ -256,7 +256,7 @@ int rtems_fdt_register (const void* blob, rtems_fdt_handle* 
handle);
 
 /**
  * Unload a device tree blob or DTB file and release any memory allocated when
- * loading. The blob is removed from the list of registered.
+ * loading. The blob is removed from the list if registered.
  *
  * @param blob_desc A valid blob descriptor.
  * @return int If less than 0 it is an error code else 0 is return on success.
@@ -296,7 +296,7 @@ int rtems_fdt_get_mem_rsv (rtems_fdt_handle* handle,
  * larger string, such as a full path.
  *
  * @param blob_desc A valid blob descriptor.
- * @param arentoffset Structure block offset of a node
+ * @param parentoffset Structure block offset of a node
  * @param name Name of the subnode to locate.
  * @param namelen Number of characters of name to consider.
  * @return int If less than 0 it is an error code else the node offset is
@@ -345,7 +345,9 @@ int rtems_fdt_path_offset (rtems_fdt_handle* handle, const 
char* path);
  *
  * @param handle The FDT handle to the current blob.
  * @param nodeoffset Structure block offset of the starting node.
- * @param length Pointer to an integer variable (will be overwritten) or NULL.
+ * @param length Pointer to an integer variable or NULL. If non-NULL, this will
+ *   be overwritten with either the length in bytes or the error
+ *   code.
  * @return const char* The node's name on success or NULL on error. The length
  * if non-NULL will hold the error code.
  */
@@ -378,7 +380,9 @@ int rtems_fdt_next_prop_offset(rtems_fdt_handle* handle, 
int propoffset);
  * @param handle The FDT handle to the current blob.
  * @param propoffset Property offset
  * @param name If not NULL set the pointer to the name string.
- * @param length Pointer to an integer variable (will be overwritten) or NULL.
+ * @param length Pointer to an integer variable or NULL. If non-NULL, this will
+ *   be overwritten with either the length in bytes or the error
+ *   code.
  * @return const void* The node's value data.
  */
 const void* rtems_fdt_getprop_by_offset(rtems_fdt_handle* handle,
@@ -395,8 +399,9 @@ const void* rtems_fdt_getprop_by_offset(rtems_fdt_handle* 
handle,
  * @param nodeoffset Offset of the node whose property to find
  * @param name The name of the property to find
  * @param namelen The number of characters of name to consider
- * @param length A pointer to an integer variable (will be overwritten) or
- *   NULL.
+ * @param length Pointer to an integer variable or NULL. If non-NULL, this will
+ *   be overwritten with either the length in bytes or the error
+ *   code.
  * @return const void* The node's property on success or NULL on error. The
  * length if non-NULL will hold the error code.
  */
@@ -416,8 +421,9 @@ const void *rtems_fdt_getprop_namelen (rtems_fdt_handle* 
handle,
  * @param handle The FDT handle to the current blob.
  * @param nodeoffset The offset of the node whose property to find.
  * @param name The name of the property to find.
- * @param length A pointer to an integer variable (will be overwritten) or
- *   NULL.
+ * @param length Pointer to an integer variable or NULL. If non-NULL, this will
+ *   be overwritten with either the length in bytes or the error
+ *   code.
  * @return const void* The node's property on success or NULL on error. The
  * length if non-NULL will hold the error code.
  */
@@ -427,7 +433,7 @@ const void *rtems_fdt_getprop (rtems_fdt_handle* handle,
int*  length);
 
 /**
- * Retrieve the phandle of a given of the device tree node at structure block
+ * Retrieve the phandle of the device tree node at structure block
  * offset nodeoffset.
  *
  * @param handle The FDT handle to the current blob.
-- 
2.30.2

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


[PATCH 08/10] bsps/riscv: bsp_interrupt_get/set_affinity()

2022-11-09 Thread Sebastian Huber
Provide bsp_interrupt_get_affinity() and bsp_interrupt_set_affinity() only if
RTEMS_SMP is enabled.  Replace fatal error with a status code.
---
 bsps/include/bsp/fatal.h   |  2 +-
 bsps/riscv/riscv/irq/irq.c | 19 ++-
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/bsps/include/bsp/fatal.h b/bsps/include/bsp/fatal.h
index ec8bd68280..a09b8ed6a5 100644
--- a/bsps/include/bsp/fatal.h
+++ b/bsps/include/bsp/fatal.h
@@ -185,7 +185,7 @@ typedef enum {
   RISCV_FATAL_NO_PLIC_REG_IN_DEVICE_TREE,
   RISCV_FATAL_INVALID_PLIC_NDEV_IN_DEVICE_TREE,
   RISCV_FATAL_TOO_LARGE_PLIC_NDEV_IN_DEVICE_TREE,
-  RISCV_FATAL_INVALID_INTERRUPT_AFFINITY,
+  RISCV_FATAL_UNUSED_0,
   RISCV_FATAL_NO_NS16550_INTERRUPTS_IN_DEVICE_TREE,
   RISCV_FATAL_NO_TLCLOCK_FREQUENCY_IN_DEVICE_TREE,
   RISCV_FATAL_CLOCK_SMP_INIT,
diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 2999485f88..44d0778ec7 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -567,6 +567,7 @@ rtems_status_code 
bsp_interrupt_vector_disable(rtems_vector_number vector)
   return RTEMS_SUCCESSFUL;
 }
 
+#ifdef RTEMS_SMP
 rtems_status_code bsp_interrupt_set_affinity(
   rtems_vector_number vector,
   const Processor_mask *affinity
@@ -595,7 +596,7 @@ rtems_status_code bsp_interrupt_set_affinity(
   return RTEMS_SUCCESSFUL;
 }
 
-bsp_fatal(RISCV_FATAL_INVALID_INTERRUPT_AFFINITY);
+return RTEMS_INVALID_NUMBER;
   }
 
   return RTEMS_UNSATISFIED;
@@ -606,8 +607,6 @@ rtems_status_code bsp_interrupt_get_affinity(
   Processor_mask *affinity
 )
 {
-  _Processor_mask_Zero(affinity);
-
   if (RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector)) {
 uint32_t interrupt_index;
 volatile uint32_t *enable;
@@ -616,7 +615,6 @@ rtems_status_code bsp_interrupt_get_affinity(
 enable = riscv_plic_irq_to_cpu[interrupt_index - 1];
 
 if (enable != NULL) {
-#ifdef RTEMS_SMP
   uint32_t cpu_max;
   uint32_t cpu_index;
 
@@ -632,18 +630,13 @@ rtems_status_code bsp_interrupt_get_affinity(
   break;
 }
   }
-#else
-  Per_CPU_Control *cpu;
-
-  cpu = _Per_CPU_Get_by_index(0);
-
-  if (enable == cpu->cpu_per_cpu.plic_m_ie)
-_Processor_mask_Set(affinity, 0);
-#endif
 } else {
   _Processor_mask_Assign(affinity, _SMP_Get_online_processors());
 }
+
+return RTEMS_SUCCESSFUL;
   }
 
-  return RTEMS_SUCCESSFUL;
+  return RTEMS_UNSATISFIED;
 }
+#endif
-- 
2.35.3

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


[PATCH 07/10] bsps/riscv: bsp_interrupt_raise_on()

2022-11-09 Thread Sebastian Huber
Implement bsp_interrupt_raise_on() and bsp_interrupt_raise().
---
 bsps/riscv/riscv/irq/irq.c | 24 
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 2e68551ae5..2999485f88 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -346,10 +346,27 @@ rtems_status_code bsp_interrupt_is_pending(
   return RTEMS_SUCCESSFUL;
 }
 
-rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
+static inline rtems_status_code riscv_raise_on(
+  rtems_vector_number vector,
+  uint32_tcpu_index
+)
 {
+  Per_CPU_Control *cpu;
+
   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
-  return RTEMS_UNSATISFIED;
+
+  if (vector != RISCV_INTERRUPT_VECTOR_SOFTWARE) {
+return RTEMS_UNSATISFIED;
+  }
+
+  cpu = _Per_CPU_Get_by_index(cpu_index);
+  *cpu->cpu_per_cpu.clint_msip = 0x1;
+  return RTEMS_SUCCESSFUL;
+}
+
+rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
+{
+  return riscv_raise_on(vector, rtems_scheduler_get_processor());
 }
 
 #if defined(RTEMS_SMP)
@@ -358,8 +375,7 @@ rtems_status_code bsp_interrupt_raise_on(
   uint32_tcpu_index
 )
 {
-  bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
-  return RTEMS_UNSATISFIED;
+  return riscv_raise_on(vector, cpu_index);
 }
 #endif
 
-- 
2.35.3

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


[PATCH 09/10] bsps/riscv: Always dispatch software interrupts

2022-11-09 Thread Sebastian Huber
This helps to run the interrupt API validation tests.
---
 bsps/riscv/riscv/irq/irq.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 44d0778ec7..c8b0801cc3 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -99,7 +99,6 @@ void _RISCV_Interrupt_dispatch(uintptr_t mcause, 
Per_CPU_Control *cpu_self)
   __asm__ volatile ("fence o, i" : : : "memory");
 }
   } else if (mcause == (RISCV_INTERRUPT_SOFTWARE_MACHINE << 1)) {
-#ifdef RTEMS_SMP
 /*
  * Clear the software interrupt on this processor.  Synchronization of
  * inter-processor interrupts is done via Per_CPU_Control::message in
@@ -107,10 +106,10 @@ void _RISCV_Interrupt_dispatch(uintptr_t mcause, 
Per_CPU_Control *cpu_self)
  */
 *cpu_self->cpu_per_cpu.clint_msip = 0;
 
+#ifdef RTEMS_SMP
 _SMP_Inter_processor_interrupt_handler(cpu_self);
-#else
-bsp_interrupt_handler_dispatch(RISCV_INTERRUPT_VECTOR_SOFTWARE);
 #endif
+bsp_interrupt_handler_dispatch(RISCV_INTERRUPT_VECTOR_SOFTWARE);
   } else {
 bsp_fatal(RISCV_FATAL_UNEXPECTED_INTERRUPT_EXCEPTION);
   }
-- 
2.35.3

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


[PATCH 10/10] bsps/riscv: Add tm27 support

2022-11-09 Thread Sebastian Huber
---
 bsps/riscv/riscv/include/tm27.h | 137 +++-
 1 file changed, 136 insertions(+), 1 deletion(-)

diff --git a/bsps/riscv/riscv/include/tm27.h b/bsps/riscv/riscv/include/tm27.h
index 0dfa7bf628..3e092214e5 100644
--- a/bsps/riscv/riscv/include/tm27.h
+++ b/bsps/riscv/riscv/include/tm27.h
@@ -1 +1,136 @@
-#include 
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @ingroup RTEMSBSPsRISCVGeneric
+ *
+ * @brief This header file contains the generic RISC-V tm27 support
+ *   implementation.
+ */
+
+/*
+ * Copyright (C) 2022 embedded brains GmbH
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RTEMS_TMTEST27
+#error "This is an RTEMS internal file you must not include directly."
+#endif
+
+#ifndef __tm27_h
+#define __tm27_h
+
+#include 
+#include 
+#include 
+#include 
+
+#define MUST_WAIT_FOR_INTERRUPT 1
+
+static bool riscv_tm27_can_use_mtime;
+
+static rtems_interrupt_entry riscv_tm27_interrupt_entry;
+
+static inline void Install_tm27_vector(
+  void ( *handler )( rtems_vector_number )
+)
+{
+  rtems_vector_number irq;
+  boolenabled;
+
+  irq = RISCV_INTERRUPT_VECTOR_TIMER;
+  enabled = false;
+  rtems_interrupt_vector_is_enabled( irq, &enabled );
+
+  if ( enabled ) {
+irq = RISCV_INTERRUPT_VECTOR_SOFTWARE;
+  } else {
+riscv_tm27_can_use_mtime = true;
+  }
+
+  rtems_interrupt_entry_initialize(
+&riscv_tm27_interrupt_entry,
+(rtems_interrupt_handler) handler,
+NULL,
+"tm27"
+  );
+
+  (void) rtems_interrupt_entry_install(
+irq,
+RTEMS_INTERRUPT_SHARED,
+&riscv_tm27_interrupt_entry
+  );
+}
+
+static inline void Cause_tm27_intr( void )
+{
+  if ( riscv_tm27_can_use_mtime ) {
+rtems_interrupt_level level;
+Per_CPU_Control  *cpu_self;
+
+rtems_interrupt_local_disable( level );
+cpu_self = _Per_CPU_Get();
+cpu_self->cpu_per_cpu.clint_mtimecmp->val_64 = 0;
+rtems_interrupt_local_enable( level );
+  } else {
+(void) rtems_interrupt_raise( RISCV_INTERRUPT_VECTOR_SOFTWARE );
+  }
+}
+
+static inline void Clear_tm27_intr( void )
+{
+  if ( riscv_tm27_can_use_mtime ) {
+rtems_interrupt_level level;
+Per_CPU_Control  *cpu_self;
+
+rtems_interrupt_local_disable( level );
+cpu_self = _Per_CPU_Get();
+cpu_self->cpu_per_cpu.clint_mtimecmp->val_64 = UINT64_MAX;
+rtems_interrupt_local_enable( level );
+  } else {
+(void) rtems_interrupt_clear( RISCV_INTERRUPT_VECTOR_SOFTWARE );
+  }
+}
+
+static inline void Lower_tm27_intr( void )
+{
+  rtems_vector_number irq;
+
+  /*
+   * This is an ugly hack just to for tm27.  The support for nested interrupts
+   * is currently quite bad on RISC-V.
+   */
+  irq = RISCV_INTERRUPT_VECTOR_SOFTWARE;
+
+  if ( bsp_interrupt_handler_table[ irq ] == NULL ) {
+_Assert( riscv_tm27_can_use_mtime );
+bsp_interrupt_handler_table[ irq ] = &riscv_tm27_interrupt_entry;
+(void) rtems_interrupt_vector_enable( irq );
+  }
+
+  _ISR_Set_level( 0 );
+  (void) rtems_interrupt_raise( irq );
+}
+
+#endif
-- 
2.35.3

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


[PATCH 06/10] bsps/riscv: bsp_interrupt_is_pending()

2022-11-09 Thread Sebastian Huber
Implement this function.
---
 bsps/riscv/riscv/irq/irq.c | 27 +--
 1 file changed, 25 insertions(+), 2 deletions(-)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index a48ba2346c..2e68551ae5 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -48,6 +48,8 @@
 
 #include 
 
+volatile RISCV_PLIC_regs *riscv_plic;
+
 volatile RISCV_CLINT_regs *riscv_clint;
 
 /*
@@ -186,6 +188,8 @@ static void riscv_plic_init(const void *fdt)
 #endif
   }
 
+  riscv_plic = plic;
+
   val = fdt_getprop(fdt, node, "riscv,ndev", &len);
   if (val == NULL || len != 4) {
 bsp_fatal(RISCV_FATAL_INVALID_PLIC_NDEV_IN_DEVICE_TREE);
@@ -319,8 +323,27 @@ rtems_status_code bsp_interrupt_is_pending(
 {
   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   bsp_interrupt_assert(pending != NULL);
-  *pending = false;
-  return RTEMS_UNSATISFIED;
+
+  if (RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector)) {
+uint32_t interrupt_index;
+uint32_t group;
+uint32_t bit;
+
+interrupt_index = RISCV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(vector);
+group = interrupt_index / 32;
+bit = UINT32_C(1) << (interrupt_index % 32);
+*pending = ((riscv_plic->pending[group] & bit) != 0);
+return RTEMS_SUCCESSFUL;
+  }
+
+  if (vector == RISCV_INTERRUPT_VECTOR_TIMER) {
+*pending = (read_csr(mip) & MIP_MTIP) != 0;
+return RTEMS_SUCCESSFUL;
+  }
+
+  _Assert(vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
+  *pending = (read_csr(mip) & MIP_MSIP) != 0;
+  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_raise(rtems_vector_number vector)
-- 
2.35.3

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


[PATCH 02/10] bsps/riscv: bsp_interrupt_vector_is_enabled()

2022-11-09 Thread Sebastian Huber
Implement this function.
---
 bsps/riscv/riscv/irq/irq.c | 49 --
 1 file changed, 47 insertions(+), 2 deletions(-)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 943dd4a68b..8de9e47cbc 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -338,8 +338,53 @@ rtems_status_code bsp_interrupt_vector_is_enabled(
 {
   bsp_interrupt_assert(bsp_interrupt_is_valid_vector(vector));
   bsp_interrupt_assert(enabled != NULL);
-  *enabled = false;
-  return RTEMS_UNSATISFIED;
+
+  if (RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector)) {
+uint32_t interrupt_index;
+uint32_t group;
+uint32_t bit;
+Per_CPU_Control *cpu;
+#ifdef RTEMS_SMP
+uint32_t cpu_max;
+uint32_t cpu_index;
+#endif
+
+interrupt_index = RISCV_INTERRUPT_VECTOR_EXTERNAL_TO_INDEX(vector);
+group = interrupt_index / 32;
+bit = UINT32_C(1) << (interrupt_index % 32);
+
+#ifdef RTEMS_SMP
+cpu_max = _SMP_Get_processor_maximum();
+
+for (cpu_index = 0; cpu_index < cpu_max; ++cpu_index) {
+  volatile uint32_t *enable;
+
+  cpu = _Per_CPU_Get_by_index(cpu_index);
+  enable = cpu->cpu_per_cpu.plic_m_ie;
+
+  if (enable != NULL && (enable[group] & bit) != 0) {
+*enabled = true;
+return RTEMS_SUCCESSFUL;
+  }
+}
+
+*enabled = false;
+#else
+cpu = _Per_CPU_Get_by_index(0);
+*enabled = (cpu->cpu_per_cpu.plic_m_ie[group] & bit) != 0;
+#endif
+
+return RTEMS_SUCCESSFUL;
+  }
+
+  if (vector == RISCV_INTERRUPT_VECTOR_TIMER) {
+*enabled = (read_csr(mie) & MIP_MTIP) != 0;
+return RTEMS_SUCCESSFUL;
+  }
+
+  _Assert(vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
+  *enabled = (read_csr(mie) & MIP_MSIP) != 0;
+  return RTEMS_SUCCESSFUL;
 }
 
 rtems_status_code bsp_interrupt_vector_enable(rtems_vector_number vector)
-- 
2.35.3

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


[PATCH 05/10] bsps/riscv: bsp_interrupt_get_attributes()

2022-11-09 Thread Sebastian Huber
Implement this function.
---
 bsps/riscv/riscv/irq/irq.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 238cb7f62a..a48ba2346c 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -294,6 +294,21 @@ rtems_status_code bsp_interrupt_get_attributes(
   rtems_interrupt_attributes *attributes
 )
 {
+  attributes->is_maskable = true;
+  attributes->can_enable = true;
+  attributes->maybe_enable = true;
+  attributes->can_disable = true;
+  attributes->maybe_disable = true;
+  attributes->can_raise = (vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
+  attributes->can_raise_on = attributes->can_raise;
+  attributes->cleared_by_acknowledge = true;
+  attributes->can_get_affinity = RISCV_INTERRUPT_VECTOR_IS_EXTERNAL(vector);
+  attributes->can_set_affinity = attributes->can_get_affinity;
+
+  if (vector == RISCV_INTERRUPT_VECTOR_SOFTWARE) {
+attributes->trigger_signal = RTEMS_INTERRUPT_NO_SIGNAL;
+  }
+
   return RTEMS_SUCCESSFUL;
 }
 
-- 
2.35.3

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


[PATCH 00/10] Improve riscv interrupt API support

2022-11-09 Thread Sebastian Huber
Sebastian Huber (10):
  bsps/riscv: bsp_interrupt_is_valid_vector()
  bsps/riscv: bsp_interrupt_vector_is_enabled()
  bsps/riscv: Improve bsp_interrupt_vector_enable()
  bsps/riscv: Improve bsp_interrupt_vector_disable()
  bsps/riscv: bsp_interrupt_get_attributes()
  bsps/riscv: bsp_interrupt_is_pending()
  bsps/riscv: bsp_interrupt_raise_on()
  bsps/riscv: bsp_interrupt_get/set_affinity()
  bsps/riscv: Always dispatch software interrupts
  bsps/riscv: Add tm27 support

 bsps/include/bsp/fatal.h   |   2 +-
 bsps/riscv/riscv/include/bsp/irq.h |   2 +
 bsps/riscv/riscv/include/tm27.h| 137 ++-
 bsps/riscv/riscv/irq/irq.c | 172 -
 4 files changed, 286 insertions(+), 27 deletions(-)

-- 
2.35.3

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


[PATCH 01/10] bsps/riscv: bsp_interrupt_is_valid_vector()

2022-11-09 Thread Sebastian Huber
Implement this function.
---
 bsps/riscv/riscv/include/bsp/irq.h |  2 ++
 bsps/riscv/riscv/irq/irq.c | 17 -
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/bsps/riscv/riscv/include/bsp/irq.h 
b/bsps/riscv/riscv/include/bsp/irq.h
index ae1ba3c757..93c9780111 100644
--- a/bsps/riscv/riscv/include/bsp/irq.h
+++ b/bsps/riscv/riscv/include/bsp/irq.h
@@ -58,6 +58,8 @@
 
 #define BSP_INTERRUPT_VECTOR_COUNT 
RISCV_INTERRUPT_VECTOR_EXTERNAL(RISCV_MAXIMUM_EXTERNAL_INTERRUPTS)
 
+#define BSP_INTERRUPT_CUSTOM_VALID_VECTOR
+
 rtems_status_code bsp_interrupt_set_affinity(
   rtems_vector_number vector,
   const Processor_mask *affinity
diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 1f383ebb89..943dd4a68b 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
 /**
  * @file
  *
@@ -7,7 +9,7 @@
  */
 
 /*
- * Copyright (c) 2018 embedded brains GmbH
+ * Copyright (C) 2018, 2022 embedded brains GmbH
  *
  * Copyright (c) 2015 University of York.
  * Hesham Almatary 
@@ -274,6 +276,19 @@ void bsp_interrupt_facility_initialize(void)
   riscv_plic_init(fdt);
 }
 
+bool bsp_interrupt_is_valid_vector(rtems_vector_number vector)
+{
+  /*
+   * The PLIC interrupt ID of zero is reserved.  For example, this ID is used
+   * to indicate that no interrupt was claimed.
+   */
+  if (vector == RISCV_INTERRUPT_VECTOR_EXTERNAL(0)) {
+return false;
+  }
+
+  return vector < (rtems_vector_number) BSP_INTERRUPT_VECTOR_COUNT;
+}
+
 rtems_status_code bsp_interrupt_get_attributes(
   rtems_vector_number vector,
   rtems_interrupt_attributes *attributes
-- 
2.35.3

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


[PATCH 04/10] bsps/riscv: Improve bsp_interrupt_vector_disable()

2022-11-09 Thread Sebastian Huber
Add support for hart-specific software and timer interrupts.
---
 bsps/riscv/riscv/irq/irq.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 3bce33ae13..238cb7f62a 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -500,8 +500,16 @@ rtems_status_code 
bsp_interrupt_vector_disable(rtems_vector_number vector)
 }
 
 rtems_interrupt_lock_release(&riscv_plic_lock, &lock_context);
+return RTEMS_SUCCESSFUL;
+  }
+
+  if (vector == RISCV_INTERRUPT_VECTOR_TIMER) {
+clear_csr(mie, MIP_MTIP);
+return RTEMS_SUCCESSFUL;
   }
 
+  _Assert(vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
+  clear_csr(mie, MIP_MSIP);
   return RTEMS_SUCCESSFUL;
 }
 
-- 
2.35.3

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


[PATCH 03/10] bsps/riscv: Improve bsp_interrupt_vector_enable()

2022-11-09 Thread Sebastian Huber
Add support for hart-specific software and timer interrupts.
---
 bsps/riscv/riscv/irq/irq.c | 8 
 1 file changed, 8 insertions(+)

diff --git a/bsps/riscv/riscv/irq/irq.c b/bsps/riscv/riscv/irq/irq.c
index 8de9e47cbc..3bce33ae13 100644
--- a/bsps/riscv/riscv/irq/irq.c
+++ b/bsps/riscv/riscv/irq/irq.c
@@ -437,8 +437,16 @@ rtems_status_code 
bsp_interrupt_vector_enable(rtems_vector_number vector)
 }
 
 rtems_interrupt_lock_release(&riscv_plic_lock, &lock_context);
+return RTEMS_SUCCESSFUL;
+  }
+
+  if (vector == RISCV_INTERRUPT_VECTOR_TIMER) {
+set_csr(mie, MIP_MTIP);
+return RTEMS_SUCCESSFUL;
   }
 
+  _Assert(vector == RISCV_INTERRUPT_VECTOR_SOFTWARE);
+  set_csr(mie, MIP_MSIP);
   return RTEMS_SUCCESSFUL;
 }
 
-- 
2.35.3

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


[PATCH rtems] Remove remnants of rtems_io_lookup_name

2022-11-09 Thread Joel Sherrill
Updates #3420.
---
 cpukit/include/adainclude/rtems-io.adb | 21 -
 testsuites/sptests/sp21/sp21.scn   |  3 ---
 2 files changed, 24 deletions(-)

diff --git a/cpukit/include/adainclude/rtems-io.adb 
b/cpukit/include/adainclude/rtems-io.adb
index 41a315c..addc2e2 100644
--- a/cpukit/include/adainclude/rtems-io.adb
+++ b/cpukit/include/adainclude/rtems-io.adb
@@ -67,27 +67,6 @@ package body RTEMS.IO is
 
end Register_Name;
 
-   procedure Lookup_Name
- (Name: in String;
-  Device_Info : out RTEMS.Driver_Name_t;
-  Result  : out RTEMS.Status_Codes)
-   is
-  function Lookup_Name_Base
-(Name: Interfaces.C.char_array;
- Device_Info : access RTEMS.Driver_Name_t)
- returnRTEMS.Status_Codes;
-  pragma Import (C, Lookup_Name_Base, "rtems_io_lookup_name");
-  Device_Info_Base : aliased RTEMS.Driver_Name_t;
-   begin
-
-  Result  :=
- Lookup_Name_Base
-   (Interfaces.C.To_C (Name),
-Device_Info_Base'Unchecked_Access);
-  Device_Info := Device_Info_Base;
-
-   end Lookup_Name;
-
procedure Open
  (Major: in RTEMS.Device_Major_Number;
   Minor: in RTEMS.Device_Minor_Number;
diff --git a/testsuites/sptests/sp21/sp21.scn b/testsuites/sptests/sp21/sp21.scn
index 6c099df..87c798d 100644
--- a/testsuites/sptests/sp21/sp21.scn
+++ b/testsuites/sptests/sp21/sp21.scn
@@ -25,8 +25,5 @@ rtems_io_register_driver - RTEMS_SUCCESSFUL - overwrite NULL
 rtems_io_register_driver - RTEMS_TOO_MANY - no slots
 rtems_io_register_driver - RTEMS_RESOURCE_IN_USE - major in use
 rtems_io_unregister_driver - RTEMS_SUCCESSFUL
-rtems_io_lookup_name( "", &info ) - RTEMS_UNSATISFIED
-rtems_io_lookup_name( "/dev", &info ) - RTEMS_UNSATISFIED
-rtems_io_lookup_name( "/dev/null", &info ) - RTEMS_SUCCESSFUL
 -  TESTING THE ZERO DRIVER CHECKS  -
 *** END OF TEST 21 ***
-- 
1.8.3.1

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