[PATCHv2 rtems_waf] Allow vendor field in toolchain target triplet

martinerikwerner.aac at gmail.com martinerikwerner.aac at gmail.com
Thu May 25 08:53:00 UTC 2023


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 at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel


More information about the devel mailing list