[PATCH v1] bsps/amd64: remove -Werror from ABI flags

2022-08-22 Thread Stephen Clark
From: Stephen Clark 

The ABI flags for the amd64 BSP contain the -Werror=return-type flag. There is 
no reason for this to be there so it has been removed. The same option has also 
been removed amd64.cfg file.
---
 bsps/x86_64/amd64/config/amd64.cfg   | 1 -
 spec/build/bsps/x86_64/amd64/abi.yml | 1 -
 2 files changed, 2 deletions(-)

diff --git a/bsps/x86_64/amd64/config/amd64.cfg 
b/bsps/x86_64/amd64/config/amd64.cfg
index ad861cb867..fe19a9ee55 100644
--- a/bsps/x86_64/amd64/config/amd64.cfg
+++ b/bsps/x86_64/amd64/config/amd64.cfg
@@ -11,6 +11,5 @@ CPU_CFLAGS  = -mno-red-zone
 # way we can avoid linker-time relocation errors spawning from values being
 # larger than their optimized container sizes.
 CPU_CFLAGS += -mcmodel=large
-CPU_CFLAGS += -Werror=return-type
 
 LDFLAGS = -Wl,--gc-sections
diff --git a/spec/build/bsps/x86_64/amd64/abi.yml 
b/spec/build/bsps/x86_64/amd64/abi.yml
index ca5a815c24..3e8748d069 100644
--- a/spec/build/bsps/x86_64/amd64/abi.yml
+++ b/spec/build/bsps/x86_64/amd64/abi.yml
@@ -9,7 +9,6 @@ copyrights:
 default:
 - -mno-red-zone
 - -mcmodel=large
-- -Werror=return-type
 default-by-variant: []
 description: |
   ABI flags
-- 
2.31.1

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


RE: [PATCH rtems v1 2/2] bsps/zynqmp: Added I2C support for ZynqMP

2021-08-24 Thread Stephen Clark
Chris,
This approach was also used in bsps/arm/xilinx-zynq/include/bsp/i2c.h. I kept 
it specifically for consistency; I assumed it was the standard approach, but 
your response makes me think it's not. 
Is there a case to be made for breaking the register functions in both i2c.h 
files out into their own c files?
Thanks,
Stephen

> -Original Message-
> From: Chris Johns 
> Sent: Monday, August 23, 2021 9:38 PM
> To: Stephen Clark ; devel@rtems.org
> Subject: Re: [PATCH rtems v1 2/2] bsps/zynqmp: Added I2C support for ZynqMP
> 
> On 24/8/21 8:24 am, Stephen Clark wrote:
> > Added I2C drivers for ZynqMP and updated build system accordingly.
> > ---
> >  bsps/aarch64/xilinx-zynqmp/include/bsp.h  |  4 ++
> >  bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h  | 63
> > +++  bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h  |  2 +
> >  bsps/aarch64/xilinx-zynqmp/start/bspstart.c   | 10 +++
> >  spec/build/bsps/aarch64/xilinx-zynqmp/grp.yml |  4 ++
> > .../bsps/aarch64/xilinx-zynqmp/grp_zu3eg.yml  |  2 +
> >  .../aarch64/xilinx-zynqmp/objcadencei2c.yml   | 19 ++
> >  .../bsps/aarch64/xilinx-zynqmp/optclki2c0.yml | 19 ++
> > .../bsps/aarch64/xilinx-zynqmp/optclki2c1.yml | 19 ++
> >  9 files changed, 142 insertions(+)
> >  create mode 100644 bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
> >  create mode 100644
> > spec/build/bsps/aarch64/xilinx-zynqmp/objcadencei2c.yml
> >  create mode 100644
> > spec/build/bsps/aarch64/xilinx-zynqmp/optclki2c0.yml
> >  create mode 100644
> > spec/build/bsps/aarch64/xilinx-zynqmp/optclki2c1.yml
> >
> > diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp.h
> > b/bsps/aarch64/xilinx-zynqmp/include/bsp.h
> > index 83f2e2f4e4..6d49b9ad2a 100644
> > --- a/bsps/aarch64/xilinx-zynqmp/include/bsp.h
> > +++ b/bsps/aarch64/xilinx-zynqmp/include/bsp.h
> > @@ -70,6 +70,10 @@ BSP_START_TEXT_SECTION void
> > zynqmp_setup_mmu_and_cache(void);
> >
> >  void zynqmp_debug_console_flush(void);
> >
> > +uint32_t zynqmp_clock_i2c0(void);
> > +
> > +uint32_t zynqmp_clock_i2c1(void);
> > +
> >  #ifdef __cplusplus
> >  }
> >  #endif /* __cplusplus */
> > diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
> > b/bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
> > new file mode 100644
> > index 00..e09747d414
> > --- /dev/null
> > +++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
> > @@ -0,0 +1,63 @@
> > +/*
> > + * SPDX-License-Identifier: BSD-2-Clause
> > + *
> > + * Copyright (C) 2021 On-Line Applications Research (OAR)
> > + *
> > + * 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 LIBBSP_ARM_XILINX_ZYNQ_I2C_H
> > +#define LIBBSP_ARM_XILINX_ZYNQ_I2C_H
> > +
> > +#include 
> > +#include 
> > +#include 
> > +
> > +#ifdef __cplusplus
> > +extern "C" {
> > +#endif /* __cplusplus */
> > +
> > +static inline int zynqmp_register_i2c_0(void) {
> > +  return i2c_bus_register_cadence(
> > +"/dev/i2c-0",
> > +0x00FF02,
> > +zynqmp_clock_i2c0(),
> > +ZYNQMP_IRQ_I2C_0
> > +  );
> > +}
> > +
> > +static inline int zynqmp_register_i2c_1(void) {
> > +  return i2c_bus_register_cadence(
> > +"/dev/i2c-1",
> > +0x00FF03,
> > +zynqmp_clock_i2c1(),
> > +ZYNQMP_IRQ_I2C_1
> > +  );
> 
> I know these are currently inlined but I do not know why they are. It is the 
> only
> BSP that does this. Should they be moved to a .c file seem they are being
> touched?
> 
> Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH rtems v1 2/2] bsps/zynqmp: Added I2C support for ZynqMP

2021-08-23 Thread Stephen Clark
Added I2C drivers for ZynqMP and updated build system accordingly.
---
 bsps/aarch64/xilinx-zynqmp/include/bsp.h  |  4 ++
 bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h  | 63 +++
 bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h  |  2 +
 bsps/aarch64/xilinx-zynqmp/start/bspstart.c   | 10 +++
 spec/build/bsps/aarch64/xilinx-zynqmp/grp.yml |  4 ++
 .../bsps/aarch64/xilinx-zynqmp/grp_zu3eg.yml  |  2 +
 .../aarch64/xilinx-zynqmp/objcadencei2c.yml   | 19 ++
 .../bsps/aarch64/xilinx-zynqmp/optclki2c0.yml | 19 ++
 .../bsps/aarch64/xilinx-zynqmp/optclki2c1.yml | 19 ++
 9 files changed, 142 insertions(+)
 create mode 100644 bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
 create mode 100644 spec/build/bsps/aarch64/xilinx-zynqmp/objcadencei2c.yml
 create mode 100644 spec/build/bsps/aarch64/xilinx-zynqmp/optclki2c0.yml
 create mode 100644 spec/build/bsps/aarch64/xilinx-zynqmp/optclki2c1.yml

diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp.h 
b/bsps/aarch64/xilinx-zynqmp/include/bsp.h
index 83f2e2f4e4..6d49b9ad2a 100644
--- a/bsps/aarch64/xilinx-zynqmp/include/bsp.h
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp.h
@@ -70,6 +70,10 @@ BSP_START_TEXT_SECTION void zynqmp_setup_mmu_and_cache(void);
 
 void zynqmp_debug_console_flush(void);
 
+uint32_t zynqmp_clock_i2c0(void);
+
+uint32_t zynqmp_clock_i2c1(void);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h 
b/bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
new file mode 100644
index 00..e09747d414
--- /dev/null
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/i2c.h
@@ -0,0 +1,63 @@
+/*
+ * SPDX-License-Identifier: BSD-2-Clause
+ *
+ * Copyright (C) 2021 On-Line Applications Research (OAR)
+ *
+ * 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 LIBBSP_ARM_XILINX_ZYNQ_I2C_H
+#define LIBBSP_ARM_XILINX_ZYNQ_I2C_H
+
+#include 
+#include 
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+static inline int zynqmp_register_i2c_0(void)
+{
+  return i2c_bus_register_cadence(
+"/dev/i2c-0",
+0x00FF02,
+zynqmp_clock_i2c0(),
+ZYNQMP_IRQ_I2C_0
+  );
+}
+
+static inline int zynqmp_register_i2c_1(void)
+{
+  return i2c_bus_register_cadence(
+"/dev/i2c-1",
+0x00FF03,
+zynqmp_clock_i2c1(),
+ZYNQMP_IRQ_I2C_1
+  );
+}
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* LIBBSP_ARM_XILINX_ZYNQ_I2C_H */
diff --git a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h 
b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
index b67d7d0f8e..9af41643bd 100644
--- a/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
+++ b/bsps/aarch64/xilinx-zynqmp/include/bsp/irq.h
@@ -53,6 +53,8 @@ extern "C" {
 /* Interrupts vectors */
 #define BSP_TIMER_VIRT_PPI 27
 #define BSP_TIMER_PHYS_NS_PPI 30
+#define ZYNQMP_IRQ_I2C_0 49
+#define ZYNQMP_IRQ_I2C_1 50
 #define ZYNQMP_IRQ_UART_0 54
 #define ZYNQMP_IRQ_UART_1 53
 #define ZYNQMP_IRQ_ETHERNET_0 89
diff --git a/bsps/aarch64/xilinx-zynqmp/start/bspstart.c 
b/bsps/aarch64/xilinx-zynqmp/start/bspstart.c
index 36194a337d..d75e5a1620 100644
--- a/bsps/aarch64/xilinx-zynqmp/start/bspstart.c
+++ b/bsps/aarch64/xilinx-zynqmp/start/bspstart.c
@@ -39,6 +39,16 @@
 #include 
 #include 
 
+__attribute__ ((weak)) uint32_t zynqmp_clock_i2c0(void)
+{
+  return ZYNQMP_CLOCK_I2C0;
+}
+
+__attribute__ ((weak)) uint32_t zynqmp_clock_i2c1(void)
+{
+  return ZYNQMP_CLOCK_I2C1;
+}
+
 void bsp_start( void )
 {
   bsp_interrupt_initialize();
diff --git a/spec/build/bsps/aarch64/xilinx-zynqmp/grp.yml 
b/spec/build/bsps/aarch64/xilinx-zynqmp/grp.yml
index 03ccdbbc8b..1a356903cd 100644
--- a/spec/build/bsps/aarch64/xilinx-zynqmp/grp.yml
+++ 

[PATCH rtems v1 1/2] bsps/zynq: Moved general i2c files to shared directories

2021-08-23 Thread Stephen Clark
Certain files related to the Zynq BSP's I2C driver are useable by the ZynqMP 
BSP as well.
Moved these files to shared directory in anticipation of I2C support for ZynqMP.
---
 .../include/bsp => include/dev/i2c}/cadence-i2c-regs.h  | 0
 .../include/bsp => include/dev/i2c}/cadence-i2c.h   | 0
 bsps/{arm/xilinx-zynq => shared/dev}/i2c/cadence-i2c.c  | 4 ++--
 spec/build/bsps/arm/xilinx-zynq/obj.yml | 6 +++---
 4 files changed, 5 insertions(+), 5 deletions(-)
 rename bsps/{arm/xilinx-zynq/include/bsp => 
include/dev/i2c}/cadence-i2c-regs.h (100%)
 rename bsps/{arm/xilinx-zynq/include/bsp => include/dev/i2c}/cadence-i2c.h 
(100%)
 rename bsps/{arm/xilinx-zynq => shared/dev}/i2c/cadence-i2c.c (99%)

diff --git a/bsps/arm/xilinx-zynq/include/bsp/cadence-i2c-regs.h 
b/bsps/include/dev/i2c/cadence-i2c-regs.h
similarity index 100%
rename from bsps/arm/xilinx-zynq/include/bsp/cadence-i2c-regs.h
rename to bsps/include/dev/i2c/cadence-i2c-regs.h
diff --git a/bsps/arm/xilinx-zynq/include/bsp/cadence-i2c.h 
b/bsps/include/dev/i2c/cadence-i2c.h
similarity index 100%
rename from bsps/arm/xilinx-zynq/include/bsp/cadence-i2c.h
rename to bsps/include/dev/i2c/cadence-i2c.h
diff --git a/bsps/arm/xilinx-zynq/i2c/cadence-i2c.c 
b/bsps/shared/dev/i2c/cadence-i2c.c
similarity index 99%
rename from bsps/arm/xilinx-zynq/i2c/cadence-i2c.c
rename to bsps/shared/dev/i2c/cadence-i2c.c
index 07379992ce..91774fb926 100644
--- a/bsps/arm/xilinx-zynq/i2c/cadence-i2c.c
+++ b/bsps/shared/dev/i2c/cadence-i2c.c
@@ -25,8 +25,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-#include 
+#include 
+#include 
 
 #include 
 #include 
diff --git a/spec/build/bsps/arm/xilinx-zynq/obj.yml 
b/spec/build/bsps/arm/xilinx-zynq/obj.yml
index e81decaa3d..8a11a45dd3 100644
--- a/spec/build/bsps/arm/xilinx-zynq/obj.yml
+++ b/spec/build/bsps/arm/xilinx-zynq/obj.yml
@@ -14,8 +14,8 @@ install:
   - bsps/arm/xilinx-zynq/include/tm27.h
 - destination: ${BSP_INCLUDEDIR}/bsp
   source:
-  - bsps/arm/xilinx-zynq/include/bsp/cadence-i2c-regs.h
-  - bsps/arm/xilinx-zynq/include/bsp/cadence-i2c.h
+  - bsps/include/dev/i2c/cadence-i2c-regs.h
+  - bsps/include/dev/i2c/cadence-i2c.h
   - bsps/arm/xilinx-zynq/include/bsp/i2c.h
   - bsps/arm/xilinx-zynq/include/bsp/irq.h
 links: []
@@ -28,7 +28,7 @@ source:
 - bsps/arm/xilinx-zynq/console/console-config.c
 - bsps/arm/xilinx-zynq/console/console-init.c
 - bsps/arm/xilinx-zynq/console/debug-console.c
-- bsps/arm/xilinx-zynq/i2c/cadence-i2c.c
+- bsps/shared/dev/i2c/cadence-i2c.c
 - bsps/arm/xilinx-zynq/start/bspreset.c
 - bsps/arm/xilinx-zynq/start/bspstart.c
 - bsps/arm/xilinx-zynq/start/bspstarthooks.c
-- 
2.27.0

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


[PATCH rtems-docs v2 2/2] README: Added centOS 8 instructions

2021-07-15 Thread Stephen Clark
Added some instructions for setting up CentOS 8.
---
 README.txt | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/README.txt b/README.txt
index 13bf8e6..828c9e7 100644
--- a/README.txt
+++ b/README.txt
@@ -287,6 +287,17 @@ PATH:
   export PATH=/usr/local/texlive/2016/bin/i386-linux/:${PATH}
   export PATH=${HOME}/.local/bin:${PATH}
 
