Re: [PATCHv2 rtems_waf] Allow vendor field in toolchain target triplet

2023-05-25 Thread martinerikwerner . aac
While poking around some more, it seems like there's more places in
this file where assumptions of no vendor in the triplet might come into
play (but did not affect my use of it), if I'm reading it correctly?:

227 conf.env.ARCH_BSP = '%s/%s' % (arch.split('-')[0], bsp)

232 conf.env.RTEMS_ARCH = arch.split('-')[0]

554 return _arch_from_arch_bsp(arch_bsp).split('-')[0]

931 ab = arch_bsp.split('-')
(...)
939 flagstr = subprocess.check_output(
940 [config, '--bsp',
941  '%s/%s' % (ab[0], ab[2]), flags_map[flags]])

I'm also a bit uncertain, what is the "arch" actually supposed to be in
general, given that the _arch_from_arch_bsp(arch_bsp) and
arch(arch_bsp) seem to disagree (former include the os (rtems) field,
latter excludes it).


I'm not sure I am aware of all places where this is used as a
submodule, my only testing has been as part of a custom user
application...

On Thu, 2023-05-25 at 08:48 +1000, Chris Johns wrote:
> Looks good and thanks. I have pushed this.
> 
> If you would like to submit module update patches for the various
> repos using
> rtems_waf please feel free to do so.
> 
> Chris
> 
> On 25/5/2023 4:13 am, Martin Erik Werner wrote:
> > Rework the splitting of arch and bsp to rely on the last field in
> > the
> > arch section starting with "rtems", instead of relying on the arch
> > being
> > exactly two fields in size.
> > 
> > This makes sure that toolchains with a vendor field in their target
> > triplet can be used with this build system.
> > 
> > Toolchains produced by the RTEMS source builder tend to omit the
> > vendor
> > field, but for example the SPARC LEON/ERC32 toolchain provided by
> > Gaisler through the RCC package does include a vendor field.
> > ---
> > 
> > v2 fixes an off-by-one error in list indexing compared to v1.
> > 
> >  rtems.py | 8 ++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/rtems.py b/rtems.py
> > index 0b24645..c65a7d2 100644
> > --- a/rtems.py
> > +++ b/rtems.py
> > @@ -858,11 +858,15 @@ def _check_arch_bsps(req, config, path,
> > archs, version):
> >  
> >  
> >  def _arch_from_arch_bsp(arch_bsp):
> > -    return '-'.join(arch_bsp.split('-')[:2])
> > +    fields = arch_bsp.split('-')
> > +    rtems_field_index = next(i for i, field in enumerate(fields)
> > if field.startswith('rtems'))
> > +    return '-'.join(fields[:(rtems_field_index + 1)])
> >  
> >  
> >  def _bsp_from_arch_bsp(arch_bsp):
> > -    return '-'.join(arch_bsp.split('-')[2:])
> > +    fields = arch_bsp.split('-')
> > +    rtems_field_index = next(i for i, field in enumerate(fields)
> > if field.startswith('rtems'))
> > +    return '-'.join(fields[(rtems_field_index + 1):])
> >  
> >  
> >  def _pkgconfig_path(path):
> ___
> devel mailing list
> devel@rtems.org
> http://lists.rtems.org/mailman/listinfo/devel
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCHv2 rtems_waf] Allow vendor field in toolchain target triplet

2023-05-26 Thread martinerikwerner . aac
On Fri, 2023-05-26 at 08:33 +1000, Chris Johns wrote:
> On 25/5/2023 6:53 pm, martinerikwerner@gmail.com wrote:
> > While poking around some more, it seems like there's more places in
> > this file where assumptions of no vendor in the triplet might come
> > into
> > play (but did not affect my use of it), if I'm reading it
> > correctly?:
> > 
> > 227 conf.env.ARCH_BSP = '%s/%s' % (arch.split('-')[0], bsp)
> > 
> > 232 conf.env.RTEMS_ARCH = arch.split('-')[0]
> > 
> > 554 return _arch_from_arch_bsp(arch_bsp).split('-')[0]
> > 
> > 931 ab = arch_bsp.split('-')
> > (...)
> > 939 flagstr = subprocess.check_output(
> > 940 [config, '--bsp',
> > 941  '%s/%s' % (ab[0], ab[2]), flags_map[flags]])
> > 
> > I'm also a bit uncertain, what is the "arch" actually supposed to
> > be in
> > general, given that the _arch_from_arch_bsp(arch_bsp) and
> > arch(arch_bsp) seem to disagree (former include the os (rtems)
> > field,
> > latter excludes it).
> 
> I suspect the uncertainly is due to things evolving and me not paying
> close
> enough attention because it did not matter. The vendor field changes
> that. I
> will take a look and see if I can clean it up.
> 
> What is the full text for the `arch_bsp` you are working with so I
> can test it?

waf gives the following if I instrument the rtems.py code:

  arch_bsp: sparc-gaisler-rtems5-leon3

This is based on a minimal application with the rtems_waf submodule
(c721249+instrumentation) and pointing at a downloaded rcc-1.3.1-gcc
toolchain and bsp:

  ./waf configure --rtems=$HOME/binary/rcc-1.3.1-gcc 
--rtems-bsps=sparc-gaisler/leon3
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel