Skip to content

scripts: west_commands: runners: fix and removes the '--dt-flash' option. #85395

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion boards/common/silabs_commander.board.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-License-Identifier: Apache-2.0

board_set_flasher_ifnset(silabs_commander)
board_finalize_runner_args(silabs_commander)
board_finalize_runner_args(silabs_commander "--dt-flash=y")
2 changes: 1 addition & 1 deletion scripts/west_commands/runners/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def add_parser(cls, parser):
parser.add_argument('-i', '--dev-id', help=argparse.SUPPRESS)

if caps.flash_addr:
parser.add_argument('--dt-flash', default='n', choices=_YN_CHOICES,
parser.add_argument('--dt-flash', default=False, choices=_YN_CHOICES,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense to me. False is not in _YN_CHOICES. The point of action=_DTFlashAction was to do the conversion to bool based on the value. If that's not working, the solution is to fix the action, not change the default to a value that isn't in choices.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The action is not run if there is no value passed to the argument, only if the value is passed through the command line. So without argument the final value is 'n', but if we pass --dt-flash n, then _DTFlashAction is called, and we correctly get False.

action=_DTFlashAction,
help='''If 'yes', try to use flash address
information from devicetree when flash
Expand Down
2 changes: 1 addition & 1 deletion scripts/west_commands/runners/minichlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def do_create(cls, cfg: RunnerConfig, args: argparse.Namespace):
minichlink=args.minichlink,
erase=args.erase,
reset=args.reset,
dt_flash=(args.dt_flash == "y"),
dt_flash=args.dt_flash,
terminal=args.terminal,
)

Expand Down
11 changes: 7 additions & 4 deletions scripts/west_commands/runners/spi_burn.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ def do_create(cls, cfg, args):
iceman = 'ICEman'

# Get flash address offset
if args.dt_flash == 'y':
if args.dt_flash:
build_conf = BuildConfiguration(cfg.build_dir)
address = hex(
cls.get_flash_address(args, build_conf) - build_conf['CONFIG_FLASH_BASE_ADDRESS']
)

if build_conf.getboolean('CONFIG_HAS_FLASH_LOAD_OFFSET'):
address = hex(build_conf['CONFIG_FLASH_LOAD_OFFSET'])
else:
address = '0x0'

else:
address = args.addr

Expand Down
Loading