+CentOS 8
+
+
+The steps for Centos 8 are similar to the steps for CentOS 7.
+There are just a couple differences.
+
+First, CentOS 8 uses Python 3.x as the default, so intalling the
+centos-release-scl and rh-python36 packages is unnecessary.
+Second, Centos 8 uses dnf as its package manager instead of yum, so
+packages such as npm should be installed using dnf instead.
+
 Arch Linux
 ~~
 
-- 
2.27.0

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


[PATCH rtems-docs v2 1/2] README: Minor clarifications and fixes

2021-07-15 Thread Stephen Clark
Fixed some minor typographical errors.
Updated a dead link.
Reworded some sentences for clarity.
---
 README.txt | 49 +
 1 file changed, 25 insertions(+), 24 deletions(-)

diff --git a/README.txt b/README.txt
index 03f57ed..13bf8e6 100644
--- a/README.txt
+++ b/README.txt
@@ -1,16 +1,17 @@
 RTEMS Project Documentation
 ===
 
-The documents are written in ReST and built using Sphinx. The build system will
-check the version of Sphinx and ensure you have a suitable version
-available. If your host does not provide a packaged version use PIP to fetch a
+The documents are written in ReST and built using Sphinx. The waf build system
+will check the version of Sphinx and ensure you have a suitable version
+available. If your host does not provide a packaged version, use PIP to fetch a
 recent version. The Sphinx website provides details on doing this.
 
-ReST is the Re-Structured-Text format. It is a simple markup language that 
allows
-us to create quality documentaion. It is flexible and powerful however does not
-attempt to train it to create a specific format. You need to test any new way
-of presenting something on all output formats. What may look great in one
-format may not translate with the same clarity to another output format.
+ReST is the Re-Structured-Text format. It is a simple markup language that
+allows us to create quality documentation which can easily be converted to
+multiple different formats. This flexibility is convenient, but you still need
+to test any new way of presenting something on all output formats. What may 
look
+great in one format may not translate with the same clarity to another output
+format.
 
 The RTEMS Documentation output formats are:
 
@@ -26,7 +27,7 @@ Images can be created from source using PlantUML and Ditaa.
 
 A Sphinx checksheet is:
 
- http://docs.sphinxdocs.com/en/latest/cheatsheet.html#rst-cheat-sheet
+ https://sphinx-tutorial.readthedocs.io/cheatsheet/#rst-cheat-sheet
 
 Production Quality Hosts
 
@@ -45,7 +46,7 @@ NOTE: RedHat Enterprise Linux (RHEL) and Fedora should be the 
same as CentOS.
 Images
 --
 
-All images should be placed int he 'images' directory and referenced from the
+All images should be placed in the 'images' directory and referenced from the
 ReST with a relative path. This lets us shared and control images.
 
 We prefer being able to build images from source. This is not always possible
@@ -85,7 +86,7 @@ The home page contain the language options. The PlantUML 
online demo server
 supports Ditaa so use that resource as an online tool. The Ditaa image source
 extension is '.ditaa'.
 
-You do not need PlantUML or Ditaa install to build our documentation. The
+You do not need PlantUML or Ditaa installed to build our documentation. The
 online resources can be used. Save the source and the generated PNG file in the
 same directory under 'images'.
 
@@ -94,12 +95,12 @@ Host Setup
 
 HTML builds directly with Sphinx, PDF requires a full Latex (texlive) install,
 and building a Single HTML page requires the 'inliner' tool. The
-sphinxcontrib-bibtex extension is mandatory. PlantUML requres the Node.js
+sphinxcontrib-bibtex extension is mandatory. PlantUML requires the Node.js
 package called 'node-plantuml' which installs the 'puml' command and Ditaa 
needs
 the 'ditaa' command and package. Ditaa images are built using the 'puml'
 command.
 
-Please add your host as you set it up.
+Please add your host to this section as you set it up.
 
 The best results are produced with Python3 and a virtual environment`. It can
 create a specific python environment using `pip`.
@@ -107,8 +108,8 @@ create a specific python environment using `pip`.
 Virtual Environment
 ~~~
 
-Create a directory to house the virtual environment, create the envrionment
-and the activate it. This example assumes Python3 and the `venv` module:
+Create a directory to house the virtual environment, create the environment,
+and then activate it. This example assumes Python3 and the `venv` module:
 
   $ mkdir sphinx
   $ python3 -m venv sphinx
@@ -120,7 +121,7 @@ Alternatively you can use the `virtualenv` command:
   $ virtualenv sphinx
   $ . ./sphinx/bin/activate
 
-The prompt will now change. You can install Sphinx with:
+Either way, the prompt will now change. You can install Sphinx with:
 
   $ pip install sphinx
   $ pip install sphinxcontrib-bibtex
@@ -321,11 +322,11 @@ packages. There is no common naming and no real way to 
figure what texlive
 package is present in a host's packaging. It seems not all of texlive is
 available.
 
-The RTEMS Documentation waf configure phase check for each texlive package used
+The RTEMS Documentation waf configure phase checks for each texlive package 
used
 in the generated output and the styles. If you complete configure with the
 --pdf option you should be able to build PDF documentation.
 
-The texlive package 

[PATCH rtems-docs v1 2/2] user/bsps/aarch64: Minor formatting fix

2021-07-14 Thread Stephen Clark
Fixed formatting error in user/bsps/aarch64/a53.rst
and user/bsps/aarch64/xilinx-zynqmp.rst.
---
 user/bsps/aarch64/a53.rst   | 8 +---
 user/bsps/aarch64/xilinx-zynqmp.rst | 8 +---
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/user/bsps/aarch64/a53.rst b/user/bsps/aarch64/a53.rst
index 52e1509..9d8e1ce 100644
--- a/user/bsps/aarch64/a53.rst
+++ b/user/bsps/aarch64/a53.rst
@@ -29,7 +29,9 @@ The console driver supports the default Qemu emulated ARM 
PL011 PrimeCell UART.
 Running Executables
 ---
 
-Executables generated by these BSPs can be run using the following command::
+Executables generated by these BSPs can be run using the following command:
 
-qemu-system-aarch64 -no-reboot -nographic -serial mon:stdio \
- -machine virt,gic-version=3 -cpu cortex-a53 -m 4096 -kernel example.exe
+.. code-block:: shell
+
+  qemu-system-aarch64 -no-reboot -nographic -serial mon:stdio \
+   -machine virt,gic-version=3 -cpu cortex-a53 -m 4096 -kernel example.exe
diff --git a/user/bsps/aarch64/xilinx-zynqmp.rst 
b/user/bsps/aarch64/xilinx-zynqmp.rst
index 30ae8a3..85c70e0 100644
--- a/user/bsps/aarch64/xilinx-zynqmp.rst
+++ b/user/bsps/aarch64/xilinx-zynqmp.rst
@@ -85,7 +85,9 @@ Most ZynqMP dev boards use CGEM3. None of the interfaces are 
enabled by default.
 Running Executables on QEMU
 ---
 
-Executables generated by these BSPs can be run using the following command::
+Executables generated by these BSPs can be run using the following command:
 
-qemu-system-aarch64 -no-reboot -nographic -serial mon:stdio \
- -machine xlnx-zcu102 -m 4096 -kernel example.exe
+.. code-block:: shell
+
+  qemu-system-aarch64 -no-reboot -nographic -serial mon:stdio \
+   -machine xlnx-zcu102 -m 4096 -kernel example.exe
-- 
2.27.0

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


[PATCH rtems-docs v1 1/2] xilinx-zynqmp.rst: Documented SDIO driver

2021-07-14 Thread Stephen Clark
Added documentation for SDIO driver.
---
 user/bsps/aarch64/xilinx-zynqmp.rst | 14 ++
 1 file changed, 14 insertions(+)

diff --git a/user/bsps/aarch64/xilinx-zynqmp.rst 
b/user/bsps/aarch64/xilinx-zynqmp.rst
index 71b6842..30ae8a3 100644
--- a/user/bsps/aarch64/xilinx-zynqmp.rst
+++ b/user/bsps/aarch64/xilinx-zynqmp.rst
@@ -55,6 +55,20 @@ Console Driver
 The console driver supports the default Qemu emulated ARM PL011 PrimeCell UART
 as well as the physical ARM PL011 PrimeCell UART in the ZynqMP hardware.
 
+SDHCI Driver
+
+
+The ZynqMP bsp has an SDHCI driver which allows reading to and writing from SD 
+cards. These can be tested in qemu using the "-sd" option. For example:
+
+.. code-block:: shell
+  
+  qemu-system-aarch64 -no-reboot -nographic -serial mon:stdio \
+   -machine xlnx-zcu102 -m 4096 -kernel media01.exe -sd example.img
+
+The SD card image should have an MSDOS partition table with a single partition
+containing a FAT file system.
+
 Network Configuration
 -
 
-- 
2.27.0

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


[PATCH rtems-docs v1] readme: Minor clarifications and fixes

2021-07-14 Thread Stephen Clark
Added some instructions for setting up CentOS 8.
Fixed some minor typographical errors.
Updated a dead link.
Reworded some sentences for clarity
---
 README.txt | 58 ++
 1 file changed, 32 insertions(+), 26 deletions(-)

diff --git a/README.txt b/README.txt
index 03f57ed..53549f2 100644
--- a/README.txt
+++ b/README.txt
@@ -1,16 +1,17 @@
 RTEMS Project Documentation
 ===
 
-The documents are written in ReST and built using Sphinx. The build system will
-check the version of Sphinx and ensure you have a suitable version
-available. If your host does not provide a packaged version use PIP to fetch a
+The documents are written in ReST and built using Sphinx. The waf build system
+will check the version of Sphinx and ensure you have a suitable version
+available. If your host does not provide a packaged version, use PIP to fetch a
 recent version. The Sphinx website provides details on doing this.
 
-ReST is the Re-Structured-Text format. It is a simple markup language that 
allows
-us to create quality documentaion. It is flexible and powerful however does not
-attempt to train it to create a specific format. You need to test any new way
-of presenting something on all output formats. What may look great in one
-format may not translate with the same clarity to another output format.
+ReST is the Re-Structured-Text format. It is a simple markup language that 
+allows us to create quality documentation which can easily be converted to 
+multiple different formats. This flexibility is convenient, but you still need
+to test any new way of presenting something on all output formats. What may 
look
+great in one format may not translate with the same clarity to another output
+format.
 
 The RTEMS Documentation output formats are:
 
@@ -26,7 +27,7 @@ Images can be created from source using PlantUML and Ditaa.
 
 A Sphinx checksheet is:
 
- http://docs.sphinxdocs.com/en/latest/cheatsheet.html#rst-cheat-sheet
+ https://sphinx-tutorial.readthedocs.io/cheatsheet/#rst-cheat-sheet
 
 Production Quality Hosts
 
@@ -45,7 +46,7 @@ NOTE: RedHat Enterprise Linux (RHEL) and Fedora should be the 
same as CentOS.
 Images
 --
 
-All images should be placed int he 'images' directory and referenced from the
+All images should be placed in the 'images' directory and referenced from the
 ReST with a relative path. This lets us shared and control images.
 
 We prefer being able to build images from source. This is not always possible
@@ -85,7 +86,7 @@ The home page contain the language options. The PlantUML 
online demo server
 supports Ditaa so use that resource as an online tool. The Ditaa image source
 extension is '.ditaa'.
 
-You do not need PlantUML or Ditaa install to build our documentation. The
+You do not need PlantUML or Ditaa installed to build our documentation. The
 online resources can be used. Save the source and the generated PNG file in the
 same directory under 'images'.
 
@@ -94,12 +95,12 @@ Host Setup
 
 HTML builds directly with Sphinx, PDF requires a full Latex (texlive) install,
 and building a Single HTML page requires the 'inliner' tool. The
-sphinxcontrib-bibtex extension is mandatory. PlantUML requres the Node.js
+sphinxcontrib-bibtex extension is mandatory. PlantUML requires the Node.js
 package called 'node-plantuml' which installs the 'puml' command and Ditaa 
needs
 the 'ditaa' command and package. Ditaa images are built using the 'puml'
 command.
 
-Please add your host as you set it up.
+Please add your host to this section as you set it up.
 
 The best results are produced with Python3 and a virtual environment`. It can
 create a specific python environment using `pip`.
@@ -107,7 +108,7 @@ create a specific python environment using `pip`.
 Virtual Environment
 ~~~
 
-Create a directory to house the virtual environment, create the envrionment
+Create a directory to house the virtual environment, create the environment
 and the activate it. This example assumes Python3 and the `venv` module:
 
   $ mkdir sphinx
@@ -120,7 +121,7 @@ Alternatively you can use the `virtualenv` command:
   $ virtualenv sphinx
   $ . ./sphinx/bin/activate
 
-The prompt will now change. You can install Sphinx with:
+Either way, the prompt will now change. You can install Sphinx with:
 
   $ pip install sphinx
   $ pip install sphinxcontrib-bibtex
@@ -207,8 +208,8 @@ Ditaa:
 
   # pkg install ditaa
 
-CentOS 7
-
+CentOS 7 & 8
+
 
 PDF Quality: production
 
@@ -221,6 +222,8 @@ software. As root,
   # yum install centos-release-scl
   # yum install rh-python36
 
+On CentOS 8, this is unnecessary as Python 3.x is the default.
+
 Then you can create your own virtual Python environment
 for use with the Sphinx toolchain.
 
@@ -263,7 +266,8 @@ PDF:
 Single HTML:
 
 NOTE: npm appears to be part of the EPEL repository for RHEL and CentOS.
-You may have to add that repository to your 

[PATCH rtems-libbsd v1] nexus: Added SDHCI driver to ZynqMP

2021-07-12 Thread Stephen Clark
Made ZynqMP build with the SDHCI driver.
---
 rtemsbsd/include/bsp/nexus-devices.h  |  4 +++
 .../include/machine/rtems-bsd-nexus-bus.h | 29 +++
 2 files changed, 33 insertions(+)

diff --git a/rtemsbsd/include/bsp/nexus-devices.h 
b/rtemsbsd/include/bsp/nexus-devices.h
index 5b51de7e..fdc845c1 100644
--- a/rtemsbsd/include/bsp/nexus-devices.h
+++ b/rtemsbsd/include/bsp/nexus-devices.h
@@ -119,6 +119,10 @@ 
RTEMS_BSD_DRIVER_XILINX_ZYNQMP_CGEM3(ZYNQMP_IRQ_ETHERNET_3);
 RTEMS_BSD_DRIVER_E1000PHY;
 RTEMS_BSD_DRIVER_UKPHY;
 
+RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI0;
+RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI1;
+RTEMS_BSD_DRIVER_MMC;
+
 #elif defined(LIBBSP_ARM_ATSAM_BSP_H)
 
 RTEMS_BSD_DRIVER_USB;
diff --git a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h 
b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
index ccf8efa6..103d5b1d 100644
--- a/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
+++ b/rtemsbsd/include/machine/rtems-bsd-nexus-bus.h
@@ -139,6 +139,35 @@ extern "C" {
   _slcr_res[0])
 #endif /* RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SLCR */
 
+/*
+ * Xilinx ZynqMP Arasan SDIO Driver.
+ */
+#if !defined(RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI)
+  #define RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI(_num, _base, _irq)  
   \
+static const rtems_bsd_device_resource arasan_sdhci ## _num ## _res[] = {  
 \
+  {
 \
+.type = RTEMS_BSD_RES_MEMORY,  
 \
+.start_request = 0,
 \
+.start_actual = (_base)
 \
+  }, { 
 \
+.type = RTEMS_BSD_RES_IRQ, 
 \
+.start_request = 0,
 \
+.start_actual = (_irq) 
 \
+  }
 \
