Re: [PATCH RSB v2] rtems-kernel: Implement kernel recipe using waf

2021-11-01 Thread Chris Johns
On 28/10/21 2:09 am, Ryan Long wrote:
> Closes #4145
> ---
>  rtems/config/tools/rtems-kernel-6.cfg  |   6 +-
>  rtems/config/tools/rtems-kernel-common.cfg | 125 
>  source-builder/rtems-kernel-config-check   | 147 
> +
>  source-builder/sb/options.py   | 135 +-
>  4 files changed, 283 insertions(+), 130 deletions(-)
>  create mode 100755 source-builder/rtems-kernel-config-check
> 
> diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
> b/rtems/config/tools/rtems-kernel-6.cfg
> index f1d0990..9120862 100644
> --- a/rtems/config/tools/rtems-kernel-6.cfg
> +++ b/rtems/config/tools/rtems-kernel-6.cfg
> @@ -2,10 +2,10 @@
>  # RTEMS 5
>  #
>  
> -%define rtems_kernel_version 3ec5f20484cc4201e1d7b87844505644533b6148
> -%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
> -  
> BjMKrf5n1YR6IpiZrY5TUEzKATPRJxA2/6m6f833DdRu+RyLxccXqA4gHRdVUqFelFNQ3o0XdG4o1naBKYfhkQ==
> +%define rtems_kernel_version 3bb97a30b17b6c138dead3e3a6b329c3b301cdb3
>  
> +%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
> +  
> m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEwlVk3SRjjRFkFalDGQ==
>  #
>  # The RTEMS build instructions.
>  #
> diff --git a/rtems/config/tools/rtems-kernel-common.cfg 
> b/rtems/config/tools/rtems-kernel-common.cfg
> index 157c7a4..d5b67dd 100644
> --- a/rtems/config/tools/rtems-kernel-common.cfg
> +++ b/rtems/config/tools/rtems-kernel-common.cfg
> @@ -9,7 +9,7 @@
>  # and BSPs. Only after the source to download.
>  #
>  %if %{_dry_run} && %{defined with_download}
> - %log Kenrel configuration errors ignored
> + %log Kernel configuration errors ignored
>   %define rtems_kernel_error 0
>  %else
>   %define rtems_kernel_error 1
> @@ -19,10 +19,15 @@
>   %define rtems_kernel_version %{rsb_version}
>  %endif
>  
> +%if %{defined with_rtems_bsp_config}
> + %define _target %(%{_topdir}/../source-builder/rtems-kernel-config-check -v 
> %{rtems_version} -t %{with_rtems_bsp_config})

There is a variable called `_sbdir` that is normally used to find internal
helper scripts located in the source builder...

https://docs.rtems.org/branches/master/user/rsb/configuration.html#configuration

If you add `rtems-kernel-config-check` to `source-builder` it becomes a user
facing tool and needs documentation and a controlled user interface. If you use:

 %{_sbdir}/sb/rtems-kernel-config-check

the helper script is internal to the source builder. Is the script internal?

> + %define rtems_bsp %(%{_topdir}/../source-builder/rtems-kernel-config-check 
> -b %{with_rtems_bsp_config})

How are config file errors handled? I normally return `ERROR` or something that
can be checked.

> +%endif
> +
>  #
>  # The target. It could be set in rtems_target.
>  #
> -%if %{defined rtems_target}
> +%if %{defined rtems_target} && !%{defined with_rtems_bsp_config}
>   %define _target %{rtems_target}
>  %endif
>  %if %{_target} == %{nil} && %{rtems_kernel_error}
> @@ -32,10 +37,21 @@
>  #
>  # The BSP.
>  #
> -%if !%{defined with_rtems_bsp} && %{rtems_kernel_error}
> +%if !%{defined with_rtems_bsp} && %{rtems_kernel_error} && !%{defined 
> with_rtems_bsp_config}
>   %error No RTEMS BSP specified: --with-rtems-bsp=bsp
>  %endif
> -%define rtems_bsp %{with_rtems_bsp}
> +%if !%{defined with_rtems_bsp_config}
> + %define rtems_bsp %{with_rtems_bsp}
> +%endif
> +
> +#
> +# Configuration file used with waf
> +#
> +%ifn %{defined with_rtems_bsp_config}
> + %define config_file config-%{_target}-%{rtems_bsp}.ini
> +%else
> + %define config_file %{with_rtems_bsp_config}
> +%endif
>  
>  #
>  # If no tools are provided use the prefix.
> @@ -98,14 +114,6 @@ URL:   https://www.rtems.org/
>   %define rtems_posix 0
>  %endif
>  
> -%if %{defined with_rtems_legacy_network}
> - %define rtems_networking 1
> -%endif
> -
> -%if %{defined with_rtems_cxx}
> - %define rtems_cxx 1
> -%endif
> -
>  %if %{defined with_rtems_bspopts}
>   %define bspopts %{with_rtems_bspopts}
>  %endif
> @@ -143,43 +151,43 @@ URL: https://www.rtems.org/
>  # --without-rtems-tests  : Supported, forced to no
>  # --with-rtems-smp   : Supported
>  # --without-rtems-smp: Don't care
> -# --with-rtems-legacy-network: Supported
> +# --with-rtems-legacy-network: Unsupported
>  # --without-rtems-legacy-network : Don't care
> -# --with-rtems-bspopts   : Supported, quote for a list
> -# --without-rtems-bspopts: Don't care
> -#
>  %if %{defined without_rtemsbsp}
>   %error Option --without-rtemsbsp is not supported.
>  %endif
> +%if %{defined with_rtems_legacy_network}
> + echo "RTEMS legacy network has been removed."
> + echo "Please review and update your configuration."
> + exit 1
> +%endif
> +%if %{defined enable_cxx}
> + echo CXX has been removed."
> + echo "Please review and update your configuration."
> + exit 1
> +%endif
> +
>  %if %{defined without_rtems_tests}
> - %define with_rtems_te

Re: [PATCH] fix memory leak within calloc.c libtests

2021-11-01 Thread zack leung
bump


On Mon, 18 Oct 2021 at 23:46, zack leung  wrote:

> fix came from github code inspector, flagged by one of the analysis that
> was done
> ---
>  testsuites/libtests/POSIX/calloc.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/testsuites/libtests/POSIX/calloc.c
> b/testsuites/libtests/POSIX/calloc.c
> index bd04faa800..a7537c8cc4 100644
> --- a/testsuites/libtests/POSIX/calloc.c
> +++ b/testsuites/libtests/POSIX/calloc.c
> @@ -16,6 +16,8 @@ int
>  main (void)
>  {
>void *foo = calloc (42, 43);
> +  int rc = (foo != NULL);
> +  free(foo);
>
> -  return (foo != NULL);
> +  return rc;
>  }
> --
> 2.33.0
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel


RE: [rtems-tools] tester: Update jobs configuration

2021-11-01 Thread Ryan Long
ping

-Original Message-
From: Ryan Long  
Sent: Wednesday, October 20, 2021 3:06 PM
To: devel@rtems.org
Cc: Ryan Long 
Subject: [rtems-tools] tester: Update jobs configuration

Allow for default_jobs and max_jobs to be specified in the BSP's configuration 
file.
---
 rtemstoolkit/options.py| 45 +-
 tester/rtems/testing/bsps/beagleboardxm.ini|  2 +-
 tester/rtems/testing/bsps/beagleboneblack.ini  |  2 +-
 tester/rtems/testing/bsps/imx7.ini |  2 +-
 tester/rtems/testing/bsps/mcf5235.ini  |  2 +-
 tester/rtems/testing/bsps/mvme2307.ini |  2 +-
 tester/rtems/testing/bsps/pc.ini   |  2 +-
 tester/rtems/testing/bsps/qoriq_e500.ini   |  2 +-
 tester/rtems/testing/bsps/qoriq_e6500_32.ini   |  2 +-
 tester/rtems/testing/bsps/qoriq_e6500_64.ini   |  2 +-
 tester/rtems/testing/bsps/raspberrypi2.ini |  2 +-
 tester/rtems/testing/bsps/xilinx_versal_vck190.ini |  2 +-  
.../rtems/testing/bsps/xilinx_zynq_a9_qemu_smp.ini |  2 +-
 tester/rtems/testing/bsps/xilinx_zynq_zc706.ini|  2 +-
 tester/rtems/testing/bsps/xilinx_zynq_zedboard.ini |  2 +-
 .../testing/bsps/xilinx_zynqmp_ilp32_zu3eg.ini |  2 +-
 .../testing/bsps/xilinx_zynqmp_lp64_zu3eg.ini  |  2 +-
 tester/rtems/testing/defaults.mc   |  2 +
 18 files changed, 45 insertions(+), 34 deletions(-)

diff --git a/rtemstoolkit/options.py b/rtemstoolkit/options.py index 
5ebe3bc..4b7a93a 100644
--- a/rtemstoolkit/options.py
+++ b/rtemstoolkit/options.py
@@ -102,7 +102,7 @@ class command_line(object):
 '--no-clean':   'Do not clean up the build tree',
 '--always-clean':   'Always clean the build tree, even 
with an error',
 '--keep-going': 'Do not stop on an error.',
-'--jobs=[0..n,none,half,full]': 'Run with specified number of 
jobs, default: num CPUs.',
+'--jobs=[0..n,none,half,full]': 'Run with specified number 
+ of jobs (default: defined in configuration file)',
 '--macros file[,file]': 'Macro format files to load after 
the defaults',
 '--log file':   'Log file where all build output 
is written to',
 }
@@ -327,6 +327,11 @@ class command_line(object):
 # Handle the jobs for make
 if '_ncpus' not in self.defaults:
 raise error.general('host number of CPUs not set')
+if self.defaults['default_jobs'] != '0':
+print(
+'default_jobs is %d and the default is %d' %
+(self.defaults['default_jobs'], 0)
+)
 ncpus = self.jobs(self.defaults['_ncpus'])
 if ncpus > 1:
 self.defaults['_smp_mflags'] = '-j %d' % (ncpus) @@ -427,28 
+432,25 @@ class command_line(object):
 um += [m]
 return um if len(um) else None
 
-def jobs(self, cpus):
+def jobs(self, num_cpus):
 try:
-cpus = int(cpus)
+cpus = int(num_cpus)
 except:
 raise error.general('invalid host cpu value')
 opt_jobs = self.opts['jobs']
 if opt_jobs == 'default':
-_jobs = self.defaults.get_value('jobs')
-if _jobs is not None:
-if _jobs == 'none':
-cpus = 0
-elif _jobs == 'max':
-pass
-elif _jobs == 'half':
-cpus = cpus / 2
-else:
-try:
-cpus = int(_jobs)
-except:
-raise error.general('invalid %%{jobs} value: %s' % 
(_jobs))
+_jobs = self.defaults.get_value('default_jobs')
+if _jobs == 'none':
+cpus = 0
+elif _jobs == 'max':
+pass
+elif _jobs == 'half':
+cpus = cpus / 2
 else:
-opt_jobs = 'max'
+try:
+cpus = int(_jobs)
+except:
+raise error.general('invalid %%{jobs} value: %s' % 
+ (_jobs))
 if opt_jobs != 'default':
 if opt_jobs == 'none':
 cpus = 0
@@ -474,7 +476,14 @@ class command_line(object):
 if not ok:
 raise error.internal('bad jobs option: %s' % 
(opt_jobs))
 if cpus <= 0:
-cpu = 1
+cpus = 1
+max_jobs = int(self.defaults.get_value('max_jobs'))
+if max_jobs == 0:
+max_jobs = cpus
+if cpus > max_jobs:
+raise error.internal(
+'exceeded maximum number of jobs: %d > %d' % (cpus, max_jobs)
+)
 return cpus
 
 def params(self):
diff --git a/tester/rtems/testing/bsps/beagleboardxm.ini 
b/tester/rtems/testing/bsps/beagleboardxm.ini
index e8a79a6..72e6e8f 100644

RE: [PATCH RSB v2] rtems-kernel: Implement kernel recipe using waf

2021-11-01 Thread Ryan Long
ping

-Original Message-
From: Ryan Long  
Sent: Wednesday, October 27, 2021 10:09 AM
To: devel@rtems.org
Cc: Ryan Long 
Subject: [PATCH RSB v2] rtems-kernel: Implement kernel recipe using waf

Closes #4145
---
 rtems/config/tools/rtems-kernel-6.cfg  |   6 +-
 rtems/config/tools/rtems-kernel-common.cfg | 125 
 source-builder/rtems-kernel-config-check   | 147 +
 source-builder/sb/options.py   | 135 +-
 4 files changed, 283 insertions(+), 130 deletions(-)  create mode 100755 
source-builder/rtems-kernel-config-check

diff --git a/rtems/config/tools/rtems-kernel-6.cfg 
b/rtems/config/tools/rtems-kernel-6.cfg
index f1d0990..9120862 100644
--- a/rtems/config/tools/rtems-kernel-6.cfg
+++ b/rtems/config/tools/rtems-kernel-6.cfg
@@ -2,10 +2,10 @@
 # RTEMS 5
 #
 
-%define rtems_kernel_version 3ec5f20484cc4201e1d7b87844505644533b6148
-%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.bz2 \
-  
BjMKrf5n1YR6IpiZrY5TUEzKATPRJxA2/6m6f833DdRu+RyLxccXqA4gHRdVUqFelFNQ3o0XdG4o1naBKYfhkQ==
+%define rtems_kernel_version 3bb97a30b17b6c138dead3e3a6b329c3b301cdb3
 
+%hash sha512 rtems-kernel-%{rtems_kernel_version}.tar.gz \
+  
+m/ogwrJj4X60ewDIbV6WRj1MJa/22gQHQd56XiNMfvCr0nsvcXdkXKAObLIGYIGYfUyEwlV
+k3SRjjRFkFalDGQ==
 #
 # The RTEMS build instructions.
 #
diff --git a/rtems/config/tools/rtems-kernel-common.cfg 
b/rtems/config/tools/rtems-kernel-common.cfg
index 157c7a4..d5b67dd 100644
--- a/rtems/config/tools/rtems-kernel-common.cfg
+++ b/rtems/config/tools/rtems-kernel-common.cfg
@@ -9,7 +9,7 @@
 # and BSPs. Only after the source to download.
 #
 %if %{_dry_run} && %{defined with_download}
- %log Kenrel configuration errors ignored
+ %log Kernel configuration errors ignored
  %define rtems_kernel_error 0
 %else
  %define rtems_kernel_error 1
@@ -19,10 +19,15 @@
  %define rtems_kernel_version %{rsb_version}  %endif
 
+%if %{defined with_rtems_bsp_config}
+ %define _target 
+%(%{_topdir}/../source-builder/rtems-kernel-config-check -v 
+%{rtems_version} -t %{with_rtems_bsp_config})  %define rtems_bsp 
+%(%{_topdir}/../source-builder/rtems-kernel-config-check -b 
+%{with_rtems_bsp_config}) %endif
+
 #
 # The target. It could be set in rtems_target.
 #
-%if %{defined rtems_target}
+%if %{defined rtems_target} && !%{defined with_rtems_bsp_config}
  %define _target %{rtems_target}
 %endif
 %if %{_target} == %{nil} && %{rtems_kernel_error} @@ -32,10 +37,21 @@  #  # 
The BSP.
 #
-%if !%{defined with_rtems_bsp} && %{rtems_kernel_error}
+%if !%{defined with_rtems_bsp} && %{rtems_kernel_error} && !%{defined 
+with_rtems_bsp_config}
  %error No RTEMS BSP specified: --with-rtems-bsp=bsp  %endif -%define 
rtems_bsp %{with_rtems_bsp}
+%if !%{defined with_rtems_bsp_config}
+ %define rtems_bsp %{with_rtems_bsp}
+%endif
+
+#
+# Configuration file used with waf
+#
+%ifn %{defined with_rtems_bsp_config}
+ %define config_file config-%{_target}-%{rtems_bsp}.ini
+%else
+ %define config_file %{with_rtems_bsp_config} %endif
 
 #
 # If no tools are provided use the prefix.
@@ -98,14 +114,6 @@ URL: https://www.rtems.org/
  %define rtems_posix 0
 %endif
 
-%if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
-%endif
-
-%if %{defined with_rtems_cxx}
- %define rtems_cxx 1
-%endif
-
 %if %{defined with_rtems_bspopts}
  %define bspopts %{with_rtems_bspopts}
 %endif
@@ -143,43 +151,43 @@ URL:   https://www.rtems.org/
 # --without-rtems-tests  : Supported, forced to no
 # --with-rtems-smp   : Supported
 # --without-rtems-smp: Don't care
-# --with-rtems-legacy-network: Supported
+# --with-rtems-legacy-network: Unsupported
 # --without-rtems-legacy-network : Don't care
-# --with-rtems-bspopts   : Supported, quote for a list
-# --without-rtems-bspopts: Don't care
-#
 %if %{defined without_rtemsbsp}
  %error Option --without-rtemsbsp is not supported.
 %endif
+%if %{defined with_rtems_legacy_network}  echo "RTEMS legacy network 
+has been removed."
+ echo "Please review and update your configuration."
+ exit 1
+%endif
+%if %{defined enable_cxx}
+ echo CXX has been removed."
+ echo "Please review and update your configuration."
+ exit 1
+%endif
+
 %if %{defined without_rtems_tests}
- %define with_rtems_tests no
+ %define rtems_tests False
+ %define rtems_sample_tests False
 %endif
 %if %{defined with_rtems_tests}
  %if %{with_rtems_tests} == 1
-  %define with_rtems_tests yes
+   %define rtems_tests True
+   %define rtems_sample_tests True
  %endif
- %if %{with_rtems_tests} == yes || \
- %{with_rtems_tests} == no || \
- %{with_rtems_tests} == samples
-  %define rtems_tests %{with_rtems_tests}
+  %if %{with_rtems_tests} == samples
+  %define rtems_tests False
+  %define rtems_sample_tests True
  %endif
 %endif
 %if %{defined with_rtems_smp}
  %define rtems_smp 1
 %endif
