Changeset d64e10e in rtems


Ignore:
Timestamp:
10/27/22 21:40:53 (7 months ago)
Author:
Chris Johns <chrisj@…>
Branches:
master
Children:
18b1a591
Parents:
26d50bd
git-author:
Chris Johns <chrisj@…> (10/27/22 21:40:53)
git-committer:
Chris Johns <chrisj@…> (10/30/22 21:03:11)
Message:

rtems-bsps: Generate empty config.ini for arc/bsp combinations

  • Generate a config for all BSPs in an arch
File:
1 edited

Legend:

Unmodified
Added
Removed
  • rtems-bsps

    r26d50bd rd64e10e  
    22#
    33# RTEMS (http://www.rtems.org/)
    4 # Copyright 2020 Chris Johns (chrisj@rtems.org)
     4# Copyright 2020, 2022 Chris Johns (chrisj@rtems.org)
    55# All rights reserved.
    66#
     
    6464    def _out(self, line=''):
    6565        """Output a line to the output buffer."""
    66         self._output += [line]
     66        if isinstance(line, list):
     67            self._output += line
     68        else:
     69            self._output += [line]
    6770
    6871    def _collect(self, ext):
     
    267270                            else:
    268271                                self._out('%-*s |%s' % (max_bsp, bsp, family))
    269                                
     272
    270273    def pairs(self, arch_selector=None, family_selector=None, show_path=False):
    271274        """Generate output as pairs"""
     
    291294                                pair = arch + '/' + bsp
    292295                                pair = '%-*s %s' % (max_arch + max_bsp + 1, pair, p)
    293                                
     296
    294297                                self._out(pair)
    295298                            else:
    296299                                self._out('%s/%s' % (arch, bsp))
     300
     301    def config(self, arch_selector=None, family_selector=None):
     302        """Generate output as pairs"""
     303        self._clear()
     304        self._out(['# Generated by rtems-bsp',
     305                   '[DEFAULT]',
     306                   '# Build',
     307                   'RTEMS_BUILD_LABEL = DEFAULT',
     308                   'RTEMS_DEBUG = False',
     309                   'RTEMS_PROFILING = False',
     310                   'RTEMS_POSIX_API = True',
     311                   '# Tests',
     312                   'BUILD_TESTS = False',
     313                   'BUILD_BENCHMARKS = False',
     314                   'BUILD_FSTESTS = False',
     315                   'BUILD_LIBTESTS = False',
     316                   'BUILD_MPTESTS = False',
     317                   'BUILD_PSXTESTS = False',
     318                   'BUILD_PSXTMTESTS = False',
     319                   'BUILD_RHEALSTONE = False',
     320                   'BUILD_SAMPLES = True',
     321                   'BUILD_SMPTESTS = False',
     322                   'BUILD_SPTESTS = False',
     323                   'BUILD_TMTESTS = False',
     324                   'BUILD_UNITTESTS = False',
     325                   'BUILD_VALIDATIONTESTS = False',
     326                   'RTEMS_TEST_VERBOSITY = Normal',
     327                   '# Compliler',
     328                   '; WARNING_FLAGS = -Wall',
     329                   '; CC_WARNING_FLAGS = -Wmissing-prototypes -Wimplicit-function-declaration -Wstrict-prototypes -Wnested-externs',
     330                   '; CXX_WARNING_FLAGS = ',
     331                   '; OPTIMIZATION_FLAGS = -O2 -g -fdata-sections -ffunction-sections',
     332                   '; BSP_OPTIMIZATION_FLAGS = ${OPTIMIZATION_FLAGS}',
     333                   '; CPUKIT_OPTIMIZATION_FLAGS = ${OPTIMIZATION_FLAGS}',
     334                   '; TEST_OPTIMIZATION_FLAGS = ${OPTIMIZATION_FLAGS}',
     335                   '; LINKFLAGS = ',
     336                   '; LDFLAGS = -Wl,--gc-sections',
     337                   '# BSP',
     338                   'BSP_VERBOSE_FATAL_EXTENSION = 1',
     339                   'BSP_PRINT_EXCEPTION_CONTEXT = 1',
     340                   'BSP_RESET_BOARD_AT_EXIT = 1'])
     341        self._out()
     342        max_arch = self._max_arch_len()
     343        max_bsp = self._max_bsp_len()
     344        if arch_selector is None:
     345            arch_matcher = []
     346        else:
     347            arch_matcher = [a.strip() for a in arch_selector.split(',')]
     348        if family_selector is None:
     349            family_matcher = []
     350        else:
     351            family_matcher = [f.strip() for f in family_selector.split(',')]
     352        for arch in sorted(self.archs.keys()):
     353            if arch_selector is None or arch in arch_matcher:
     354                for family in sorted(self.archs[arch].keys()):
     355                    if family_selector is None or family in family_matcher:
     356                        for bsp in sorted(self.archs[arch][family].keys()):
     357                            self._out('[%s/%s]' % (arch, bsp))
     358                            self._out()
    297359
    298360
     
    332394                       help='Output architectures and BSPs in CPU/BSP format',
    333395                       action='store_true')
     396    argsp.add_argument('-C',
     397                       '--config',
     398                       help='Output architectures and BSPs in `config.ini` format',
     399                       action='store_true')
    334400
    335401    argopts = argsp.parse_args(args[1:])
     
    346412                    show_path=argopts.paths,
    347413                    show_title=argopts.title)
     414    elif argopts.pairs:
     415        ab.pairs(arch_selector=argopts.arch,
     416                 family_selector=argopts.family,
     417                 show_path=argopts.paths)
     418    elif argopts.config:
     419        ab.config(arch_selector=argopts.arch,
     420                 family_selector=argopts.family)
    348421    else:
    349         if argopts.pairs:
    350             ab.pairs(arch_selector=argopts.arch,
    351                      family_selector=argopts.family,
    352                      show_path=argopts.paths)
    353         else:
    354             ab.text(arch_selector=argopts.arch,
    355                     family_selector=argopts.family,
    356                     show_path=argopts.paths)
     422        ab.text(arch_selector=argopts.arch,
     423                family_selector=argopts.family,
     424                show_path=argopts.paths)
    357425
    358426    print(os.linesep.join(ab.output()))
Note: See TracChangeset for help on using the changeset viewer.