diff --git a/scripts/west_commands/runners/ezflashcli.py b/scripts/west_commands/runners/ezflashcli.py index ca3c226dbbf..393c710e0b0 100644 --- a/scripts/west_commands/runners/ezflashcli.py +++ b/scripts/west_commands/runners/ezflashcli.py @@ -12,7 +12,7 @@ DEFAULT_EZFLASHCLI = "ezFlashCLI" class EzFlashCliBinaryRunner(ZephyrBinaryRunner): '''Runner front-end for ezFlashCLI''' - def __init__(self, cfg, tool, dev_id=None, tool_opt=[], erase=False, reset=True): + def __init__(self, cfg, tool, dev_id=None, tool_opt=None, erase=False, reset=True): super().__init__(cfg) self.bin_ = cfg.bin_file @@ -22,8 +22,9 @@ class EzFlashCliBinaryRunner(ZephyrBinaryRunner): self.reset = bool(reset) self.tool_opt = [] - for opts in [shlex.split(opt) for opt in tool_opt]: - self.tool_opt += opts + if tool_opt is not None: + for opts in [shlex.split(opt) for opt in tool_opt]: + self.tool_opt += opts @classmethod def name(cls): diff --git a/scripts/west_commands/runners/jlink.py b/scripts/west_commands/runners/jlink.py index 2aedba0a37e..d2d8cda6c68 100644 --- a/scripts/west_commands/runners/jlink.py +++ b/scripts/west_commands/runners/jlink.py @@ -58,7 +58,7 @@ class JLinkBinaryRunner(ZephyrBinaryRunner): gdb_host='', gdb_port=DEFAULT_JLINK_GDB_PORT, rtt_port=DEFAULT_JLINK_RTT_PORT, - tui=False, tool_opt=[]): + tui=False, tool_opt=None): super().__init__(cfg) self.file = cfg.file self.file_type = cfg.file_type @@ -82,8 +82,9 @@ class JLinkBinaryRunner(ZephyrBinaryRunner): self.rtt_port = rtt_port self.tool_opt = [] - for opts in [shlex.split(opt) for opt in tool_opt]: - self.tool_opt += opts + if tool_opt is not None: + for opts in [shlex.split(opt) for opt in tool_opt]: + self.tool_opt += opts @classmethod def name(cls): diff --git a/scripts/west_commands/runners/linkserver.py b/scripts/west_commands/runners/linkserver.py index 7cf419a705c..4d0a4a15f57 100644 --- a/scripts/west_commands/runners/linkserver.py +++ b/scripts/west_commands/runners/linkserver.py @@ -29,8 +29,8 @@ class LinkServerBinaryRunner(ZephyrBinaryRunner): gdb_host='', gdb_port=DEFAULT_LINKSERVER_GDB_PORT, semihost_port=DEFAULT_LINKSERVER_SEMIHOST_PORT, - override=[], - tui=False, tool_opt=[]): + override=None, + tui=False, tool_opt=None): super().__init__(cfg) self.file = cfg.file self.file_type = cfg.file_type @@ -48,12 +48,13 @@ class LinkServerBinaryRunner(ZephyrBinaryRunner): self.gdb_port = gdb_port self.semihost_port = semihost_port self.tui_arg = ['-tui'] if tui else [] - self.override = override + self.override = override if override else [] self.override_cli = self._build_override_cli() self.tool_opt = [] - for opts in [shlex.split(opt) for opt in tool_opt]: - self.tool_opt += opts + if tool_opt is not None: + for opts in [shlex.split(opt) for opt in tool_opt]: + self.tool_opt += opts @classmethod def name(cls): diff --git a/scripts/west_commands/runners/nrf_common.py b/scripts/west_commands/runners/nrf_common.py index be732673f52..ec6baf29495 100644 --- a/scripts/west_commands/runners/nrf_common.py +++ b/scripts/west_commands/runners/nrf_common.py @@ -76,7 +76,7 @@ class NrfBinaryRunner(ZephyrBinaryRunner): '''Runner front-end base class for nrf tools.''' def __init__(self, cfg, family, softreset, dev_id, erase=False, - reset=True, tool_opt=[], force=False, recover=False): + reset=True, tool_opt=None, force=False, recover=False): super().__init__(cfg) self.hex_ = cfg.hex_file if family and not family.endswith('_FAMILY'): @@ -93,8 +93,9 @@ class NrfBinaryRunner(ZephyrBinaryRunner): self.suit_starter = False self.tool_opt = [] - for opts in [shlex.split(opt) for opt in tool_opt]: - self.tool_opt += opts + if tool_opt is not None: + for opts in [shlex.split(opt) for opt in tool_opt]: + self.tool_opt += opts @classmethod def capabilities(cls): diff --git a/scripts/west_commands/runners/nrfjprog.py b/scripts/west_commands/runners/nrfjprog.py index ce135222ad0..ae6fec6c5b9 100644 --- a/scripts/west_commands/runners/nrfjprog.py +++ b/scripts/west_commands/runners/nrfjprog.py @@ -19,7 +19,7 @@ class NrfJprogBinaryRunner(NrfBinaryRunner): '''Runner front-end for nrfjprog.''' def __init__(self, cfg, family, softreset, dev_id, erase=False, - reset=True, tool_opt=[], force=False, recover=False, + reset=True, tool_opt=None, force=False, recover=False, qspi_ini=None): super().__init__(cfg, family, softreset, dev_id, erase, reset, diff --git a/scripts/west_commands/runners/nrfutil.py b/scripts/west_commands/runners/nrfutil.py index 165c03f2feb..d2c3c53a5dd 100644 --- a/scripts/west_commands/runners/nrfutil.py +++ b/scripts/west_commands/runners/nrfutil.py @@ -17,7 +17,7 @@ class NrfUtilBinaryRunner(NrfBinaryRunner): '''Runner front-end for nrfutil.''' def __init__(self, cfg, family, softreset, dev_id, erase=False, - reset=True, tool_opt=[], force=False, recover=False, + reset=True, tool_opt=None, force=False, recover=False, suit_starter=False): super().__init__(cfg, family, softreset, dev_id, erase, reset,