+}; 
 \
+RTEMS_BSD_DEFINE_NEXUS_DEVICE(arasan_sdhci, _num,  
 \
+  RTEMS_ARRAY_SIZE(arasan_sdhci ## _num ## 
_res),  \
+  _sdhci ## _num ## _res[0])
+#endif /* RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI */
+#if !defined(RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI0)
+  #define RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI0\
+RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI(0, 0xFF16, 80) 
+#endif /* RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI0 */
+#if !defined(RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI1)
+  #define RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI1\
+RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI(1, 0xFF17, 81)
+#endif /* RTEMS_BSD_DRIVER_XILINX_ZYNQMP_SDHCI1 */
+
 /*
  * Xilinx Zynq Arasan SDIO Driver.
  */
-- 
2.27.0

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


Testing SDIO drivers for ZynqMP in RTEMS-libbsd

2021-06-29 Thread Stephen Clark
Hi,
I'm working on updating the ZynqMP board's nexus devices so that it will load 
SDHCI device drivers, but I'm not sure what the best way to test the drivers 
is. I don't see an existing test for SDIO functionality in the libbsd test 
suites.
Also, does anyone have any advice for running RTEMS in QEMU with SD cards?
Thanks,
Stephen Clark
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

[PATCH rtems-libbsd v3 4/4] rtemsbsd: Added a test for the TTCP command.

2021-06-16 Thread Stephen Clark
Added a new test for the TTCP command. Modified default-network-init.h
to conditionally build the shell with TTCP. Modified libbsd.py to build
the new TTCP test.
---
 libbsd.py |  1 +
 .../rtems/bsd/test/default-network-init.h |  7 +++
 testsuite/ttcpshell01/test_main.c | 55 +++
 3 files changed, 63 insertions(+)
 create mode 100644 testsuite/ttcpshell01/test_main.c

diff --git a/libbsd.py b/libbsd.py
index 2badfdee..cb310770 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5189,6 +5189,7 @@ class tests(builder.Module):
 
 def generate(self):
 mm = self.manager
+self.addTest(mm.generator['test']('ttcpshell01', ['test_main'], 
netTest = True, runTest = False))
 self.addTest(mm.generator['test']('epoch01', ['test_main'], extraLibs 
= ['rtemstest']))
 self.addTest(mm.generator['test']('nfs01', ['test_main'],
   netTest = True, modules = ['nfsv2']))
diff --git a/testsuite/include/rtems/bsd/test/default-network-init.h 
b/testsuite/include/rtems/bsd/test/default-network-init.h
index b367d956..20c0b2e7 100644
--- a/testsuite/include/rtems/bsd/test/default-network-init.h
+++ b/testsuite/include/rtems/bsd/test/default-network-init.h
@@ -318,9 +318,16 @@ Init(rtems_task_argument arg)
   #define SHELL_WPA_SUPPLICANT_COMMAND
 #endif
 
+#ifdef SHELL_TTCP_COMMAND_ENABLE
+  #define SHELL_TTCP_COMMAND _shell_TTCP_Command,
+#else
+  #define SHELL_TTCP_COMMAND 
+#endif
+
 #define CONFIGURE_SHELL_USER_COMMANDS \
   SHELL_WLANSTATS_COMMAND \
   SHELL_WPA_SUPPLICANT_COMMAND \
+  SHELL_TTCP_COMMAND \
   _interrupt_shell_command, \
   _shell_ARP_Command, \
   _shell_HOSTNAME_Command, \
diff --git a/testsuite/ttcpshell01/test_main.c 
b/testsuite/ttcpshell01/test_main.c
new file mode 100644
index ..c7631d14
--- /dev/null
+++ b/testsuite/ttcpshell01/test_main.c
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief RTEMS shell is started with DHCP client. It is possible to run TTCP.
+ */
+
+/*
+ * COPYRIGHT (c) 2021. On-Line Applications Research Corporation (OAR).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#define TEST_NAME "LIBBSD TTCP 1"
+#define TEST_STATE_USER_INPUT 1
+
+static void
+test_main(void)
+{
+   rtems_task_delete(RTEMS_SELF);
+   assert(0);
+}
+
+#define SHELL_TTCP_COMMAND_ENABLE
+#define DEFAULT_NETWORK_DHCPCD_ENABLE
+#define DEFAULT_NETWORK_SHELL
+
+#include 
-- 
2.27.0

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


[PATCH rtems-libbsd v3 3/4] rtemsbsd: Made TTCP command build for RTEMS

2021-06-16 Thread Stephen Clark
Updated ttcp.c to build clean for RTEMS 6 and the machines it
originally built for. Also fixed ttcp.c to close network
sockets after completion. Defined a shell command for TTCP in
rtems-bsd-shell-ttcp.c. Added TTCP to the list of RTEMS network
commands in netcmds-config.h. Added declaration of the TTCP shell
command to rtems-bsd-commands.h. Modified libbsd.py to make waf
build TTCP and its shell command.
---
 libbsd.py |   2 +
 rtemsbsd/include/machine/rtems-bsd-commands.h |   2 +
 rtemsbsd/include/rtems/netcmds-config.h   |   2 +
 rtemsbsd/rtems/rtems-bsd-shell-ttcp.c |  39 +++
 rtemsbsd/ttcp/README  |  11 +-
 rtemsbsd/ttcp/ttcp.c  | 279 ++
 6 files changed, 272 insertions(+), 63 deletions(-)
 create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-ttcp.c

diff --git a/libbsd.py b/libbsd.py
index b367d94e..2badfdee 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -269,6 +269,7 @@ class rtems(builder.Module):
 'rtems/rtems-bsd-shell-tcpdump.c',
 'rtems/rtems-bsd-shell-vmstat.c',
 'rtems/rtems-bsd-shell-wlanstats.c',
+'rtems/rtems-bsd-shell-ttcp.c',
 'rtems/rtems-kvm.c',
 'rtems/rtems-program.c',
 'rtems/rtems-program-socket.c',
@@ -292,6 +293,7 @@ class rtems(builder.Module):
 'pppd/upap.c',
 'pppd/utils.c',
 'telnetd/telnetd-service.c',
+'ttcp/ttcp.c',
 ],
 mm.generator['source']()
 )
diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h 
b/rtemsbsd/include/machine/rtems-bsd-commands.h
index d314471f..d82c274c 100644
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -84,6 +84,8 @@ int rtems_bsd_command_setkey(int argc, char **argv);
 
 int rtems_bsd_command_openssl(int argc, char **argv);
 
+int rtems_shell_main_ttcp(int argc, char **argv);
+
 __END_DECLS
 
 #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_ */
diff --git a/rtemsbsd/include/rtems/netcmds-config.h 
b/rtemsbsd/include/rtems/netcmds-config.h
index bc493af4..c1d56eb3 100644
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -29,6 +29,8 @@ extern rtems_shell_cmd_t rtems_shell_PFCTL_Command;
 extern rtems_shell_cmd_t rtems_shell_PING_Command;
 extern rtems_shell_cmd_t rtems_shell_PING6_Command;
 
+extern rtems_shell_cmd_t rtems_shell_TTCP_Command;
+
 extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
 
 extern rtems_shell_cmd_t rtems_shell_IFMCSTAT_Command;
diff --git a/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c 
b/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c
new file mode 100644
index ..babaa011
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * COPYRIGHT (c) 2021. On-Line Applications Research Corporation (OAR).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+rtems_shell_cmd_t rtems_shell_TTCP_Command = {
+  "ttcp",   /* name */
+  "ttcp -h # to get help",  /* usage */
+  "net",/* topic */
+  rtems_shell_main_ttcp,/* command */
+  NULL, /* alias */
+  NULL  /* next */
+};
diff --git a/rtemsbsd/ttcp/README b/rtemsbsd/ttcp/README
index 215ddacc..8a9bf017 100644
--- a/rtemsbsd/ttcp/README
+++ b/rtemsbsd/ttcp/README
@@ -7,14 +7,9 @@ but please do 

[PATCH rtems-libbsd v3 1/4] rtemsbsd: Added original TTCP code

2021-06-16 Thread Stephen Clark
Added the original Test TCP (TTCP) program in unmodified form.
Also added the original README for TTCP. Both the README and the
TTCP program were sourced from the first commit in the RTEMS
network demos repository.
---
 rtemsbsd/ttcp/README |  27 ++
 rtemsbsd/ttcp/ttcp.c | 841 +++
 2 files changed, 868 insertions(+)
 create mode 100644 rtemsbsd/ttcp/README
 create mode 100644 rtemsbsd/ttcp/ttcp.c

diff --git a/rtemsbsd/ttcp/README b/rtemsbsd/ttcp/README
new file mode 100644
index ..215ddacc
--- /dev/null
+++ b/rtemsbsd/ttcp/README
@@ -0,0 +1,27 @@
+TTCP is a benchmarking tool for determining TCP and UDP performance
+between 2 systems.
+
+The program was created at the US Army Ballistics Research Lab (BRL)
+and is in the public domain. Feel free to distribute this program
+but please do leave the credit notices in the source and man page intact.
+
+Contents of this directory:
+
+ttcp.c  Source that runs on IRIX 3.3.x and 4.0.x systems
+and BSD-based systems.  This version also uses getopt(3)
+and has 2 new options: -f and -T.
+
+ttcp.c-brl  Original source from BRL.
+
+ttcp.1  Manual page (describes ttcp.c options, which are a
+superset of the other version).
+
+
+How to get TCP performance numbers:
+
+receiversender
+
+host1%  ttcp -r -s  host2% ttcp -t -s host1
+
+-n and -l options change the number and size of the buffers.
+
diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
new file mode 100644
index ..305a7c7d
--- /dev/null
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -0,0 +1,841 @@
+/*
+ * T T C P . C
+ *
+ * Test TCP connection.  Makes a connection on port 5001
+ * and transfers fabricated buffers or data copied from stdin.
+ *
+ * Usable on 4.2, 4.3, and 4.1a systems by defining one of
+ * BSD42 BSD43 (BSD41a)
+ * Machines using System V with BSD sockets should define SYSV.
+ *
+ * Modified for operation under 4.2BSD, 18 Dec 84
+ *  T.C. Slattery, USNA
+ * Minor improvements, Mike Muuss and Terry Slattery, 16-Oct-85.
+ * Modified in 1989 at Silicon Graphics, Inc.
+ * catch SIGPIPE to be able to print stats when receiver has died 
+ * for tcp, don't look for sentinel during reads to allow small transfers
+ * increased default buffer size to 8K, nbuf to 2K to transfer 16MB
+ * moved default port to 5001, beyond IPPORT_USERRESERVED
+ * make sinkmode default because it is more popular, 
+ * -s now means don't sink/source 
+ * count number of read/write system calls to see effects of 
+ * blocking from full socket buffers
+ * for tcp, -D option turns off buffered writes (sets TCP_NODELAY sockopt)
+ * buffer alignment options, -A and -O
+ * print stats in a format that's a bit easier to use with grep & awk
+ * for SYSV, mimic BSD routines to use most of the existing timing code
+ * Modified by Steve Miller of the University of Maryland, College Park
+ * -b sets the socket buffer size (SO_SNDBUF/SO_RCVBUF)
+ * Modified Sept. 1989 at Silicon Graphics, Inc.
+ * restored -s sense at request of tcs@brl
+ * Modified Oct. 1991 at Silicon Graphics, Inc.
+ * use getopt(3) for option processing, add -f and -T options.
+ * SGI IRIX 3.3 and 4.0 releases don't need #define SYSV.
+ *
+ * Distribution Status -
+ *  Public Domain.  Distribution Unlimited.
+ */
+#ifndef lint
+static char RCSid[] = "ttcp.c $Revision$";
+#endif
+
+#define BSD43
+/* #define BSD42 */
+/* #define BSD41a */
+/* #define SYSV */ /* required on SGI IRIX releases before 3.3 */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include   /* struct timeval */
+
+#if defined(SYSV)
+#include 
+#include 
+struct rusage {
+struct timeval ru_utime, ru_stime;
+};
+#define RUSAGE_SELF 0
+#else
+#include 
+#endif
+
+struct sockaddr_in sinme;
+struct sockaddr_in sinhim;
+struct sockaddr_in frominet;
+
+int domain, fromlen;
+int fd;/* fd of network socket */
+
+int buflen = 8 * 1024; /* length of buffer */
+char *buf; /* ptr to dynamic buffer */
+int nbuf = 2 * 1024;   /* number of buffers to send in sinkmode */
+
+int bufoffset = 0; /* align buffer to this */
+int bufalign = 16*1024;/* modulo this */
+
+int udp = 0;   /* 0 = tcp, !0 = udp */
+int options = 0;   /* socket options */
+int one = 1;/* for 4.3 BSD style setsockopt() */
+short port = 5001; /* TCP port number */
+char *host;/* ptr to name of host */
+int trans; /* 0=receive, !0=transmit mode */
+int sinkmode = 0;  /* 0=normal I/O, !0=sink/source mode */
+int verbose = 0;   /* 0=print basic info, 1=print cpu rate, proc
+ 

[PATCH rtems-libbsd v3 2/4] rtemsbsd:Updated TTCP code with network demo code

2021-06-16 Thread Stephen Clark
Updated the TTCP code to match the ttcp.c in RTEMS network-demos
repository (https://git.rtems.org/network-demos/).
---
 rtemsbsd/ttcp/ttcp.c | 91 +++-
 1 file changed, 65 insertions(+), 26 deletions(-)

diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
index 305a7c7d..dc62c64b 100644
--- a/rtemsbsd/ttcp/ttcp.c
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -35,8 +35,9 @@
  * Distribution Status -
  *  Public Domain.  Distribution Unlimited.
  */
+
 #ifndef lint
-static char RCSid[] = "ttcp.c $Revision$";
+/* static char RCSid[] = "ttcp.c $Revision$"; */
 #endif
 
 #define BSD43
@@ -44,6 +45,8 @@ static char RCSid[] = "ttcp.c $Revision$";
 /* #define BSD41a */
 /* #define SYSV */ /* required on SGI IRIX releases before 3.3 */
 
+#define ENABLE_NANOSLEEP_DELAY
+
 #include 
 #include 
 #include 
@@ -54,8 +57,12 @@ static char RCSid[] = "ttcp.c $Revision$";
 #include 
 #include 
 #include 
+#include 
 #include   /* struct timeval */
 
+#include 
+#include 
+
 #if defined(SYSV)
 #include 
 #include 
@@ -71,7 +78,13 @@ struct sockaddr_in sinme;
 struct sockaddr_in sinhim;
 struct sockaddr_in frominet;
 
-int domain, fromlen;
+/* these make it easier to avoid warnings */
+struct sockaddr *sinhim_p = (struct sockaddr *) 
+struct sockaddr *sinme_p = (struct sockaddr *) 
+struct sockaddr *frominet_p = (struct sockaddr *) 
+
+int domain;
+socklen_t fromlen;
 int fd;/* fd of network socket */
 
 int buflen = 8 * 1024; /* length of buffer */
@@ -97,6 +110,7 @@ char fmt = 'K';  /* output format: k = 
kilobits, K = kilobytes,
 *  m = megabits, M = megabytes, 
 *  g = gigabits, G = gigabytes */
 int touchdata = 0; /* access data after reading */
+long milliseconds = 0;  /* delay in milliseconds */
 
 struct hostent *addr;
 extern int errno;
@@ -124,6 +138,7 @@ Options specific to -t:\n\
 Options specific to -r:\n\
-B  for -s, only output full blocks as specified by -l (for TAR)\n\
-T  \"touch\": access each byte as it's read\n\
+   -m ##   delay for specified milliseconds between each write\n\
 "; 
 
 char stats[128];
@@ -133,7 +148,7 @@ double cput, realt; /* user, real time (seconds) */
 
 void err();
 void mes();
-int pattern();
+void pattern();
 void prep_timer();
 double read_timer();
 int Nread();
@@ -147,7 +162,18 @@ sigpipe()
 {
 }
 
-main(argc,argv)
+void millisleep(long msec)
+{
+#if defined(ENABLE_NANOSLEEP_DELAY)
+  struct timespec req;
+
+  req.tv_sec = msec / 1000;
+  req.tv_nsec = (msec % 1000) * 100;
+
+  nanosleep( , NULL );
+#endif
+}
+int main(argc,argv)
 int argc;
 char **argv;
 {
@@ -156,7 +182,7 @@ char **argv;
 
if (argc < 2) goto usage;
 
-   while ((c = getopt(argc, argv, "drstuvBDTb:f:l:n:p:A:O:")) != -1) {
+   while ((c = getopt(argc, argv, "drstuvBDTb:f:l:m:n:p:A:O:")) != -1) {
switch (c) {
 
case 'B':
@@ -179,6 +205,12 @@ char **argv;
"ttcp: -D option ignored: TCP_NODELAY socket option not supported\n");
 #endif
break;
+   case 'm':
+   milliseconds = atoi(optarg);
+   #if !defined(ENABLE_NANOSLEEP_DELAY)
+   fprintf(stderr, "millisecond delay disabled\n");
+   #endif
+   break;
case 'n':
nbuf = atoi(optarg);
break;
@@ -285,7 +317,7 @@ char **argv;
err("socket");
mes("socket");
 
-   if (bind(fd, , sizeof(sinme)) < 0)
+   if (bind(fd, sinme_p, sizeof(sinme)) < 0)
err("bind");
 
 #if defined(SO_SNDBUF) || defined(SO_RCVBUF)
@@ -305,7 +337,9 @@ char **argv;
 #endif
 
if (!udp)  {
+#if !defined(__rtems__)
signal(SIGPIPE, sigpipe);
+#endif
if (trans) {
/* We are the client if transmitting */
if (options)  {
@@ -326,7 +360,7 @@ char **argv;
mes("nodelay");
}
 #endif
-   if(connect(fd, , sizeof(sinhim) ) < 0)
+   if(connect(fd, sinhim_p, sizeof(sinhim) ) < 0)
err("connect");
mes("connect");
} else {
@@ -348,11 +382,11 @@ char **argv;
}
fromlen = sizeof(frominet);
domain = AF_INET;
-   if((fd=accept(fd, , ) ) < 0)
+   if((fd=accept(fd, frominet_p, ) ) < 0)
err("accept");
{ struct sockaddr_in peer;
- int peerlen = sizeof(peer);
- if (getpeername(fd, (struct sockaddr_in *) , 
+ socklen_t peerlen = sizeof(peer);
+ if (getpeername(fd, (struct sockaddr *) , 
) < 0) {
 

[PATCH rtems-libbsd v2 4/4] rtemsbsd: Added a test for the TTCP command.

2021-06-11 Thread Stephen Clark
Added a new test for the TTCP command. Modified default-network-init.h
to conditionally build the shell with TTCP. Modified libbsd.py to build
the new TTCP test.
---
 libbsd.py |  1 +
 .../rtems/bsd/test/default-network-init.h |  7 +++
 testsuite/ttcpshell01/test_main.c | 55 +++
 3 files changed, 63 insertions(+)
 create mode 100644 testsuite/ttcpshell01/test_main.c

diff --git a/libbsd.py b/libbsd.py
index 2badfdee..cb310770 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5189,6 +5189,7 @@ class tests(builder.Module):
 
 def generate(self):
 mm = self.manager
+self.addTest(mm.generator['test']('ttcpshell01', ['test_main'], 
netTest = True, runTest = False))
 self.addTest(mm.generator['test']('epoch01', ['test_main'], extraLibs 
= ['rtemstest']))
 self.addTest(mm.generator['test']('nfs01', ['test_main'],
   netTest = True, modules = ['nfsv2']))
diff --git a/testsuite/include/rtems/bsd/test/default-network-init.h 
b/testsuite/include/rtems/bsd/test/default-network-init.h
index b367d956..20c0b2e7 100644
--- a/testsuite/include/rtems/bsd/test/default-network-init.h
+++ b/testsuite/include/rtems/bsd/test/default-network-init.h
@@ -318,9 +318,16 @@ Init(rtems_task_argument arg)
   #define SHELL_WPA_SUPPLICANT_COMMAND
 #endif
 
+#ifdef SHELL_TTCP_COMMAND_ENABLE
+  #define SHELL_TTCP_COMMAND _shell_TTCP_Command,
+#else
+  #define SHELL_TTCP_COMMAND 
+#endif
+
 #define CONFIGURE_SHELL_USER_COMMANDS \
   SHELL_WLANSTATS_COMMAND \
   SHELL_WPA_SUPPLICANT_COMMAND \
+  SHELL_TTCP_COMMAND \
   _interrupt_shell_command, \
   _shell_ARP_Command, \
   _shell_HOSTNAME_Command, \
diff --git a/testsuite/ttcpshell01/test_main.c 
b/testsuite/ttcpshell01/test_main.c
new file mode 100644
index ..c7631d14
--- /dev/null
+++ b/testsuite/ttcpshell01/test_main.c
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief RTEMS shell is started with DHCP client. It is possible to run TTCP.
+ */
+
+/*
+ * COPYRIGHT (c) 2021. On-Line Applications Research Corporation (OAR).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#define TEST_NAME "LIBBSD TTCP 1"
+#define TEST_STATE_USER_INPUT 1
+
+static void
+test_main(void)
+{
+   rtems_task_delete(RTEMS_SELF);
+   assert(0);
+}
+
+#define SHELL_TTCP_COMMAND_ENABLE
+#define DEFAULT_NETWORK_DHCPCD_ENABLE
+#define DEFAULT_NETWORK_SHELL
+
+#include 
-- 
2.27.0

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


[PATCH rtems-libbsd v2 3/4] rtemsbsd: Made TTCP command build for RTEMS

2021-06-11 Thread Stephen Clark
Updated ttcp.c to build for RTEMS 6, in addition to the machines
it originally built for. Also fixed ttcp.c to close network sockets
after completion. Defined a shell command for TTCP in
rtems-bsd-shell-ttcp.c. Added TTCP to the list of RTEMS network
commands in netcmds-config.h. Added declaration of the TTCP shell
command to rtems-bsd-commands.h. Modified libbsd.py to make waf
build TTCP and its shell command.
---
 libbsd.py |   2 +
 rtemsbsd/include/machine/rtems-bsd-commands.h |   2 +
 rtemsbsd/include/rtems/netcmds-config.h   |   2 +
 rtemsbsd/rtems/rtems-bsd-shell-ttcp.c |  39 +++
 rtemsbsd/ttcp/README  |  11 +-
 rtemsbsd/ttcp/ttcp.c  | 266 ++
 6 files changed, 262 insertions(+), 60 deletions(-)
 create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-ttcp.c

diff --git a/libbsd.py b/libbsd.py
index b367d94e..2badfdee 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -269,6 +269,7 @@ class rtems(builder.Module):
 'rtems/rtems-bsd-shell-tcpdump.c',
 'rtems/rtems-bsd-shell-vmstat.c',
 'rtems/rtems-bsd-shell-wlanstats.c',
+'rtems/rtems-bsd-shell-ttcp.c',
 'rtems/rtems-kvm.c',
 'rtems/rtems-program.c',
 'rtems/rtems-program-socket.c',
@@ -292,6 +293,7 @@ class rtems(builder.Module):
 'pppd/upap.c',
 'pppd/utils.c',
 'telnetd/telnetd-service.c',
+'ttcp/ttcp.c',
 ],
 mm.generator['source']()
 )
diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h 
b/rtemsbsd/include/machine/rtems-bsd-commands.h
index d314471f..d82c274c 100644
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -84,6 +84,8 @@ int rtems_bsd_command_setkey(int argc, char **argv);
 
 int rtems_bsd_command_openssl(int argc, char **argv);
 
+int rtems_shell_main_ttcp(int argc, char **argv);
+
 __END_DECLS
 
 #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_ */
diff --git a/rtemsbsd/include/rtems/netcmds-config.h 
b/rtemsbsd/include/rtems/netcmds-config.h
index bc493af4..c1d56eb3 100644
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -29,6 +29,8 @@ extern rtems_shell_cmd_t rtems_shell_PFCTL_Command;
 extern rtems_shell_cmd_t rtems_shell_PING_Command;
 extern rtems_shell_cmd_t rtems_shell_PING6_Command;
 
+extern rtems_shell_cmd_t rtems_shell_TTCP_Command;
+
 extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
 
 extern rtems_shell_cmd_t rtems_shell_IFMCSTAT_Command;
diff --git a/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c 
b/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c
new file mode 100644
index ..babaa011
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * COPYRIGHT (c) 2021. On-Line Applications Research Corporation (OAR).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+rtems_shell_cmd_t rtems_shell_TTCP_Command = {
+  "ttcp",   /* name */
+  "ttcp -h # to get help",  /* usage */
+  "net",/* topic */
+  rtems_shell_main_ttcp,/* command */
+  NULL, /* alias */
+  NULL  /* next */
+};
diff --git a/rtemsbsd/ttcp/README b/rtemsbsd/ttcp/README
index 215ddacc..8a9bf017 100644
--- a/rtemsbsd/ttcp/README
+++ b/rtemsbsd/ttcp/README
@@ -7,14 +7,9 @@ but please 

[PATCH rtems-libbsd v2 1/4] rtemsbsd: Added original TTCP code

2021-06-11 Thread Stephen Clark
Added the original Test TCP (TTCP) program in unmodified form.
Also added the original README for TTCP. Both the README and the
TTCP program were sourced from the first commit in the RTEMS
network demos repository.
---
 rtemsbsd/ttcp/README |  27 ++
 rtemsbsd/ttcp/ttcp.c | 841 +++
 2 files changed, 868 insertions(+)
 create mode 100644 rtemsbsd/ttcp/README
 create mode 100644 rtemsbsd/ttcp/ttcp.c

diff --git a/rtemsbsd/ttcp/README b/rtemsbsd/ttcp/README
new file mode 100644
index ..215ddacc
--- /dev/null
+++ b/rtemsbsd/ttcp/README
@@ -0,0 +1,27 @@
+TTCP is a benchmarking tool for determining TCP and UDP performance
+between 2 systems.
+
+The program was created at the US Army Ballistics Research Lab (BRL)
+and is in the public domain. Feel free to distribute this program
+but please do leave the credit notices in the source and man page intact.
+
+Contents of this directory:
+
+ttcp.c  Source that runs on IRIX 3.3.x and 4.0.x systems
+and BSD-based systems.  This version also uses getopt(3)
+and has 2 new options: -f and -T.
+
+ttcp.c-brl  Original source from BRL.
+
+ttcp.1  Manual page (describes ttcp.c options, which are a
+superset of the other version).
+
+
+How to get TCP performance numbers:
+
+receiversender
+
+host1%  ttcp -r -s  host2% ttcp -t -s host1
+
+-n and -l options change the number and size of the buffers.
+
diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
new file mode 100644
index ..305a7c7d
--- /dev/null
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -0,0 +1,841 @@
+/*
+ * T T C P . C
+ *
+ * Test TCP connection.  Makes a connection on port 5001
+ * and transfers fabricated buffers or data copied from stdin.
+ *
+ * Usable on 4.2, 4.3, and 4.1a systems by defining one of
+ * BSD42 BSD43 (BSD41a)
+ * Machines using System V with BSD sockets should define SYSV.
+ *
+ * Modified for operation under 4.2BSD, 18 Dec 84
+ *  T.C. Slattery, USNA
+ * Minor improvements, Mike Muuss and Terry Slattery, 16-Oct-85.
+ * Modified in 1989 at Silicon Graphics, Inc.
+ * catch SIGPIPE to be able to print stats when receiver has died 
+ * for tcp, don't look for sentinel during reads to allow small transfers
+ * increased default buffer size to 8K, nbuf to 2K to transfer 16MB
+ * moved default port to 5001, beyond IPPORT_USERRESERVED
+ * make sinkmode default because it is more popular, 
+ * -s now means don't sink/source 
+ * count number of read/write system calls to see effects of 
+ * blocking from full socket buffers
+ * for tcp, -D option turns off buffered writes (sets TCP_NODELAY sockopt)
+ * buffer alignment options, -A and -O
+ * print stats in a format that's a bit easier to use with grep & awk
+ * for SYSV, mimic BSD routines to use most of the existing timing code
+ * Modified by Steve Miller of the University of Maryland, College Park
+ * -b sets the socket buffer size (SO_SNDBUF/SO_RCVBUF)
+ * Modified Sept. 1989 at Silicon Graphics, Inc.
+ * restored -s sense at request of tcs@brl
+ * Modified Oct. 1991 at Silicon Graphics, Inc.
+ * use getopt(3) for option processing, add -f and -T options.
+ * SGI IRIX 3.3 and 4.0 releases don't need #define SYSV.
+ *
+ * Distribution Status -
+ *  Public Domain.  Distribution Unlimited.
+ */
+#ifndef lint
+static char RCSid[] = "ttcp.c $Revision$";
+#endif
+
+#define BSD43
+/* #define BSD42 */
+/* #define BSD41a */
+/* #define SYSV */ /* required on SGI IRIX releases before 3.3 */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include   /* struct timeval */
+
+#if defined(SYSV)
+#include 
+#include 
+struct rusage {
+struct timeval ru_utime, ru_stime;
+};
+#define RUSAGE_SELF 0
+#else
+#include 
+#endif
+
+struct sockaddr_in sinme;
+struct sockaddr_in sinhim;
+struct sockaddr_in frominet;
+
+int domain, fromlen;
+int fd;/* fd of network socket */
+
+int buflen = 8 * 1024; /* length of buffer */
+char *buf; /* ptr to dynamic buffer */
+int nbuf = 2 * 1024;   /* number of buffers to send in sinkmode */
+
+int bufoffset = 0; /* align buffer to this */
+int bufalign = 16*1024;/* modulo this */
+
+int udp = 0;   /* 0 = tcp, !0 = udp */
+int options = 0;   /* socket options */
+int one = 1;/* for 4.3 BSD style setsockopt() */
+short port = 5001; /* TCP port number */
+char *host;/* ptr to name of host */
+int trans; /* 0=receive, !0=transmit mode */
+int sinkmode = 0;  /* 0=normal I/O, !0=sink/source mode */
+int verbose = 0;   /* 0=print basic info, 1=print cpu rate, proc
+ 

[PATCH rtems-libbsd v2 2/4] rtemsbsd:Updated TTCP code with network demo code

2021-06-11 Thread Stephen Clark
Updated the TTCP code to match the ttcp.c in RTEMS network-demos
repository (https://git.rtems.org/network-demos/).
---
 rtemsbsd/ttcp/ttcp.c | 91 +++-
 1 file changed, 65 insertions(+), 26 deletions(-)

diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
index 305a7c7d..dc62c64b 100644
--- a/rtemsbsd/ttcp/ttcp.c
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -35,8 +35,9 @@
  * Distribution Status -
  *  Public Domain.  Distribution Unlimited.
  */
+
 #ifndef lint
-static char RCSid[] = "ttcp.c $Revision$";
+/* static char RCSid[] = "ttcp.c $Revision$"; */
 #endif
 
 #define BSD43
@@ -44,6 +45,8 @@ static char RCSid[] = "ttcp.c $Revision$";
 /* #define BSD41a */
 /* #define SYSV */ /* required on SGI IRIX releases before 3.3 */
 
+#define ENABLE_NANOSLEEP_DELAY
+
 #include 
 #include 
 #include 
@@ -54,8 +57,12 @@ static char RCSid[] = "ttcp.c $Revision$";
 #include 
 #include 
 #include 
+#include 
 #include   /* struct timeval */
 
+#include 
+#include 
+
 #if defined(SYSV)
 #include 
 #include 
@@ -71,7 +78,13 @@ struct sockaddr_in sinme;
 struct sockaddr_in sinhim;
 struct sockaddr_in frominet;
 
-int domain, fromlen;
+/* these make it easier to avoid warnings */
+struct sockaddr *sinhim_p = (struct sockaddr *) 
+struct sockaddr *sinme_p = (struct sockaddr *) 
+struct sockaddr *frominet_p = (struct sockaddr *) 
+
+int domain;
+socklen_t fromlen;
 int fd;/* fd of network socket */
 
 int buflen = 8 * 1024; /* length of buffer */
@@ -97,6 +110,7 @@ char fmt = 'K';  /* output format: k = 
kilobits, K = kilobytes,
 *  m = megabits, M = megabytes, 
 *  g = gigabits, G = gigabytes */
 int touchdata = 0; /* access data after reading */
+long milliseconds = 0;  /* delay in milliseconds */
 
 struct hostent *addr;
 extern int errno;
@@ -124,6 +138,7 @@ Options specific to -t:\n\
 Options specific to -r:\n\
-B  for -s, only output full blocks as specified by -l (for TAR)\n\
-T  \"touch\": access each byte as it's read\n\
+   -m ##   delay for specified milliseconds between each write\n\
 "; 
 
 char stats[128];
@@ -133,7 +148,7 @@ double cput, realt; /* user, real time (seconds) */
 
 void err();
 void mes();
-int pattern();
+void pattern();
 void prep_timer();
 double read_timer();
 int Nread();
@@ -147,7 +162,18 @@ sigpipe()
 {
 }
 
-main(argc,argv)
+void millisleep(long msec)
+{
+#if defined(ENABLE_NANOSLEEP_DELAY)
+  struct timespec req;
+
+  req.tv_sec = msec / 1000;
+  req.tv_nsec = (msec % 1000) * 100;
+
+  nanosleep( , NULL );
+#endif
+}
+int main(argc,argv)
 int argc;
 char **argv;
 {
@@ -156,7 +182,7 @@ char **argv;
 
if (argc < 2) goto usage;
 
-   while ((c = getopt(argc, argv, "drstuvBDTb:f:l:n:p:A:O:")) != -1) {
+   while ((c = getopt(argc, argv, "drstuvBDTb:f:l:m:n:p:A:O:")) != -1) {
switch (c) {
 
case 'B':
@@ -179,6 +205,12 @@ char **argv;
"ttcp: -D option ignored: TCP_NODELAY socket option not supported\n");
 #endif
break;
+   case 'm':
+   milliseconds = atoi(optarg);
+   #if !defined(ENABLE_NANOSLEEP_DELAY)
+   fprintf(stderr, "millisecond delay disabled\n");
+   #endif
+   break;
case 'n':
nbuf = atoi(optarg);
break;
@@ -285,7 +317,7 @@ char **argv;
err("socket");
mes("socket");
 
-   if (bind(fd, , sizeof(sinme)) < 0)
+   if (bind(fd, sinme_p, sizeof(sinme)) < 0)
err("bind");
 
 #if defined(SO_SNDBUF) || defined(SO_RCVBUF)
@@ -305,7 +337,9 @@ char **argv;
 #endif
 
if (!udp)  {
+#if !defined(__rtems__)
signal(SIGPIPE, sigpipe);
+#endif
if (trans) {
/* We are the client if transmitting */
if (options)  {
@@ -326,7 +360,7 @@ char **argv;
mes("nodelay");
}
 #endif
-   if(connect(fd, , sizeof(sinhim) ) < 0)
+   if(connect(fd, sinhim_p, sizeof(sinhim) ) < 0)
err("connect");
mes("connect");
} else {
@@ -348,11 +382,11 @@ char **argv;
}
fromlen = sizeof(frominet);
domain = AF_INET;
-   if((fd=accept(fd, , ) ) < 0)
+   if((fd=accept(fd, frominet_p, ) ) < 0)
err("accept");
{ struct sockaddr_in peer;
- int peerlen = sizeof(peer);
- if (getpeername(fd, (struct sockaddr_in *) , 
+ socklen_t peerlen = sizeof(peer);
+ if (getpeername(fd, (struct sockaddr *) , 
) < 0) {
 

[PATCH v1 4/4] rtemsbsd: Added a test for the TTCP command.

2021-06-08 Thread Stephen Clark
Added a new test for the TTCP command. Modified default-network-init.h
to conditionally build the shell with TTCP. Modified libbsd.py to build
the new TTCP test.
---
 libbsd.py |  1 +
 .../rtems/bsd/test/default-network-init.h |  7 +++
 testsuite/ttcpshell01/test_main.c | 55 +++
 3 files changed, 63 insertions(+)
 create mode 100644 testsuite/ttcpshell01/test_main.c

diff --git a/libbsd.py b/libbsd.py
index 2badfdee..cb310770 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -5189,6 +5189,7 @@ class tests(builder.Module):
 
 def generate(self):
 mm = self.manager
+self.addTest(mm.generator['test']('ttcpshell01', ['test_main'], 
netTest = True, runTest = False))
 self.addTest(mm.generator['test']('epoch01', ['test_main'], extraLibs 
= ['rtemstest']))
 self.addTest(mm.generator['test']('nfs01', ['test_main'],
   netTest = True, modules = ['nfsv2']))
diff --git a/testsuite/include/rtems/bsd/test/default-network-init.h 
b/testsuite/include/rtems/bsd/test/default-network-init.h
index b367d956..20c0b2e7 100644
--- a/testsuite/include/rtems/bsd/test/default-network-init.h
+++ b/testsuite/include/rtems/bsd/test/default-network-init.h
@@ -318,9 +318,16 @@ Init(rtems_task_argument arg)
   #define SHELL_WPA_SUPPLICANT_COMMAND
 #endif
 
+#ifdef SHELL_TTCP_COMMAND_ENABLE
+  #define SHELL_TTCP_COMMAND _shell_TTCP_Command,
+#else
+  #define SHELL_TTCP_COMMAND 
+#endif
+
 #define CONFIGURE_SHELL_USER_COMMANDS \
   SHELL_WLANSTATS_COMMAND \
   SHELL_WPA_SUPPLICANT_COMMAND \
+  SHELL_TTCP_COMMAND \
   _interrupt_shell_command, \
   _shell_ARP_Command, \
   _shell_HOSTNAME_Command, \
diff --git a/testsuite/ttcpshell01/test_main.c 
b/testsuite/ttcpshell01/test_main.c
new file mode 100644
index ..c7631d14
--- /dev/null
+++ b/testsuite/ttcpshell01/test_main.c
@@ -0,0 +1,55 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief RTEMS shell is started with DHCP client. It is possible to run TTCP.
+ */
+
+/*
+ * COPYRIGHT (c) 2021. On-Line Applications Research Corporation (OAR).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+
+#include 
+#include 
+#include 
+
+#define TEST_NAME "LIBBSD TTCP 1"
+#define TEST_STATE_USER_INPUT 1
+
+static void
+test_main(void)
+{
+   rtems_task_delete(RTEMS_SELF);
+   assert(0);
+}
+
+#define SHELL_TTCP_COMMAND_ENABLE
+#define DEFAULT_NETWORK_DHCPCD_ENABLE
+#define DEFAULT_NETWORK_SHELL
+
+#include 
-- 
2.27.0

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


[PATCH v1 3/4] rtemsbsd: Made TTCP command build for RTEMS

2021-06-08 Thread Stephen Clark
Updated ttcp.c to build for RTEMS 6. Defined a shell command
for TTCP in rtems-bsd-shell-ttcp.c. Added TTCP to the list of
RTEMS network commands in netcmds-config.h. Added declaration
of the TTCP shell command to rtems-bsd-commands.h Modified
libbsd.py to make waf build TTCP and its shell command.
---
 libbsd.py |   2 +
 rtemsbsd/include/machine/rtems-bsd-commands.h |   2 +
 rtemsbsd/include/rtems/netcmds-config.h   |   2 +
 rtemsbsd/rtems/rtems-bsd-shell-ttcp.c |  39 +++
 rtemsbsd/ttcp/ttcp.c  | 266 ++
 5 files changed, 259 insertions(+), 52 deletions(-)
 create mode 100644 rtemsbsd/rtems/rtems-bsd-shell-ttcp.c

diff --git a/libbsd.py b/libbsd.py
index b367d94e..2badfdee 100644
--- a/libbsd.py
+++ b/libbsd.py
@@ -269,6 +269,7 @@ class rtems(builder.Module):
 'rtems/rtems-bsd-shell-tcpdump.c',
 'rtems/rtems-bsd-shell-vmstat.c',
 'rtems/rtems-bsd-shell-wlanstats.c',
+'rtems/rtems-bsd-shell-ttcp.c',
 'rtems/rtems-kvm.c',
 'rtems/rtems-program.c',
 'rtems/rtems-program-socket.c',
@@ -292,6 +293,7 @@ class rtems(builder.Module):
 'pppd/upap.c',
 'pppd/utils.c',
 'telnetd/telnetd-service.c',
+'ttcp/ttcp.c',
 ],
 mm.generator['source']()
 )
diff --git a/rtemsbsd/include/machine/rtems-bsd-commands.h 
b/rtemsbsd/include/machine/rtems-bsd-commands.h
index d314471f..d82c274c 100644
--- a/rtemsbsd/include/machine/rtems-bsd-commands.h
+++ b/rtemsbsd/include/machine/rtems-bsd-commands.h
@@ -84,6 +84,8 @@ int rtems_bsd_command_setkey(int argc, char **argv);
 
 int rtems_bsd_command_openssl(int argc, char **argv);
 
+int rtems_shell_main_ttcp(int argc, char **argv);
+
 __END_DECLS
 
 #endif /* _RTEMS_BSD_MACHINE_RTEMS_BSD_COMMANDS_H_ */
diff --git a/rtemsbsd/include/rtems/netcmds-config.h 
b/rtemsbsd/include/rtems/netcmds-config.h
index bc493af4..c1d56eb3 100644
--- a/rtemsbsd/include/rtems/netcmds-config.h
+++ b/rtemsbsd/include/rtems/netcmds-config.h
@@ -29,6 +29,8 @@ extern rtems_shell_cmd_t rtems_shell_PFCTL_Command;
 extern rtems_shell_cmd_t rtems_shell_PING_Command;
 extern rtems_shell_cmd_t rtems_shell_PING6_Command;
 
+extern rtems_shell_cmd_t rtems_shell_TTCP_Command;
+
 extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
 
 extern rtems_shell_cmd_t rtems_shell_IFMCSTAT_Command;
diff --git a/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c 
b/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c
new file mode 100644
index ..babaa011
--- /dev/null
+++ b/rtemsbsd/rtems/rtems-bsd-shell-ttcp.c
@@ -0,0 +1,39 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/*
+ * COPYRIGHT (c) 2021. On-Line Applications Research Corporation (OAR).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include 
+#include 
+
+rtems_shell_cmd_t rtems_shell_TTCP_Command = {
+  "ttcp",   /* name */
+  "ttcp -h # to get help",  /* usage */
+  "net",/* topic */
+  rtems_shell_main_ttcp,/* command */
+  NULL, /* alias */
+  NULL  /* next */
+};
diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
index dc62c64b..46e0f3fc 100644
--- a/rtemsbsd/ttcp/ttcp.c
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -74,48 +74,95 @@ struct rusage {
 #include 
 #endif
 
-struct sockaddr_in sinme;
-struct sockaddr_in sinhim;
-struct sockaddr_in frominet;
+#if defined(__rtems__)
+#define __need_getopt_newlib

[PATCH v1 2/4] rtemsbsd:Updated TTCP code with network demo code

2021-06-08 Thread Stephen Clark
Updated the TTCP code to match the ttcp.c in RTEMS network-demos
repository (https://git.rtems.org/network-demos/).
---
 rtemsbsd/ttcp/ttcp.c | 91 +++-
 1 file changed, 65 insertions(+), 26 deletions(-)

diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
index 305a7c7d..dc62c64b 100644
--- a/rtemsbsd/ttcp/ttcp.c
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -35,8 +35,9 @@
  * Distribution Status -
  *  Public Domain.  Distribution Unlimited.
  */
+
 #ifndef lint
-static char RCSid[] = "ttcp.c $Revision$";
+/* static char RCSid[] = "ttcp.c $Revision$"; */
 #endif
 
 #define BSD43
@@ -44,6 +45,8 @@ static char RCSid[] = "ttcp.c $Revision$";
 /* #define BSD41a */
 /* #define SYSV */ /* required on SGI IRIX releases before 3.3 */
 
+#define ENABLE_NANOSLEEP_DELAY
+
 #include 
 #include 
 #include 
@@ -54,8 +57,12 @@ static char RCSid[] = "ttcp.c $Revision$";
 #include 
 #include 
 #include 
+#include 
 #include   /* struct timeval */
 
+#include 
+#include 
+
 #if defined(SYSV)
 #include 
 #include 
@@ -71,7 +78,13 @@ struct sockaddr_in sinme;
 struct sockaddr_in sinhim;
 struct sockaddr_in frominet;
 
-int domain, fromlen;
+/* these make it easier to avoid warnings */
+struct sockaddr *sinhim_p = (struct sockaddr *) 
+struct sockaddr *sinme_p = (struct sockaddr *) 
+struct sockaddr *frominet_p = (struct sockaddr *) 
+
+int domain;
+socklen_t fromlen;
 int fd;/* fd of network socket */
 
 int buflen = 8 * 1024; /* length of buffer */
@@ -97,6 +110,7 @@ char fmt = 'K';  /* output format: k = 
kilobits, K = kilobytes,
 *  m = megabits, M = megabytes, 
 *  g = gigabits, G = gigabytes */
 int touchdata = 0; /* access data after reading */
+long milliseconds = 0;  /* delay in milliseconds */
 
 struct hostent *addr;
 extern int errno;
@@ -124,6 +138,7 @@ Options specific to -t:\n\
 Options specific to -r:\n\
-B  for -s, only output full blocks as specified by -l (for TAR)\n\
-T  \"touch\": access each byte as it's read\n\
+   -m ##   delay for specified milliseconds between each write\n\
 "; 
 
 char stats[128];
@@ -133,7 +148,7 @@ double cput, realt; /* user, real time (seconds) */
 
 void err();
 void mes();
-int pattern();
+void pattern();
 void prep_timer();
 double read_timer();
 int Nread();
@@ -147,7 +162,18 @@ sigpipe()
 {
 }
 
-main(argc,argv)
+void millisleep(long msec)
+{
+#if defined(ENABLE_NANOSLEEP_DELAY)
+  struct timespec req;
+
+  req.tv_sec = msec / 1000;
+  req.tv_nsec = (msec % 1000) * 100;
+
+  nanosleep( , NULL );
+#endif
+}
+int main(argc,argv)
 int argc;
 char **argv;
 {
@@ -156,7 +182,7 @@ char **argv;
 
if (argc < 2) goto usage;
 
-   while ((c = getopt(argc, argv, "drstuvBDTb:f:l:n:p:A:O:")) != -1) {
+   while ((c = getopt(argc, argv, "drstuvBDTb:f:l:m:n:p:A:O:")) != -1) {
switch (c) {
 
case 'B':
@@ -179,6 +205,12 @@ char **argv;
"ttcp: -D option ignored: TCP_NODELAY socket option not supported\n");
 #endif
break;
+   case 'm':
+   milliseconds = atoi(optarg);
+   #if !defined(ENABLE_NANOSLEEP_DELAY)
+   fprintf(stderr, "millisecond delay disabled\n");
+   #endif
+   break;
case 'n':
nbuf = atoi(optarg);
break;
@@ -285,7 +317,7 @@ char **argv;
err("socket");
mes("socket");
 
-   if (bind(fd, , sizeof(sinme)) < 0)
+   if (bind(fd, sinme_p, sizeof(sinme)) < 0)
err("bind");
 
 #if defined(SO_SNDBUF) || defined(SO_RCVBUF)
@@ -305,7 +337,9 @@ char **argv;
 #endif
 
if (!udp)  {
+#if !defined(__rtems__)
signal(SIGPIPE, sigpipe);
+#endif
if (trans) {
/* We are the client if transmitting */
if (options)  {
@@ -326,7 +360,7 @@ char **argv;
mes("nodelay");
}
 #endif
-   if(connect(fd, , sizeof(sinhim) ) < 0)
+   if(connect(fd, sinhim_p, sizeof(sinhim) ) < 0)
err("connect");
mes("connect");
} else {
@@ -348,11 +382,11 @@ char **argv;
}
fromlen = sizeof(frominet);
domain = AF_INET;
-   if((fd=accept(fd, , ) ) < 0)
+   if((fd=accept(fd, frominet_p, ) ) < 0)
err("accept");
{ struct sockaddr_in peer;
- int peerlen = sizeof(peer);
- if (getpeername(fd, (struct sockaddr_in *) , 
+ socklen_t peerlen = sizeof(peer);
+ if (getpeername(fd, (struct sockaddr *) , 
) < 0) {
 

[PATCH v1 1/4] rtemsbsd: Added original TTCP code

2021-06-08 Thread Stephen Clark
Added the original Test TCP (TTCP) program in unmodified form.
Also added the associated README.
---
 rtemsbsd/ttcp/README |  27 ++
 rtemsbsd/ttcp/ttcp.c | 841 +++
 2 files changed, 868 insertions(+)
 create mode 100644 rtemsbsd/ttcp/README
 create mode 100644 rtemsbsd/ttcp/ttcp.c

diff --git a/rtemsbsd/ttcp/README b/rtemsbsd/ttcp/README
new file mode 100644
index ..215ddacc
--- /dev/null
+++ b/rtemsbsd/ttcp/README
@@ -0,0 +1,27 @@
+TTCP is a benchmarking tool for determining TCP and UDP performance
+between 2 systems.
+
+The program was created at the US Army Ballistics Research Lab (BRL)
+and is in the public domain. Feel free to distribute this program
+but please do leave the credit notices in the source and man page intact.
+
+Contents of this directory:
+
+ttcp.c  Source that runs on IRIX 3.3.x and 4.0.x systems
+and BSD-based systems.  This version also uses getopt(3)
+and has 2 new options: -f and -T.
+
+ttcp.c-brl  Original source from BRL.
+
+ttcp.1  Manual page (describes ttcp.c options, which are a
+superset of the other version).
+
+
+How to get TCP performance numbers:
+
+receiversender
+
+host1%  ttcp -r -s  host2% ttcp -t -s host1
+
+-n and -l options change the number and size of the buffers.
+
diff --git a/rtemsbsd/ttcp/ttcp.c b/rtemsbsd/ttcp/ttcp.c
new file mode 100644
index ..305a7c7d
--- /dev/null
+++ b/rtemsbsd/ttcp/ttcp.c
@@ -0,0 +1,841 @@
+/*
+ * T T C P . C
+ *
+ * Test TCP connection.  Makes a connection on port 5001
+ * and transfers fabricated buffers or data copied from stdin.
+ *
+ * Usable on 4.2, 4.3, and 4.1a systems by defining one of
+ * BSD42 BSD43 (BSD41a)
+ * Machines using System V with BSD sockets should define SYSV.
+ *
+ * Modified for operation under 4.2BSD, 18 Dec 84
+ *  T.C. Slattery, USNA
+ * Minor improvements, Mike Muuss and Terry Slattery, 16-Oct-85.
+ * Modified in 1989 at Silicon Graphics, Inc.
+ * catch SIGPIPE to be able to print stats when receiver has died 
+ * for tcp, don't look for sentinel during reads to allow small transfers
+ * increased default buffer size to 8K, nbuf to 2K to transfer 16MB
+ * moved default port to 5001, beyond IPPORT_USERRESERVED
+ * make sinkmode default because it is more popular, 
+ * -s now means don't sink/source 
+ * count number of read/write system calls to see effects of 
+ * blocking from full socket buffers
+ * for tcp, -D option turns off buffered writes (sets TCP_NODELAY sockopt)
+ * buffer alignment options, -A and -O
+ * print stats in a format that's a bit easier to use with grep & awk
+ * for SYSV, mimic BSD routines to use most of the existing timing code
+ * Modified by Steve Miller of the University of Maryland, College Park
+ * -b sets the socket buffer size (SO_SNDBUF/SO_RCVBUF)
+ * Modified Sept. 1989 at Silicon Graphics, Inc.
+ * restored -s sense at request of tcs@brl
+ * Modified Oct. 1991 at Silicon Graphics, Inc.
+ * use getopt(3) for option processing, add -f and -T options.
+ * SGI IRIX 3.3 and 4.0 releases don't need #define SYSV.
+ *
+ * Distribution Status -
+ *  Public Domain.  Distribution Unlimited.
+ */
+#ifndef lint
+static char RCSid[] = "ttcp.c $Revision$";
+#endif
+
+#define BSD43
+/* #define BSD42 */
+/* #define BSD41a */
+/* #define SYSV */ /* required on SGI IRIX releases before 3.3 */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include   /* struct timeval */
+
+#if defined(SYSV)
+#include 
+#include 
+struct rusage {
+struct timeval ru_utime, ru_stime;
+};
+#define RUSAGE_SELF 0
+#else
+#include 
+#endif
+
+struct sockaddr_in sinme;
+struct sockaddr_in sinhim;
+struct sockaddr_in frominet;
+
+int domain, fromlen;
+int fd;/* fd of network socket */
+
+int buflen = 8 * 1024; /* length of buffer */
+char *buf; /* ptr to dynamic buffer */
+int nbuf = 2 * 1024;   /* number of buffers to send in sinkmode */
+
+int bufoffset = 0; /* align buffer to this */
+int bufalign = 16*1024;/* modulo this */
+
+int udp = 0;   /* 0 = tcp, !0 = udp */
+int options = 0;   /* socket options */
+int one = 1;/* for 4.3 BSD style setsockopt() */
+short port = 5001; /* TCP port number */
+char *host;/* ptr to name of host */
+int trans; /* 0=receive, !0=transmit mode */
+int sinkmode = 0;  /* 0=normal I/O, !0=sink/source mode */
+int verbose = 0;   /* 0=print basic info, 1=print cpu rate, proc
+* resource usage. */
+int nodelay = 0;   /* set TCP_NODELAY socket option */
+int b_flag = 0;  

[PATCH v8] rtems-debugger: Fixed 32bit pointers

2021-05-14 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with
uintptr_t, which will work for both 32 and 64 bit architectures. Added
hex_decode_addr function to rtems-debugger.
---
 cpukit/libdebugger/rtems-debugger-server.c | 32 ++
 cpukit/libdebugger/rtems-debugger-target.c |  2 +-
 cpukit/libdebugger/rtems-debugger-target.h |  2 +-
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..9de9421b6b 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -154,6 +154,26 @@ hex_encode(int val)
   return "0123456789abcdef"[val & 0xf];
 }
 
+static inline uintptr_t
+hex_decode_addr(const uint8_t* data)
+{
+  uintptr_t ui = 0;
+  size_t  i;
+  if (data[0] == '-') {
+if (data[1] == '1')
+  ui = (uintptr_t) -1;
+  }
+  else {
+for (i = 0; i < (sizeof(ui) * 2); ++i) {
+  int v = hex_decode(data[i]);
+  if (v < 0)
+break;
+  ui = (ui << 4) | v;
+}
+  }
+  return ui;
+}
+
 static inline DB_UINT
 hex_decode_uint(const uint8_t* data)
 {
@@ -1438,10 +1458,10 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_addr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 remote_packet_out_reset();
 r = rtems_debugger_target_start_memory_access();
@@ -1468,10 +1488,10 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_addr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 r = rtems_debugger_target_start_memory_access();
 if (r == 0) {
@@ -1519,9 +1539,9 @@ remote_breakpoints(bool insert, uint8_t* buffer, int size)
 comma2 = strchr(comma1 + 1, ',');
 if (comma2 != NULL) {
   uint32_t capabilities;
-  DB_UINT  addr;
+  uintptr_t  addr;
   DB_UINT  kind;
-  addr = hex_decode_uint((const uint8_t*) comma1 + 1);
+  addr = hex_decode_addr((const uint8_t*) comma1 + 1);
   kind = hex_decode_uint((const uint8_t*)comma2 + 1);
   capabilities = rtems_debugger_target_capabilities();
   switch (buffer[1]) {
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0

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


[PATCH v7] rtems-debugger: Fixed 32bit pointers

2021-05-13 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with
uintptr_t, which will work for both 32 and 64 bit architectures. Added
hex_decode_uintptr function to rtems-debugger.
---
 cpukit/libdebugger/rtems-debugger-server.c | 32 ++
 cpukit/libdebugger/rtems-debugger-target.c |  2 +-
 cpukit/libdebugger/rtems-debugger-target.h |  2 +-
 3 files changed, 28 insertions(+), 8 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..c82ced2aa9 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -154,6 +154,26 @@ hex_encode(int val)
   return "0123456789abcdef"[val & 0xf];
 }
 
+static inline uintptr_t
+hex_decode_uintptr(const uint8_t* data)
+{
+  uintptr_t ui = 0;
+  size_t  i;
+  if (data[0] == '-') {
+if (data[1] == '1')
+  ui = (uintptr_t) -1;
+  }
+  else {
+for (i = 0; i < (sizeof(ui) * 2); ++i) {
+  int v = hex_decode(data[i]);
+  if (v < 0)
+break;
+  ui = (ui << 4) | v;
+}
+  }
+  return ui;
+}
+
 static inline DB_UINT
 hex_decode_uint(const uint8_t* data)
 {
@@ -1438,10 +1458,10 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_uintptr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 remote_packet_out_reset();
 r = rtems_debugger_target_start_memory_access();
@@ -1468,10 +1488,10 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_uintptr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 r = rtems_debugger_target_start_memory_access();
 if (r == 0) {
@@ -1519,9 +1539,9 @@ remote_breakpoints(bool insert, uint8_t* buffer, int size)
 comma2 = strchr(comma1 + 1, ',');
 if (comma2 != NULL) {
   uint32_t capabilities;
-  DB_UINT  addr;
+  uintptr_t  addr;
   DB_UINT  kind;
-  addr = hex_decode_uint((const uint8_t*) comma1 + 1);
+  addr = hex_decode_uintptr((const uint8_t*) comma1 + 1);
   kind = hex_decode_uint((const uint8_t*)comma2 + 1);
   capabilities = rtems_debugger_target_capabilities();
   switch (buffer[1]) {
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0

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


[PATCH v6] rtems-debugger: Fixed 32bit pointers

2021-05-12 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures. Added hex_decode_uintptr
function to rtems-debugger.
---
 cpukit/include/rtems/shellconfig.h |  8 ++
 cpukit/libdebugger/rtems-debugger-server.c | 32 ++
 cpukit/libdebugger/rtems-debugger-target.c |  2 +-
 cpukit/libdebugger/rtems-debugger-target.h |  2 +-
 4 files changed, 36 insertions(+), 8 deletions(-)

diff --git a/cpukit/include/rtems/shellconfig.h 
b/cpukit/include/rtems/shellconfig.h
index c5fcf4a45e..07860fbbc3 100644
--- a/cpukit/include/rtems/shellconfig.h
+++ b/cpukit/include/rtems/shellconfig.h
@@ -98,6 +98,7 @@ extern rtems_shell_cmd_t rtems_shell_RTRACE_Command;
   extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
   extern rtems_shell_cmd_t rtems_shell_NETSTATS_Command;
   extern rtems_shell_cmd_t rtems_shell_PING_Command;
+  extern rtems_shell_cmd_t rtems_shell_TTCP_Command;
 #endif
 
 /*
@@ -516,6 +517,13 @@ extern rtems_shell_alias_t * const 
rtems_shell_Initial_aliases[];
   defined(CONFIGURE_SHELL_COMMAND_PING)
 _shell_PING_Command,
   #endif
+
+  #if (defined(CONFIGURE_SHELL_COMMANDS_ALL_NETWORKING) && \
+   !defined(CONFIGURE_SHELL_NO_COMMAND_TTCP)) || \
+  defined(CONFIGURE_SHELL_COMMAND_TTCP)
+_shell_TTCP_Command,
+  #endif
+
 #endif
 
 /* Miscanellous shell commands */
diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..c82ced2aa9 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -154,6 +154,26 @@ hex_encode(int val)
   return "0123456789abcdef"[val & 0xf];
 }
 
+static inline uintptr_t
+hex_decode_uintptr(const uint8_t* data)
+{
+  uintptr_t ui = 0;
+  size_t  i;
+  if (data[0] == '-') {
+if (data[1] == '1')
+  ui = (uintptr_t) -1;
+  }
+  else {
+for (i = 0; i < (sizeof(ui) * 2); ++i) {
+  int v = hex_decode(data[i]);
+  if (v < 0)
+break;
+  ui = (ui << 4) | v;
+}
+  }
+  return ui;
+}
+
 static inline DB_UINT
 hex_decode_uint(const uint8_t* data)
 {
@@ -1438,10 +1458,10 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_uintptr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 remote_packet_out_reset();
 r = rtems_debugger_target_start_memory_access();
@@ -1468,10 +1488,10 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_uintptr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 r = rtems_debugger_target_start_memory_access();
 if (r == 0) {
@@ -1519,9 +1539,9 @@ remote_breakpoints(bool insert, uint8_t* buffer, int size)
 comma2 = strchr(comma1 + 1, ',');
 if (comma2 != NULL) {
   uint32_t capabilities;
-  DB_UINT  addr;
+  uintptr_t  addr;
   DB_UINT  kind;
-  addr = hex_decode_uint((const uint8_t*) comma1 + 1);
+  addr = hex_decode_uintptr((const uint8_t*) comma1 + 1);
   kind = hex_decode_uint((const uint8_t*)comma2 + 1);
   capabilities = rtems_debugger_target_capabilities();
   switch (buffer[1]) {
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0


[PATCH v5] rtems-debugger: Fixed 32bit pointers

2021-05-07 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures. Added hex_decode_addr
function to rtems-debugger. Changed rtems_debugger_target_swbreak_control()
parameter to DB_ADDR.
---
 .../rtems/debugger/rtems-debugger-server.h|  5 
 cpukit/libdebugger/rtems-debugger-server.c| 30 +++
 cpukit/libdebugger/rtems-debugger-target.c|  2 +-
 cpukit/libdebugger/rtems-debugger-target.h|  2 +-
 4 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/cpukit/include/rtems/debugger/rtems-debugger-server.h 
b/cpukit/include/rtems/debugger/rtems-debugger-server.h
index 2189aac873..beff302641 100644
--- a/cpukit/include/rtems/debugger/rtems-debugger-server.h
+++ b/cpukit/include/rtems/debugger/rtems-debugger-server.h
@@ -50,6 +50,11 @@ extern "C" {
  */
 #define DB_UINT uint32_t
 
+/**
+ * Data type for addresses. Here for 64bit support.
+ */
+#define DB_ADDR uintptr_t
+
 /*
  * Debugger signals.
  */
diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..2ada418a79 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -154,6 +154,26 @@ hex_encode(int val)
   return "0123456789abcdef"[val & 0xf];
 }
 
+static inline DB_ADDR
+hex_decode_addr(const uint8_t* data)
+{
+  DB_ADDR ui = 0;
+  size_t  i;
+  if (data[0] == '-') {
+if (data[1] == '1')
+  ui = (DB_ADDR) -1;
+  }
+  else {
+for (i = 0; i < (sizeof(ui) * 2); ++i) {
+  int v = hex_decode(data[i]);
+  if (v < 0)
+break;
+  ui = (ui << 4) | v;
+}
+  }
+  return ui;
+}
+
 static inline DB_UINT
 hex_decode_uint(const uint8_t* data)
 {
@@ -1438,10 +1458,10 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_addr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 remote_packet_out_reset();
 r = rtems_debugger_target_start_memory_access();
@@ -1468,10 +1488,10 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_addr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 r = rtems_debugger_target_start_memory_access();
 if (r == 0) {
@@ -1521,7 +1541,7 @@ remote_breakpoints(bool insert, uint8_t* buffer, int size)
   uint32_t capabilities;
   DB_UINT  addr;
   DB_UINT  kind;
-  addr = hex_decode_uint((const uint8_t*) comma1 + 1);
+  addr = hex_decode_addr((const uint8_t*) comma1 + 1);
   kind = hex_decode_uint((const uint8_t*)comma2 + 1);
   capabilities = rtems_debugger_target_capabilities();
   switch (buffer[1]) {
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..99da21921b 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, DB_ADDR addr, DB_UINT kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0

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


[no subject]

2021-05-04 Thread Stephen Clark


This patch has been tested on a beaglebone black.

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


[PATCH v4] rtems-debugger: Fixed 32bit pointers

2021-05-04 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures. Added hex_decode_addr
function to rtems-debugger.
---
 .../rtems/debugger/rtems-debugger-server.h|  5 
 cpukit/libdebugger/rtems-debugger-server.c| 30 +++
 cpukit/libdebugger/rtems-debugger-target.c|  2 +-
 cpukit/libdebugger/rtems-debugger-target.h|  2 +-
 4 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/cpukit/include/rtems/debugger/rtems-debugger-server.h 
b/cpukit/include/rtems/debugger/rtems-debugger-server.h
index 2189aac873..beff302641 100644
--- a/cpukit/include/rtems/debugger/rtems-debugger-server.h
+++ b/cpukit/include/rtems/debugger/rtems-debugger-server.h
@@ -50,6 +50,11 @@ extern "C" {
  */
 #define DB_UINT uint32_t
 
+/**
+ * Data type for addresses. Here for 64bit support.
+ */
+#define DB_ADDR uintptr_t
+
 /*
  * Debugger signals.
  */
diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..2ada418a79 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -154,6 +154,26 @@ hex_encode(int val)
   return "0123456789abcdef"[val & 0xf];
 }
 
+static inline DB_ADDR
+hex_decode_addr(const uint8_t* data)
+{
+  DB_ADDR ui = 0;
+  size_t  i;
+  if (data[0] == '-') {
+if (data[1] == '1')
+  ui = (DB_ADDR) -1;
+  }
+  else {
+for (i = 0; i < (sizeof(ui) * 2); ++i) {
+  int v = hex_decode(data[i]);
+  if (v < 0)
+break;
+  ui = (ui << 4) | v;
+}
+  }
+  return ui;
+}
+
 static inline DB_UINT
 hex_decode_uint(const uint8_t* data)
 {
@@ -1438,10 +1458,10 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_addr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 remote_packet_out_reset();
 r = rtems_debugger_target_start_memory_access();
@@ -1468,10 +1488,10 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
-addr = hex_decode_uint([1]);
+addr = hex_decode_addr([1]);
 length = hex_decode_uint((const uint8_t*) comma + 1);
 r = rtems_debugger_target_start_memory_access();
 if (r == 0) {
@@ -1521,7 +1541,7 @@ remote_breakpoints(bool insert, uint8_t* buffer, int size)
   uint32_t capabilities;
   DB_UINT  addr;
   DB_UINT  kind;
-  addr = hex_decode_uint((const uint8_t*) comma1 + 1);
+  addr = hex_decode_addr((const uint8_t*) comma1 + 1);
   kind = hex_decode_uint((const uint8_t*)comma2 + 1);
   capabilities = rtems_debugger_target_capabilities();
   switch (buffer[1]) {
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0

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


RE: [PATCH v3] psxtests: Fix math function build warnings

2021-03-19 Thread Stephen Clark
I must have misunderstood your email about using the file header block from 
https://docs.rtems.org/branches/master/eng/coding-file-hdr.html. Which header 
were you recommending that I add?

-Original Message-
From: Gedare Bloom  
Sent: Friday, March 19, 2021 12:02 PM
To: Stephen Clark 
Cc: devel@rtems.org
Subject: Re: [PATCH v3] psxtests: Fix math function build warnings

> diff --git a/testsuites/psxtests/psxhdrs/math/has_long_double.h 
> b/testsuites/psxtests/psxhdrs/math/has_long_double.h
> new file mode 100644
> index 00..4372142288
> --- /dev/null
> +++ b/testsuites/psxtests/psxhdrs/math/has_long_double.h
> @@ -0,0 +1,53 @@
> +/* SPDX-License-Identifier: BSD-2-Clause */
> +
> +/**
> + * @file
> + *
> + * @brief Defines NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
> + *
> + * This file uses logic copied from newlib's math.h on 21 Jan 2021
> + * to determine whether or not the long double math functions tests
> + * should be built. The original math.h file was sourced from
> + * 
> +https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar
> +.gz/a0d7982
> + */
> +
> +/*
> + * Copyright (C) 2021, 2021 Stephen Clark
> + *

I don't think that the copied portion has been modified substantially that (a) 
allows to apply a different license than was used in the upstream, and (b) 
allows to add a copyright here.

> + * 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 HAS_LONG_DOUBLE_H
> +#define HAS_LONG_DOUBLE_H
> +
> +/* Newlib doesn't fully support long double math functions so far.
> +   On platforms where long double equals double the long double functions
> +   simply call the double functions.  On Cygwin the long double functions
> +   are implemented independently from newlib to be able to use optimized
> +   assembler functions despite using the Microsoft x86_64 ABI. */ #if 
> +defined (_LDBL_EQ_DBL) || defined (__CYGWIN__) #ifndef __math_68881 
> +#define NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS 1 #endif #endif
> +
> +#endif
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


[PATCH v3] psxtests: Fix math function build warnings

2021-03-19 Thread Stephen Clark
/math/frexpl.c 
b/testsuites/psxtests/psxhdrs/math/frexpl.c
index 3ad3e25a5d..ad827d7b07 100644
--- a/testsuites/psxtests/psxhdrs/math/frexpl.c
+++ b/testsuites/psxtests/psxhdrs/math/frexpl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/has_long_double.h 
b/testsuites/psxtests/psxhdrs/math/has_long_double.h
new file mode 100644
index 00..4372142288
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/math/has_long_double.h
@@ -0,0 +1,53 @@
+/* SPDX-License-Identifier: BSD-2-Clause */
+
+/**
+ * @file
+ *
+ * @brief Defines NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
+ *
+ * This file uses logic copied from newlib's math.h on 21 Jan 2021 
+ * to determine whether or not the long double math functions tests
+ * should be built. The original math.h file was sourced from 
+ * 
https://codeload.github.com/RTEMS/sourceware-mirror-newlib-cygwin/tar.gz/a0d7982
+ */
+
+/*
+ * Copyright (C) 2021, 2021 Stephen Clark
+ *
+ * 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 HAS_LONG_DOUBLE_H
+#define HAS_LONG_DOUBLE_H
+
+/* Newlib doesn't fully support long double math functions so far.
+   On platforms where long double equals double the long double functions
+   simply call the double functions.  On Cygwin the long double functions
+   are implemented independently from newlib to be able to use optimized
+   assembler functions despite using the Microsoft x86_64 ABI. */
+#if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)
+#ifndef __math_68881
+#define NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS 1
+#endif
+#endif
+
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/hypotl.c 
b/testsuites/psxtests/psxhdrs/math/hypotl.c
index bffc632c09..182e4028d8 100644
--- a/testsuites/psxtests/psxhdrs/math/hypotl.c
+++ b/testsuites/psxtests/psxhdrs/math/hypotl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/ilogbl.c 
b/testsuites/psxtests/psxhdrs/math/ilogbl.c
index 8daa32df84..9c8486c79d 100644
--- a/testsuites/psxtests/psxhdrs/math/ilogbl.c
+++ b/testsuites/psxtests/psxhdrs/math/ilogbl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/ldexpl.c 
b/testsuites/psxtests/psxhdrs/math/ldexpl.c
index de1a2dcb8a..369f95116f 100644
--- a/testsuites/psxtests/psxhdrs/math/ldexpl.c
+++ b/testsuites/psxtests/psxhdrs/math/ldexpl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/lgammal.c 
b/testsuites/psxtests/psxhdrs/math/lgammal.c
index 156b39092b..c126812427 100644
--- a/testsuites/psxtests/psxhdrs/math/lgammal.c
+++ b/testsuites/psxtests/psxhdrs/math/lgammal.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -46,3 +48,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/llrintl.c 
b/tes

[PATCH v3 3/3] stackchk: Fixed 32bit pointers

2021-03-19 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libmisc/stackchk/check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index ab08155c92..a2b63345d9 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -447,12 +447,13 @@ static bool Stack_check_Dump_threads_usage(
 {
   char name[ 22 ];
   const rtems_printer *printer;
+  uintptr_t sp = _CPU_Context_Get_SP( _thread->Registers );
 
   printer = arg;
   _Thread_Get_name( the_thread, name, sizeof( name ) );
   Stack_check_Dump_stack_usage(
 _thread->Start.Initial_stack,
-(void *) _CPU_Context_Get_SP( _thread->Registers ),
+(void *) sp,
 name,
 the_thread->Object.id,
 printer
-- 
2.27.0

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


[PATCH v3 2/3] rtems-fdt: Fixed 32bit pointers

2021-03-19 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c 
b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
index b0894c1d38..61f20765e0 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
@@ -52,14 +52,14 @@ static long rtems_fdt_test_timeout = 5;
 static rtems_fdt_handle cmd_fdt_handle;
 
 static void
-rtems_fdt_write (uint32_t address, uint32_t value)
+rtems_fdt_write (uintptr_t address, uint32_t value)
 {
   volatile uint32_t* ap = (uint32_t*) address;
   *ap = value;
 }
 
 static uint32_t
-rtems_fdt_read (uint32_t address)
+rtems_fdt_read (uintptr_t address)
 {
   volatile uint32_t* ap = (uint32_t*) address;
   return *ap;
-- 
2.27.0

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


[PATCH v3 1/3] rtems-debugger: Fixed 32bit pointers

2021-03-19 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libdebugger/rtems-debugger-server.c | 4 ++--
 cpukit/libdebugger/rtems-debugger-target.c | 2 +-
 cpukit/libdebugger/rtems-debugger-target.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..f8c485a794 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -1438,7 +1438,7 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
@@ -1468,7 +1468,7 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0

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


RE: [PATCH v1 2/2] psxtests: Fix math function build warnings

2021-03-19 Thread Stephen Clark
Gedare,
Sorry, I didn't see that you had written comments below the first one 
yesterday. 

The conditional logic for building the long double functions comes from newlib. 
Given that it could change, it made sense to handle it in a single place in 
case it changed. As far as moving the logic into the build system, I talked 
with Joel and he's not sure how this would be accomplished with the build 
system, let alone if it would be desirable.

The license info will be added.


-Original Message-
From: Gedare Bloom  
Sent: Thursday, March 18, 2021 10:56 AM
To: Stephen Clark 
Cc: devel@rtems.org
Subject: Re: [PATCH v1 2/2] psxtests: Fix math function build warnings

Hi Stephen,

On Thu, Mar 18, 2021 at 8:19 AM Stephen Clark  wrote:
>
> Added conditionals to ensure that long double function tests were only 
> built when newlib has long double math functions.

This patch is not related to the other patch in the series. I recommend that 
you generally should send unrelated patches separately from each other, rather 
than in a group like this. That makes the review easier.  For example, I can't 
really give a good review on patch 1/2.

> ---
>  testsuites/psxtests/psxhdrs/math/acoshl.c|  3 +++
>  testsuites/psxtests/psxhdrs/math/acosl.c |  3 +++

[...]

> diff --git a/testsuites/psxtests/psxhdrs/math/has_long_double.h 
> b/testsuites/psxtests/psxhdrs/math/has_long_double.h
> new file mode 100644
> index 00..d813d08a61
> --- /dev/null
> +++ b/testsuites/psxtests/psxhdrs/math/has_long_double.h
> @@ -0,0 +1,16 @@
> +#ifndef HAS_LONG_DOUBLE_H
> +#define HAS_LONG_DOUBLE_H
> +//copied from newlib math.h on 21 Jan 2021

The exact location might be helpful. Since this file wasn't copied entirely, 
the file header block should be provided as per 
https://docs.rtems.org/branches/master/eng/coding-file-hdr.html


> +
> +/* Newlib doesn't fully support long double math functions so far.
> +   On platforms where long double equals double the long double functions
> +   simply call the double functions.  On Cygwin the long double functions
> +   are implemented independently from newlib to be able to use optimized
> +   assembler functions despite using the Microsoft x86_64 ABI. */ #if 
> +defined (_LDBL_EQ_DBL) || defined (__CYGWIN__)

I guess __CYGWIN__ is never defined?

> +#ifndef __math_68881
> +#define NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS 1 #endif #endif
> +

This header reduces to
#if defined (_LDBL_EQ_DBL) && !defined(__math_68881) #define 
NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS 1 #endif

but, since you just use this as a feature check anyway, you could replace all 
#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
with
#if defined (_LDBL_EQ_DBL) && !defined(__math_68881) /* newlib has long double 
*/ in this patch, and you don't need this header, unless the feature check is 
likely to change?

> +#endif
> diff --git a/testsuites/psxtests/psxhdrs/math/hypotl.c 
> b/testsuites/psxtests/psxhdrs/math/hypotl.c
> index bffc632c09..182e4028d8 100644
> --- a/testsuites/psxtests/psxhdrs/math/hypotl.c
> +++ b/testsuites/psxtests/psxhdrs/math/hypotl.c
> @@ -35,7 +35,9 @@
>  #endif
>
>  #include 
> +#include "has_long_double.h"
>
> +#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
>  int test( void );
>
>  int test( void )
> @@ -46,3 +48,4 @@ int test( void )
>
>return (result);
>  }
> +#endif

It seems to me that this is doing something that might better be done by the 
build system. Why even build these tests, if they are going to be empty? I 
wonder if we can probe for the long double math support in the build
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE: [PATCH v2 1/3] rtems-debugger: Fixed 32bit pointers

2021-03-18 Thread Stephen Clark
I think Sebastian and Gedare might have referenced this earlier, but I’m not 
sure if how to be that descriptive within the 50 character limit. "Use 
uintptr_t not uint32_t for portability to 64-bit CPUs" is 58 characters without 
a prefix. Even when pared down to something like “Use uintptr_t to build on 
64-bit CPUs”, there still isn’t room to prepend “rtems-debugger:”.

From: Joel Sherrill 
Sent: Thursday, March 18, 2021 12:50 PM
To: Stephen Clark 
Cc: rtems-de...@rtems.org 
Subject: Re: [PATCH v2 1/3] rtems-debugger: Fixed 32bit pointers

After picking on Ryan, Alex, and Sebastian, you get it next. :)

"Fix" or "Fixed" in the short commit message title is not useful
when you browse the log of commits:

https://git.rtems.org/rtems/log/

Something like "Use uint32_t not uintptr_t for portability to 64-bit CPUs"
says a lot more. Think of yourself reading that list of commits and what
messages tell you enough and which leave you thinking that you need
to look at the change to know what was done.



On Thu, Mar 18, 2021 at 12:33 PM Stephen Clark 
mailto:stephen.cl...@oarcorp.com>> wrote:
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libdebugger/rtems-debugger-server.c | 4 ++--
 cpukit/libdebugger/rtems-debugger-target.c | 2 +-
 cpukit/libdebugger/rtems-debugger-target.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..f8c485a794 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -1438,7 +1438,7 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
@@ -1468,7 +1468,7 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);

I think the changes OK but Chris should comment what
happens on 64-bit address targets.

I think this may be decoding the gdb protocol message and we need
to know if the field coming in is OK to decode as a uint.

Your patch is OK but there may be an issue interfacing with the protocol
that this points out.

diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }

 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);

 /**
--
2.27.0

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

[PATCH v2 3/3] stackchk: Fixed 32bit pointers

2021-03-18 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libmisc/stackchk/check.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index ab08155c92..a2b63345d9 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -447,12 +447,13 @@ static bool Stack_check_Dump_threads_usage(
 {
   char name[ 22 ];
   const rtems_printer *printer;
+  uintptr_t sp = _CPU_Context_Get_SP( _thread->Registers );
 
   printer = arg;
   _Thread_Get_name( the_thread, name, sizeof( name ) );
   Stack_check_Dump_stack_usage(
 _thread->Start.Initial_stack,
-(void *) _CPU_Context_Get_SP( _thread->Registers ),
+(void *) sp,
 name,
 the_thread->Object.id,
 printer
-- 
2.27.0

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


[PATCH v2 2/3] rtems-fdt: Fixed 32bit pointers

2021-03-18 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c 
b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
index b0894c1d38..61f20765e0 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
@@ -52,14 +52,14 @@ static long rtems_fdt_test_timeout = 5;
 static rtems_fdt_handle cmd_fdt_handle;
 
 static void
-rtems_fdt_write (uint32_t address, uint32_t value)
+rtems_fdt_write (uintptr_t address, uint32_t value)
 {
   volatile uint32_t* ap = (uint32_t*) address;
   *ap = value;
 }
 
 static uint32_t
-rtems_fdt_read (uint32_t address)
+rtems_fdt_read (uintptr_t address)
 {
   volatile uint32_t* ap = (uint32_t*) address;
   return *ap;
-- 
2.27.0

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


[PATCH v2 1/3] rtems-debugger: Fixed 32bit pointers

2021-03-18 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libdebugger/rtems-debugger-server.c | 4 ++--
 cpukit/libdebugger/rtems-debugger-target.c | 2 +-
 cpukit/libdebugger/rtems-debugger-target.h | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..f8c485a794 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -1438,7 +1438,7 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
@@ -1468,7 +1468,7 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
-- 
2.27.0

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


[PATCH v2] psxtests: Fix math function build warnings

2021-03-18 Thread Stephen Clark
Added conditionals to ensure that long double function tests were only
built when newlib has long double math functions.
---
 testsuites/psxtests/psxhdrs/math/acoshl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/acosl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/asinhl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/asinl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/atan2l.c|  3 +++
 testsuites/psxtests/psxhdrs/math/atanhl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/atanl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/cbrtl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/ceill.c |  3 +++
 testsuites/psxtests/psxhdrs/math/copysignl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/coshl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/cosl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/erfcl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/erfl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/exp2l.c |  3 +++
 testsuites/psxtests/psxhdrs/math/expl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/expm1l.c|  3 +++
 testsuites/psxtests/psxhdrs/math/fabsl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/fdiml.c |  3 +++
 testsuites/psxtests/psxhdrs/math/floorl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/fmal.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/fmaxl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/fminl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/fmodl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/frexpl.c|  3 +++
 .../psxtests/psxhdrs/math/has_long_double.h  | 16 
 testsuites/psxtests/psxhdrs/math/hypotl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/ilogbl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/ldexpl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/lgammal.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/llrintl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/llroundl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/log10l.c|  3 +++
 testsuites/psxtests/psxhdrs/math/log1pl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/log2l.c |  3 +++
 testsuites/psxtests/psxhdrs/math/logbl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/logl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/lrintl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/lroundl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/modfl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/nanl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/nearbyintl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/nextafterl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/nexttoward.c|  3 +++
 testsuites/psxtests/psxhdrs/math/nexttowardf.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/nexttowardl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/powl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/remainderl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/remquol.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/rintl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/roundl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/scalblnl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/scalbnl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/sinhl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/sinl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/sqrtl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/tanhl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/tanl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/tgammal.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/truncl.c|  3 +++
 60 files changed, 193 insertions(+)
 create mode 100644 testsuites/psxtests/psxhdrs/math/has_long_double.h

diff --git a/testsuites/psxtests/psxhdrs/math/acoshl.c 
b/testsuites/psxtests/psxhdrs/math/acoshl.c
index b6bf0bd16c..fd25a3a1e4 100644
--- a/testsuites/psxtests/psxhdrs/math/acoshl.c
+++ b/testsuites/psxtests/psxhdrs/math/acoshl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/acosl.c 
b/testsuites/psxtests/psxhdrs/math/acosl.c
index d2235aea76..9176131294 100644
--- a/testsuites/psxtests/psxhdrs/math/acosl.c
+++ b/testsuites/psxtests/psxhdrs/math/acosl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
 return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/asinhl.c 
b/testsuites/psxtests/psxhdrs/math/asinhl.c
index e3a2a0ec9b..607b02dd68 100644
--- a/testsuites/psxtests/psxhdrs/math/asinhl.c
+++ b/testsuites/psxtests/psxhdrs/math/asinhl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include 

[PATCH v1 2/2] psxtests: Fix math function build warnings

2021-03-18 Thread Stephen Clark
Added conditionals to ensure that long double function tests were only
built when newlib has long double math functions.
---
 testsuites/psxtests/psxhdrs/math/acoshl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/acosl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/asinhl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/asinl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/atan2l.c|  3 +++
 testsuites/psxtests/psxhdrs/math/atanhl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/atanl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/cbrtl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/ceill.c |  3 +++
 testsuites/psxtests/psxhdrs/math/copysignl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/coshl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/cosl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/erfcl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/erfl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/exp2l.c |  3 +++
 testsuites/psxtests/psxhdrs/math/expl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/expm1l.c|  3 +++
 testsuites/psxtests/psxhdrs/math/fabsl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/fdiml.c |  3 +++
 testsuites/psxtests/psxhdrs/math/floorl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/fmal.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/fmaxl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/fminl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/fmodl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/frexpl.c|  3 +++
 .../psxtests/psxhdrs/math/has_long_double.h  | 16 
 testsuites/psxtests/psxhdrs/math/hypotl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/ilogbl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/ldexpl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/lgammal.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/llrintl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/llroundl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/log10l.c|  3 +++
 testsuites/psxtests/psxhdrs/math/log1pl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/log2l.c |  3 +++
 testsuites/psxtests/psxhdrs/math/logbl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/logl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/lrintl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/lroundl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/modfl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/nanl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/nearbyintl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/nextafterl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/nexttoward.c|  3 +++
 testsuites/psxtests/psxhdrs/math/nexttowardf.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/nexttowardl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/powl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/remainderl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/remquol.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/rintl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/roundl.c|  3 +++
 testsuites/psxtests/psxhdrs/math/scalblnl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/scalbnl.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/sinhl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/sinl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/sqrtl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/tanhl.c |  3 +++
 testsuites/psxtests/psxhdrs/math/tanl.c  |  3 +++
 testsuites/psxtests/psxhdrs/math/tgammal.c   |  3 +++
 testsuites/psxtests/psxhdrs/math/truncl.c|  3 +++
 60 files changed, 193 insertions(+)
 create mode 100644 testsuites/psxtests/psxhdrs/math/has_long_double.h

diff --git a/testsuites/psxtests/psxhdrs/math/acoshl.c 
b/testsuites/psxtests/psxhdrs/math/acoshl.c
index b6bf0bd16c..fd25a3a1e4 100644
--- a/testsuites/psxtests/psxhdrs/math/acoshl.c
+++ b/testsuites/psxtests/psxhdrs/math/acoshl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
   return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/acosl.c 
b/testsuites/psxtests/psxhdrs/math/acosl.c
index d2235aea76..9176131294 100644
--- a/testsuites/psxtests/psxhdrs/math/acosl.c
+++ b/testsuites/psxtests/psxhdrs/math/acosl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include "has_long_double.h"
 
+#if defined NEWLIB_HAS_LONG_DOUBLE_MATH_FUNCTIONS
 int test( void );
 
 int test( void )
@@ -47,3 +49,4 @@ int test( void )
 
 return (result);
 }
+#endif
diff --git a/testsuites/psxtests/psxhdrs/math/asinhl.c 
b/testsuites/psxtests/psxhdrs/math/asinhl.c
index e3a2a0ec9b..607b02dd68 100644
--- a/testsuites/psxtests/psxhdrs/math/asinhl.c
+++ b/testsuites/psxtests/psxhdrs/math/asinhl.c
@@ -35,7 +35,9 @@
 #endif
 
 #include 
+#include 

[PATCH v1 1/2] cpukit: Fixed 32bit pointers

2021-03-18 Thread Stephen Clark
Using 32bit types like uint32_t for pointers creates issues on 64 bit
architectures like AArch64. Replaced occurrences of these with uintptr_t,
which will work for both 32 and 64 bit architectures.
---
 cpukit/libdebugger/rtems-debugger-server.c | 4 ++--
 cpukit/libdebugger/rtems-debugger-target.c | 2 +-
 cpukit/libdebugger/rtems-debugger-target.h | 2 +-
 cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c | 4 ++--
 cpukit/libmisc/stackchk/check.c| 3 ++-
 5 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/cpukit/libdebugger/rtems-debugger-server.c 
b/cpukit/libdebugger/rtems-debugger-server.c
index 975ec23a30..f8c485a794 100644
--- a/cpukit/libdebugger/rtems-debugger-server.c
+++ b/cpukit/libdebugger/rtems-debugger-server.c
@@ -1438,7 +1438,7 @@ remote_read_memory(uint8_t* buffer, int size)
   if (comma == NULL)
 remote_packet_out_str(r_E01);
   else {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
@@ -1468,7 +1468,7 @@ remote_write_memory(uint8_t* buffer, int size)
   comma = strchr((const char*) buffer, ',');
   colon = strchr((const char*) buffer, ':');
   if (comma != NULL && colon != NULL) {
-DB_UINT addr;
+uintptr_t addr;
 DB_UINT length;
 int r;
 addr = hex_decode_uint([1]);
diff --git a/cpukit/libdebugger/rtems-debugger-target.c 
b/cpukit/libdebugger/rtems-debugger-target.c
index bf7579700d..34e4e84d2f 100644
--- a/cpukit/libdebugger/rtems-debugger-target.c
+++ b/cpukit/libdebugger/rtems-debugger-target.c
@@ -168,7 +168,7 @@ rtems_debugger_target_reg_table_size(void)
 }
 
 int
-rtems_debugger_target_swbreak_control(bool insert, DB_UINT addr, DB_UINT kind)
+rtems_debugger_target_swbreak_control(bool insert, uintptr_t addr, DB_UINT 
kind)
 {
   rtems_debugger_target* target = rtems_debugger->target;
   rtems_debugger_target_swbreak* swbreaks;
diff --git a/cpukit/libdebugger/rtems-debugger-target.h 
b/cpukit/libdebugger/rtems-debugger-target.h
index f2abbe5fd3..db356e1f07 100644
--- a/cpukit/libdebugger/rtems-debugger-target.h
+++ b/cpukit/libdebugger/rtems-debugger-target.h
@@ -200,7 +200,7 @@ extern void 
rtems_debugger_target_exception_print(CPU_Exception_frame* frame);
  * Software breakpoints. These are also referred to as memory breakpoints.
  */
 extern int rtems_debugger_target_swbreak_control(boolinsert,
- DB_UINT addr,
+ uintptr_t addr,
  DB_UINT kind);
 
 /**
diff --git a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c 
b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
index b0894c1d38..61f20765e0 100644
--- a/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
+++ b/cpukit/libmisc/rtems-fdt/rtems-fdt-shell.c
@@ -52,14 +52,14 @@ static long rtems_fdt_test_timeout = 5;
 static rtems_fdt_handle cmd_fdt_handle;
 
 static void
-rtems_fdt_write (uint32_t address, uint32_t value)
+rtems_fdt_write (uintptr_t address, uint32_t value)
 {
   volatile uint32_t* ap = (uint32_t*) address;
   *ap = value;
 }
 
 static uint32_t
-rtems_fdt_read (uint32_t address)
+rtems_fdt_read (uintptr_t address)
 {
   volatile uint32_t* ap = (uint32_t*) address;
   return *ap;
diff --git a/cpukit/libmisc/stackchk/check.c b/cpukit/libmisc/stackchk/check.c
index ab08155c92..a2b63345d9 100644
--- a/cpukit/libmisc/stackchk/check.c
+++ b/cpukit/libmisc/stackchk/check.c
@@ -447,12 +447,13 @@ static bool Stack_check_Dump_threads_usage(
 {
   char name[ 22 ];
   const rtems_printer *printer;
+  uintptr_t sp = _CPU_Context_Get_SP( _thread->Registers );
 
   printer = arg;
   _Thread_Get_name( the_thread, name, sizeof( name ) );
   Stack_check_Dump_stack_usage(
 _thread->Start.Initial_stack,
-(void *) _CPU_Context_Get_SP( _thread->Registers ),
+(void *) sp,
 name,
 the_thread->Object.id,
 printer
-- 
2.27.0

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


Removed 'unicode' keyword from pkgconfig.py

2020-09-25 Thread Stephen Clark
I have attached a patch to remove the use of the 'unicode' keyword from the 
pkgconfig.py file.
This addresses #4094, where this same patch has been attached.
I was able to run the sb-set-builder script on the master, so I don't believe 
this problem exists on that branch.
Thanks,
Stephen Clark


0001-pkgconfig.py-Removed-use-of-unicode-keyword-for-pyth.patch
Description: 0001-pkgconfig.py-Removed-use-of-unicode-keyword-for-pyth.patch
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel