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 <miguel.gazquez@bootlin.com>
This commit is contained in:
Miguel Gazquez 2025-02-06 17:32:42 +01:00 committed by Benjamin Cabé
commit 783103ebf6
2 changed files with 8 additions and 5 deletions

View file

@ -57,7 +57,7 @@ class MiniChLinkBinaryRunner(ZephyrBinaryRunner):
minichlink=args.minichlink, minichlink=args.minichlink,
erase=args.erase, erase=args.erase,
reset=args.reset, reset=args.reset,
dt_flash=(args.dt_flash == "y"), dt_flash=args.dt_flash,
terminal=args.terminal, terminal=args.terminal,
) )

View file

@ -56,11 +56,14 @@ class SpiBurnBinaryRunner(ZephyrBinaryRunner):
iceman = 'ICEman' iceman = 'ICEman'
# Get flash address offset # Get flash address offset
if args.dt_flash == 'y': if args.dt_flash:
build_conf = BuildConfiguration(cfg.build_dir) 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: else:
address = args.addr address = args.addr