Skip to content

Commit aec9c29

Browse files
committed
scripts: west_commands: runners: fix dt-flash handling in some runners
In minichlink and spi_burn, the script checks if dt_flash is True by checking if the value is "y". But dt_flash is a boolean. Fix these checks. Also, when dt-flash is True, spi_burn calculate the address in a convoluted way, by substrating CONFIG_FLASH_LOAD_OFFSET to itself. Simplify this computation. Signed-off-by: Miguel Gazquez <[email protected]>
1 parent 7d6bf44 commit aec9c29

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

scripts/west_commands/runners/minichlink.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def do_create(cls, cfg: RunnerConfig, args: argparse.Namespace):
5757
minichlink=args.minichlink,
5858
erase=args.erase,
5959
reset=args.reset,
60-
dt_flash=(args.dt_flash == "y"),
60+
dt_flash=args.dt_flash,
6161
terminal=args.terminal,
6262
)
6363

scripts/west_commands/runners/spi_burn.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,14 @@ def do_create(cls, cfg, args):
5656
iceman = 'ICEman'
5757

5858
# Get flash address offset
59-
if args.dt_flash == 'y':
59+
if args.dt_flash:
6060
build_conf = BuildConfiguration(cfg.build_dir)
61-
address = hex(
62-
cls.get_flash_address(args, build_conf) - build_conf['CONFIG_FLASH_BASE_ADDRESS']
63-
)
61+
62+
if build_conf.getboolean('CONFIG_HAS_FLASH_LOAD_OFFSET'):
63+
address = hex(build_conf['CONFIG_FLASH_LOAD_OFFSET'])
64+
else:
65+
address = '0x0'
66+
6467
else:
6568
address = args.addr
6669

0 commit comments

Comments
 (0)