[PATCH] rtems-bsps: Add markdown support

2020-05-01 Thread chrisj
From: Chris Johns 

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

diff --git a/rtems-bsps b/rtems-bsps
index 133009046c..82c5150969 100755
--- a/rtems-bsps
+++ b/rtems-bsps
@@ -1,49 +1,320 @@
-#! /bin/sh
-
-top=$(dirname $0)
-base="${top}/bsps"
-base_e=$(echo ${base} | sed -e 's/\//\\\//g')
-
-last_arch=""
-
-cfg_list=$(LANG=C LC_COLLATE=C find ${base} -mindepth 3 -name \*.cfg | sort)
-
-max_bsp_len=0
-arch_count=0
-bsp_count=0
-
-for bsp_path in ${cfg_list};
-do
-  arch=$(echo ${bsp_path} | sed -e "s/${base_e}*\///" -e 's/\/.*//')
-  bsp=$(echo ${bsp_path} | sed -e "s/.*\///" -e 's/\.cfg//')
-  len=${#bsp}
-  if test "${last_arch}" != "${arch}"; then
-arch_count=$(expr ${arch_count} + 1)
-last_arch=${arch}
-  fi
-  if [ $len -gt $max_bsp_len ]; then
-max_bsp_len=$len
-  fi
-  bsp_count=$(expr ${bsp_count} + 1)
-done
-
-max_bsp_len=$(expr ${max_bsp_len} + 2)
-last_arch=""
-
-echo "RTEMS 5"
-echo " Architectures: ${arch_count}"
-echo " BSP Count: ${bsp_count}"
-for bsp_path in ${cfg_list};
-do
- arch=$(echo ${bsp_path} | sed -e "s/${base_e}*\///" -e 's/\/.*//')
- bsp=$(echo ${bsp_path} | sed -e "s/.*\///" -e 's/\.cfg//')
- path=$(echo ${bsp_path} | sed -e "s/\/config.*//")
- if test "${last_arch}" != "${arch}"; then
-   echo "${arch}:"
-   last_arch=${arch}
- fi
- spaces=$(echo ${bsp} | awk '{ printf("%*s", '${max_bsp_len}' -length(), " "); 
}')
- echo " ${bsp}${spaces}${path}"
-done
-
-exit 0
+#! /usr/bin/env python
+#
+# RTEMS (http://www.rtems.org/)
+# Copyright 2020 Chris Johns (chr...@rtems.org)
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+from __future__ import print_function
+
+import argparse
+import os
+import os.path
+import sys
+
+rtems_version = 5
+
+
+class ArchBsps:
+"""Collects and processes the BSPs for a range of architectures
+creating output in text, markdown and HTML ir pandoc is installed"""
+def __init__(self, path='.', trace=False):
+self.trace = trace
+self._output = []
+self.top = os.path.realpath(path)
+self.base = os.path.join(self.top, 'bsps')
+self.configs = []
+self.archs = {}
+self._collect('.cfg')
+self._process()
+
+def _clear(self):
+"""Clears the output."""
+self._output = []
+
+def _out(self, line=''):
+"""Output a line to the output buffer."""
+self._output += [line]
+
+def _collect(self, ext):
+"""Collect the config files from the source tree."""
+self.configs = []
+for root, dirs, files in os.walk(self.base, topdown=True):
+for f in files:
+if os.path.splitext(f)[1] == ext:
+self.configs += [os.path.join(root, f)]
+
+def _process(self):
+"""Process the collected list of config files."""
+self.archs = {}
+for cfg in self.configs:
+config_path = cfg[len(self.base) + 1:]
+config_parts = config_path.split(os.sep)
+if len(config_parts) == 4:
+arch = config_parts[0]
+family = config_parts[1]
+bsp = os.path.splitext(config_parts[3])[0]
+if arch not in self.archs:
+self.archs[arch] = {}
+if family not in self.archs[arch]:
+self.archs[arch][family] = {}
+self.archs[arch][family][bsp] = config_path
+
+def _max_arch_len(self):
+"""Finds the longest arch label"""
+maxlen = 0
+for arch in self.archs:
+if len(arch) > maxlen:
+maxlen = len(arch)
+   

[PATCH v3] Rework RTEMS licensing discussions.

2020-05-01 Thread Joel Sherrill
This now captures historical rationale alone with cross-linking
code templates with license guidelines.

Closes #3962.
---
 eng/coding-conventions.rst   | 19 -
 eng/license-requirements.rst | 91 +---
 2 files changed, 96 insertions(+), 14 deletions(-)

diff --git a/eng/coding-conventions.rst b/eng/coding-conventions.rst
index 488ee26..10034df 100644
--- a/eng/coding-conventions.rst
+++ b/eng/coding-conventions.rst
@@ -33,15 +33,16 @@ Source Documentation
 Licenses
 
 
-* The RTEMS `License `_. is 
the typical
-  and preferred license.
-  * 2- and 3-clause BSD, MIT, and other OSI-approved non-copyleft licenses
-that permit statically linking with the code of different licenses
-are acceptable.
-  * GPL licensed code is NOT acceptable, neither is LGPL.
-See `this blog post explanation 
`_.
-for more information.
-  * Advertising obligations are NOT acceptable, but restrictions are 
permissible.
+The RTEMS Project has strict requirements on the types of software licenses
+that apply to software it includes and distributes. Submissions will be
+summarily rejected that do not follow the correct license or file header
+requirements.
+
+* Refer to :ref:`LicensingRequirements` for a discussion of the acceptable
+  licenses and the rationale.
+
+* Refer to :ref:`FileHeaderCopyright` for example copyright/license comment
+  blocks for various languages.
 
 Language and Compiler
 -
diff --git a/eng/license-requirements.rst b/eng/license-requirements.rst
index 44814b1..b2720f2 100644
--- a/eng/license-requirements.rst
+++ b/eng/license-requirements.rst
@@ -9,8 +9,10 @@ Licensing Requirements
 **
 
 All artifacts shall adhere to RTEMS Project licensing
-requirements. Currently, the preferred licenses are CC-BY-SA-4.0 license
-for documentation and "Two Paragraph BSD" for source code.
+requirements. Currently, the preferred licenses are:
+
+* "Two Clause BSD" (BSD-2-Clause) for source code, and
+* CC-BY-SA-4.0 license for documentation
 
 Historically, RTEMS has been licensed under the GPL v2 with linking
 exception (https://www.rtems.org/license). It is preferred that new
@@ -19,7 +21,86 @@ previously submitted code to RTEMS under a historical 
license, please
 grant the project permission to relicense. See
 https://devel.rtems.org/ticket/3053 for details.
 
-TBD - Convert the following to Rest and insert into this file
-TBD - https://devel.rtems.org/wiki/Developer/Coding/Conventions#Licenses
+For example templates for what to include in source code and 
+documentation, see :ref:`FileHeaderCopyright`.
+
+
+Rationale
+-
+.. COMMENT: Thanks to Gedare Bloom for his 2013 blog which
+.. COMMENT: discussed the rationale for RTEMS License section.
+.. COMMENT: 
http://gedare-csphd.blogspot.com/2013/05/software-licenses-with-rtems.html
+
+RTEMS is intended for use in real-time embedded systems in which the
+application is statically linked with the operating system and all
+support libraries. Given this use case, the RTEMS development team
+evaluated a variety of licenses with with the goal of promoting use
+while protecting both users and the developers.
+
+Using the GNU General Public License Version 2 (GPLv2) unmodified
+was considered but discarded because the GPL can only be linked statically
+with other GPL code. Put simply, linking your application code statically
+with GPL code would cause your code to become GPL code. This would force
+both licensing and redistribution requirements onto RTEMS users. This
+was completely unacceptable. 
+
+The GNU Lesser General Public License Version 2 (LGPLv2) was also 
+considered and deemed to not be a suitable license for RTEMS. This is
+because it either requires use of a shared library that can be re-linked,
+or release of the linked (application) code. This would require an
+RTEMS-based embedded system to provide a "relinking kit." Again, this 
+license would force an unacceptable requirement on RTEMS users and deemed
+unacceptable.
+
+Newer versions of the GPL (i.e. version 3) are completely unsuitable
+for embedded systems due to the additions which add further restrictions
+on end user applications. 
+
+The historical RTEMS `License `_ is a
+modified version of the GPL version 2 that includes an exception to permit
+including headers and linking against RTEMS object files statically. This
+was based on the license used by GCC language runtime libraries at that
+time. This license allows the static linking of RTEMS with applications
+without forcing obligations and restrictions on users.
+
+A problem for RTEMS is there are no copyleft licenses that are compatible
+with the deployment model of RTEMS. Thus, RTEMS Project has to reject any
+code that uses the GPL or LGPL, even though RTEMS has historically a

[PATCH v3] Rework Licensing Test in Engineering Guide

2020-05-01 Thread Joel Sherrill
Hi,

I think I have addressed everyone's comments. I did add a bit of text
near the bottom of the Rationale section. There is a new bullet on
dual-licensed software and a summary paragraph.

Joel Sherrill (1):
  Rework RTEMS licensing discussions.

 eng/coding-conventions.rst   | 19 -
 eng/license-requirements.rst | 91 +---
 2 files changed, 96 insertions(+), 14 deletions(-)

-- 
1.8.3.1

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


Re: [PATCH v3] Rework RTEMS licensing discussions.

2020-05-01 Thread Gedare Bloom
On Fri, May 1, 2020 at 7:17 AM Joel Sherrill  wrote:
>
> This now captures historical rationale alone with cross-linking
along

ACK this patch

> code templates with license guidelines.
>
> Closes #3962.
> ---
>  eng/coding-conventions.rst   | 19 -
>  eng/license-requirements.rst | 91 
> +---
>  2 files changed, 96 insertions(+), 14 deletions(-)
>
> diff --git a/eng/coding-conventions.rst b/eng/coding-conventions.rst
> index 488ee26..10034df 100644
> --- a/eng/coding-conventions.rst
> +++ b/eng/coding-conventions.rst
> @@ -33,15 +33,16 @@ Source Documentation
>  Licenses
>  
>
> -* The RTEMS `License `_. 
> is the typical
> -  and preferred license.
> -  * 2- and 3-clause BSD, MIT, and other OSI-approved non-copyleft licenses
> -that permit statically linking with the code of different licenses
> -are acceptable.
> -  * GPL licensed code is NOT acceptable, neither is LGPL.
> -See `this blog post explanation 
> `_.
> -for more information.
> -  * Advertising obligations are NOT acceptable, but restrictions are 
> permissible.
> +The RTEMS Project has strict requirements on the types of software licenses
> +that apply to software it includes and distributes. Submissions will be
> +summarily rejected that do not follow the correct license or file header
> +requirements.
> +
> +* Refer to :ref:`LicensingRequirements` for a discussion of the acceptable
> +  licenses and the rationale.
> +
> +* Refer to :ref:`FileHeaderCopyright` for example copyright/license comment
> +  blocks for various languages.
>
>  Language and Compiler
>  -
> diff --git a/eng/license-requirements.rst b/eng/license-requirements.rst
> index 44814b1..b2720f2 100644
> --- a/eng/license-requirements.rst
> +++ b/eng/license-requirements.rst
> @@ -9,8 +9,10 @@ Licensing Requirements
>  **
>
>  All artifacts shall adhere to RTEMS Project licensing
> -requirements. Currently, the preferred licenses are CC-BY-SA-4.0 license
> -for documentation and "Two Paragraph BSD" for source code.
> +requirements. Currently, the preferred licenses are:
> +
> +* "Two Clause BSD" (BSD-2-Clause) for source code, and
> +* CC-BY-SA-4.0 license for documentation
>
>  Historically, RTEMS has been licensed under the GPL v2 with linking
>  exception (https://www.rtems.org/license). It is preferred that new
> @@ -19,7 +21,86 @@ previously submitted code to RTEMS under a historical 
> license, please
>  grant the project permission to relicense. See
>  https://devel.rtems.org/ticket/3053 for details.
>
> -TBD - Convert the following to Rest and insert into this file
> -TBD - https://devel.rtems.org/wiki/Developer/Coding/Conventions#Licenses
> +For example templates for what to include in source code and
> +documentation, see :ref:`FileHeaderCopyright`.
> +
> +
> +Rationale
> +-
> +.. COMMENT: Thanks to Gedare Bloom for his 2013 blog which
> +.. COMMENT: discussed the rationale for RTEMS License section.
> +.. COMMENT: 
> http://gedare-csphd.blogspot.com/2013/05/software-licenses-with-rtems.html
> +
> +RTEMS is intended for use in real-time embedded systems in which the
> +application is statically linked with the operating system and all
> +support libraries. Given this use case, the RTEMS development team
> +evaluated a variety of licenses with with the goal of promoting use
> +while protecting both users and the developers.
> +
> +Using the GNU General Public License Version 2 (GPLv2) unmodified
> +was considered but discarded because the GPL can only be linked statically
> +with other GPL code. Put simply, linking your application code statically
> +with GPL code would cause your code to become GPL code. This would force
> +both licensing and redistribution requirements onto RTEMS users. This
> +was completely unacceptable.
> +
> +The GNU Lesser General Public License Version 2 (LGPLv2) was also
> +considered and deemed to not be a suitable license for RTEMS. This is
> +because it either requires use of a shared library that can be re-linked,
> +or release of the linked (application) code. This would require an
> +RTEMS-based embedded system to provide a "relinking kit." Again, this
> +license would force an unacceptable requirement on RTEMS users and deemed
> +unacceptable.
> +
> +Newer versions of the GPL (i.e. version 3) are completely unsuitable
> +for embedded systems due to the additions which add further restrictions
> +on end user applications.
> +
> +The historical RTEMS `License `_ is a
> +modified version of the GPL version 2 that includes an exception to permit
> +including headers and linking against RTEMS object files statically. This
> +was based on the license used by GCC language runtime libraries at that
> +time. This license allows the static linking of RTEMS with applications

Re: Release task request for help

2020-05-01 Thread Chris Johns

On 30/4/20 4:11 pm, Niteesh G. S. wrote:

I have replied to the comment please have a look.
https://github.com/gs-niteesh/rtems-release/commit/58ed0cb3fc1f33f12de8e550979371a51e322754#r38841918


Looks good. Could you please post a patch to this list of the changes?

I have just pushed a number of changes to the repo so please update :)

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


[PATCH 0/2 rtems-release] Add script to branch repositories.

2020-05-01 Thread G S Niteesh Babu
The following patches add a script to rtems-release
to automate branching of repositories for rtems
release. 

G S Niteesh Babu (2):
  rtems-release-defaults: Added rtems_repos to rtems-release-defaults.
  rtems-release-branch: Added a script file to branch repositories.

 rtems-release-branch   | 146 +
 rtems-release-defaults |  11 
 2 files changed, 157 insertions(+)
 create mode 100755 rtems-release-branch

-- 
2.17.1

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


[PATCH 2/2] rtems-release-branch: Added a script file to branch repositories.

2020-05-01 Thread G S Niteesh Babu
---
 rtems-release-branch | 146 +++
 1 file changed, 146 insertions(+)
 create mode 100755 rtems-release-branch

diff --git a/rtems-release-branch b/rtems-release-branch
new file mode 100755
index 000..ae8e06c
--- /dev/null
+++ b/rtems-release-branch
@@ -0,0 +1,146 @@
+#! /bin/sh
+#
+# RTEMS Tools Project (http://www.rtems.org/)
+# Copyright 2020 Niteesh Babu 
+# All rights reserved.
+#
+# This file is part of the RTEMS Tools package in 'rtems-tools'.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# 1. Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+
+set -e
+
+#
+# This is the top level RTEMS release script. Supply the version and and the
+# release.
+#
+. ./rtems-release-version
+echo "RTEMS Release, v${rtems_release_version}"
+
+#
+# Global release top path.
+#
+export release_top=${PWD}
+
+#
+# Usage for this tool.
+#
+usage() {
+ echo "Usage: $0 [-t] [-p] user version" 1>&2
+ echo " where:" 1>&2
+ echo "  user : Your git user name" 1>&2
+ echo "  version  : The version of RTEMS, eg 5" 1>&2
+ echo "  -t   : Git protocol will be used for cloning (for testing)." 
1>&2
+ echo "  -p   : Push the changes." 1>&2
+ exit 1
+}
+
+#
+# Defaults.
+#
+. ${release_top}/rtems-release-defaults
+
+#
+# Option defaults
+#
+clone_url=
+push=no
+
+#
+# Manage the command line.
+#
+while getopts "tp" opt; do
+ case "${opt}" in
+  t)
+   clone_url=git://git.rtems.org
+   ;;
+  p)
+   push=yes
+   ;;
+  *)
+   usage
+   ;;
+ esac
+done
+shift $((OPTIND-1))
+
+if [ $# -ne 2 ]; then
+ echo "error: 2 arguments must be supplied, your git user name, version. See 
-h for help"
+ exit 1
+fi
+user=$1
+version=$2
+
+#
+# Check if clone_url is empty.
+#
+if [ -z "${clone_url}" ]; then
+ clone_url=ssh://${user}@dispatch.rtems.org/data/git
+fi
+
+#
+# The branching workspace.
+#
+ws_branch=${version}-branched
+
+#
+# Version configuration. Overrides defaults.
+#
+if [ -f rtems-release-${version}-conf ]; then
+ rtems_release_conf=rtems-release-${version}-conf
+ . rtems-release-${version}-conf
+fi
+
+#
+# Clean the branched directory away.
+#
+rm -rf ${ws_branch}
+mkdir ${ws_branch}
+
+#
+# Clone and branch the repositories.
+#
+cd ${ws_branch}
+ for r in ${rtems_repos}
+ do
+  echo "git clone ${clone_url}/${r} ${r}"
+  git clone ${clone_url}/${r} ${r}
+  cd ${r}
+   echo "git checkout -b ${version} origin/master"
+   git checkout -b ${version} origin/master
+   cd ..
+ done
+
+ if [ ${push} = yes ]; then
+  for r in ${rtems_repos}
+  do
+   cd ${r}
+echo "git push origin ${version}"
+git push origin ${version}
+cd ..
+  done
+ fi
+ cd ..
+
+exit 0
-- 
2.17.1

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


[PATCH 1/2] rtems-release-defaults: Added rtems_repos to rtems-release-defaults.

2020-05-01 Thread G S Niteesh Babu
rtems_repos is variable which contains all rtems_repositories.
For eg: rtems_repos="rtems.git rtems-examples.git etc."
---
 rtems-release-defaults | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/rtems-release-defaults b/rtems-release-defaults
index 60d9721..fc30157 100755
--- a/rtems-release-defaults
+++ b/rtems-release-defaults
@@ -74,6 +74,17 @@ rtems_rsb_hash="rtems-tools rtems"
 rtems_packages="rtems-source-builder rtems rtems-tools rtems-libbsd"
 rtems_packages="${rtems_packages} rtems-examples rtems-docs"
 
+#
+# RTEMS repositories
+#
+rtems_repos=""
+for r in ${rtems_packages}
+do
+  rtems_repos="${rtems_repos} "${r}.git
+done
+
+rtems_repos="${rtems_repos} rtems-release.git"
+
 #
 # Where we collect the sources and docs.
 #
-- 
2.17.1

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


Re: [PATCH 0/2 rtems-release] Add script to branch repositories.

2020-05-01 Thread Chris Johns

Pushed. Many thanks for helping out with this task.

Chris

On 2/5/20 1:52 pm, G S Niteesh Babu wrote:

The following patches add a script to rtems-release
to automate branching of repositories for rtems
release.

G S Niteesh Babu (2):
   rtems-release-defaults: Added rtems_repos to rtems-release-defaults.
   rtems-release-branch: Added a script file to branch repositories.

  rtems-release-branch   | 146 +
  rtems-release-defaults |  11 
  2 files changed, 157 insertions(+)
  create mode 100755 rtems-release-branch


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


Re: [PATCH 0/2 rtems-release] Add script to branch repositories.

2020-05-01 Thread Niteesh G. S.
Thanks for pushing it.

Thanks,
Niteesh.

On Sat, May 2, 2020 at 11:05 AM Chris Johns  wrote:

> Pushed. Many thanks for helping out with this task.
>
> Chris
>
> On 2/5/20 1:52 pm, G S Niteesh Babu wrote:
> > The following patches add a script to rtems-release
> > to automate branching of repositories for rtems
> > release.
> >
> > G S Niteesh Babu (2):
> >rtems-release-defaults: Added rtems_repos to rtems-release-defaults.
> >rtems-release-branch: Added a script file to branch repositories.
> >
> >   rtems-release-branch   | 146 +
> >   rtems-release-defaults |  11 
> >   2 files changed, 157 insertions(+)
> >   create mode 100755 rtems-release-branch
> >
>
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: rtems assembler

2020-05-01 Thread suyash singh
Ok I think I found a solution.

use -integrated-as with clang

clang is using the system assembler(usr/bin/as) instead of the llvm
assembler(llvm-as)

It's still not working but at least assembler command failed error is gone

On Thu, Apr 30, 2020 at 9:36 PM Hesham Almatary 
wrote:

>
>
> On Thu, 30 Apr 2020 at 15:56, suyash singh 
> wrote:
>
>> after adding -v
>> https://hastebin.com/epijunegix.coffeescript
>>
>> with sparc-unknown-elf
>> https://hastebin.com/ijohidofus.coffeescript
>>
>> (target getting an extra unknown for some reason)
>>
>> riscv64-unknown-elf
>> https://hastebin.com/jirusidoti.sql
>>  different error: unknown register name (maybe because erc32 bsp with
>> riscv)
>>
> Yes, you need to run that on an RTEMS riscv BSP and not sparc sources
>
>
>>
>> On Thu, Apr 30, 2020 at 8:08 PM Hesham Almatary 
>> wrote:
>>
>>>
>>>
>>> On Thu, 30 Apr 2020 at 15:21, suyash singh 
>>> wrote:
>>>
 I think it doesn't support sparc backend although it does not give
 unknown target error.

 I compiled this c program with
 export PATH=$HOME/quick-start/rtems/5/bin:"$PATH"
  clang -target sparc-unknown-rtems5 test1.c

>>> Can you add -v to that command and post the output? Also try with
>>> sparc-unknown-elf. Last thing to try is to do the same for
>>> riscv64-unknown-elf
>>>

 *test1.c*
 int main(int argc, char **argv) {
   int k = 0x7fff;
   k += argc;
   return 0;
 }

 same error
 /usr/bin/as: unrecognized option '-Av8'
 clang-11: error: assembler command failed with exit code 1

 If i write
 clang -target hello test1.c
 error: unknown target triple 'hello', please use -triple or -arch

 So I guess it is detecting sparc but not working with it

 On Thu, Apr 30, 2020 at 7:07 PM Hesham Almatary <
 heshamelmat...@gmail.com> wrote:

>
>
> On Thu, 30 Apr 2020 at 14:18, suyash singh 
> wrote:
>
>>
>> I am using ubuntu 18.04 terminal
>>
>> Here's the python script I wrote to find all include files and run
>> clang -fsanitize
>>
>> # run with python3 in terminal
>>
>> import subprocess
>> import os
>>
>> relativedir="../bsps/sparc/erc32/btimer"
>> directory=os.path.join(os.getcwd(),"../")
>> file="btimer.c"
>> root_dir="ubsan"
>>
>> arr=['clang','-target','sparc','-
>>
> target needs to be sparc-unknown-rtems5 to pick up the correct tools.
> Does your clang support sparc backend? Can you try to compile and link 
> some
> simple C program with it?
>
>
>> fsanitize=undefined',"-I../../../../../../rtems/5/sparc-rtems5/erc32/lib/include","-I../../../../../../rtems/5/sparc-rtems5/include/"]
>>
>> for path, subdirs, files in os.walk(directory):
>> for subdir in subdirs:
>> if(subdir=="include"):
>> includepath=os.path.join(path,subdir)
>> idx=includepath.find("..")
>> arr.append("-I../../../../"+includepath[idx+3:])
>> arr.append(file)
>> subprocess.run(arr,cwd=relativedir, stdout=subprocess.PIPE)
>> #result=subprocess.run(['./a.out'],cwd=relativedir,
>> stdout=subprocess.PIPE)
>>
>> On Thu, Apr 30, 2020 at 6:44 PM Hesham Almatary <
>> heshamelmat...@gmail.com> wrote:
>>
>>>
>>>
>>> On Thu, 30 Apr 2020 at 13:51, Joel Sherrill  wrote:
>>>


 On Thu, Apr 30, 2020 at 7:34 AM suyash singh <
 suyashsingh...@gmail.com> wrote:

> Hello,
> I was running clang UBSan on
> bsps/sparc/erc32/btimer/btimer.c
>
> and got error
>
> /usr/bin/as: unrecognized option '-Av8'
> clang-11: error: assembler command failed with exit code 1
>
> I am not sure but is it because clang is using wrong assembler?
>

 I haven't seen anyone run into this in a long time. :)

 In this case, it is likely one of two things:

 + Look at your $PATH. Make sure the RTEMS tools are first.

 + But in your case, I expect that it is because the clang didn't
 know (somehow) to put the target name in front of the as.
 Did you invoke it for sparc-rtems5? If so, then there is a
 path through clang where it isn't looking at the target name.

>>> That’s likely to be the problem. I expect Suyash isn’t cross
>>> compiling with clang.
>>>
>>>
 I also double checked the as manual to ensure -Av8 was in
 fact a sparc option.

 --joel

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

 ___
 devel mailing list
 devel@rte