-%if %{defined with_rtems_legacy_network}
- %define rtems_networking 1
-%e

[PATCH rtems-docs] c-user: Update for application CONFIGURE option

2021-11-01 Thread Kinsey Moore
This adds the documentation for the application configuration option
CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING.
---
 c-user/config/device-driver.rst | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/c-user/config/device-driver.rst b/c-user/config/device-driver.rst
index 22002f9..5d1081a 100644
--- a/c-user/config/device-driver.rst
+++ b/c-user/config/device-driver.rst
@@ -604,6 +604,36 @@ NOTES:
 This configuration option is only evaluated if the configuration option
 :ref:`CONFIGURE_APPLICATION_NEEDS_ATA_DRIVER` is defined.
 
+.. Generated from spec:/acfg/if/exception-to-signal-mapping
+
+.. index:: CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING
+
+.. _CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING:
+
+CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING
+-
+
+CONSTANT:
+``CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING``
+
+OPTION TYPE:
+This configuration option is a boolean feature define.
+
+DEFAULT CONFIGURATION:
+If this configuration option is undefined, then the described feature is 
not
+enabled.
+
+DESCRIPTION:
+In case this configuration option is defined, then the machine exception to
+POSIX signal mapping is configured during system initialization.
+
+NOTES:
+This device driver is responsible for setting up a mapping from machine
+exceptions to POSIX signals so that applications may consume them and alter
+task execution as necessary.
+
+This is especially useful for applications written in Ada or C++.
+
 .. Generated from spec:/acfg/if/max-drivers
 
 .. index:: CONFIGURE_MAXIMUM_DRIVERS
-- 
2.30.2

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


[PATCH rtems-central] spec: CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING

2021-11-01 Thread Kinsey Moore
---
 spec/acfg/if/exception-to-signal-mapping.yml | 22 
 1 file changed, 22 insertions(+)
 create mode 100644 spec/acfg/if/exception-to-signal-mapping.yml

diff --git a/spec/acfg/if/exception-to-signal-mapping.yml 
b/spec/acfg/if/exception-to-signal-mapping.yml
new file mode 100644
index ..fc717e3e
--- /dev/null
+++ b/spec/acfg/if/exception-to-signal-mapping.yml
@@ -0,0 +1,22 @@
+SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
+appl-config-option-type: feature-enable
+copyrights:
+- Copyright (C) 2021 On-Line Applications Research Corporation (OAR)
+description: |
+  In case this configuration option is defined, then the machine exception to
+  POSIX signal mapping is configured during system initialization.
+enabled-by: true
+index-entries: []
+interface-type: appl-config-option
+links:
+- role: appl-config-group-member
+  uid: group-devdrv
+name: CONFIGURE_EXCEPTION_TO_SIGNAL_MAPPING
+notes: |
+  This device driver is responsible for setting up a mapping from machine
+  exceptions to POSIX signals so that applications may consume them and alter
+  task execution as necessary.
+
+  This is especially useful for applications written in Ada or C++.
+text: ''
+type: interface
-- 
2.30.2

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


[PATCH rtems-docs] cpu-supplement: Update AArch64 SMP details

2021-11-01 Thread Kinsey Moore
AArch64 now supports SMP for the Xilinx ZynqMP BSP family.
---
 cpu-supplement/aarch64.rst | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/cpu-supplement/aarch64.rst b/cpu-supplement/aarch64.rst
index a102817..2b3d620 100644
--- a/cpu-supplement/aarch64.rst
+++ b/cpu-supplement/aarch64.rst
@@ -9,7 +9,7 @@ This chapter discusses the dependencies of the
 *ARM AArch64 architecture*
 (https://en.wikipedia.org/wiki/ARM_architecture#AArch64_features) in this port
 of RTEMS.  The ARMv8-A versions are supported by RTEMS.  Processors with a MMU
-use a static configuration which is set up during system start.  SMP is not
+use a static configuration which is set up during system start.  SMP is
 supported.
 
 **Architecture Documents**
@@ -124,7 +124,9 @@ actions:
 Symmetric Multiprocessing
 =
 
-SMP is not currently supported on ARMv8-A.
+SMP is supported on ARMv8-A.  Available platforms are:
+
+- Xilinx ZynqMP (QEMU and hardware using PSCI via ARM Trusted Firmware)
 
 Thread-Local Storage
 
-- 
2.30.2

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