Skip to content

Commit dc09484

Browse files
mbolivar-nordicjhedberg
authored andcommitted
scripts: run_common: fix command line --hex-file and friends
This is yet another bug introduced by the move to runners.yaml. Sigh. I should have tested this better. Signed-off-by: Martí Bolívar <[email protected]>
1 parent f8cb3d4 commit dc09484

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

scripts/west_commands/run_common.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,17 @@ def do_run_common(command, user_args, user_runner_args):
188188
parser = argparse.ArgumentParser(prog=runner_name)
189189
add_parser_common(command, parser=parser)
190190
runner_cls.add_parser(parser)
191-
final_args, unknown = parser.parse_known_args(args=final_argv)
191+
args, unknown = parser.parse_known_args(args=final_argv)
192192
if unknown:
193193
log.die(f'runner {runner_name} received unknown arguments: {unknown}')
194194

195+
# Override args with any user_args. The latter must take
196+
# precedence, or e.g. --hex-file on the command line would be
197+
# ignored in favor of a board.cmake setting.
198+
for a, v in vars(user_args).items():
199+
if v is not None:
200+
setattr(args, a, v)
201+
195202
# Create the RunnerConfig from the values assigned to common
196203
# arguments. This is a hacky way to go about this; probably
197204
# ZephyrBinaryRunner should define what it needs to make this
@@ -200,9 +207,7 @@ def do_run_common(command, user_args, user_runner_args):
200207
#
201208
# Use that RunnerConfig to create the ZephyrBinaryRunner instance
202209
# and call its run().
203-
runner = runner_cls.create(runner_cfg_from_args(final_args,
204-
build_dir),
205-
final_args)
210+
runner = runner_cls.create(runner_cfg_from_args(args, build_dir), args)
206211
try:
207212
runner.run(command_name)
208213
except ValueError as ve:

0 commit comments

Comments
 (0)