scripts: west: introduce common runner configuration
Continue better integration of the runner subpackage into west by moving the common runner configuration options into the command core. This allows commands like "west flash -h" to display help for common overrides like --kernel-hex. Adjustments needed to make this happen are: - Change the build system to separate common configuration values from runner-specific options and arguments - Prepare the runner core by defining a new RunnerConfig class that represents the common configuration, and accepting that from a new create() method, which replaces create_from_args(). - Convert all concrete runner classes to use the new style of argument parsing and initialization. - Group the command options appropriately for help output readability There's still a bit of tool-specific stuff in the common configuration (gdb and openocd configuration in particular); a more generic way to deal with that will be necessary to better support things like non-GDB debuggers, but that's out of scope of this patch. All the runner-specific options are still in the runner packge, which currently prevents them from being included in "west flash -h" etc. Fixing that is also out of scope of this patch. This has the ancillary benefit of getting rid of the legacy 'debug' argument to ZephyrBinaryRunner, which is no longer appropriate since verbose debug logging is handled by log.py in west. Signed-off-by: Marti Bolivar <marti@opensourcefoundries.com>
This commit is contained in:
parent
c9dfbfaf02
commit
5317f76dec
15 changed files with 314 additions and 224 deletions
|
@ -19,9 +19,9 @@ DfuSeConfig = namedtuple('DfuSeConfig', ['address', 'options'])
|
|||
class DfuUtilBinaryRunner(ZephyrBinaryRunner):
|
||||
'''Runner front-end for dfu-util.'''
|
||||
|
||||
def __init__(self, pid, alt, img, exe='dfu-util',
|
||||
dfuse_config=None, debug=False):
|
||||
super(DfuUtilBinaryRunner, self).__init__(debug=debug)
|
||||
def __init__(self, cfg, pid, alt, img, exe='dfu-util',
|
||||
dfuse_config=None):
|
||||
super(DfuUtilBinaryRunner, self).__init__(cfg)
|
||||
self.alt = alt
|
||||
self.img = img
|
||||
self.cmd = [exe, '-d,{}'.format(pid)]
|
||||
|
@ -67,9 +67,9 @@ class DfuUtilBinaryRunner(ZephyrBinaryRunner):
|
|||
help='dfu-util executable; defaults to "dfu-util"')
|
||||
|
||||
@classmethod
|
||||
def create_from_args(cls, args):
|
||||
def create(cls, cfg, args):
|
||||
if args.img is None:
|
||||
args.img = args.kernel_bin
|
||||
args.img = cfg.kernel_bin
|
||||
|
||||
if args.dfuse:
|
||||
args.dt_flash = True # --dfuse implies --dt-flash.
|
||||
|
@ -79,9 +79,8 @@ class DfuUtilBinaryRunner(ZephyrBinaryRunner):
|
|||
else:
|
||||
dcfg = None
|
||||
|
||||
return DfuUtilBinaryRunner(args.pid, args.alt, args.img,
|
||||
exe=args.dfu_util, dfuse_config=dcfg,
|
||||
debug=args.verbose)
|
||||
return DfuUtilBinaryRunner(cfg, args.pid, args.alt, args.img,
|
||||
exe=args.dfu_util, dfuse_config=dcfg)
|
||||
|
||||
def find_device(self):
|
||||
cmd = list(self.cmd) + ['-l']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue