west: runners: openocd: handle empty --elf-file
Make this param truly optional, so that hex file alone is enough for
flashing.
Signed-off-by: Marcin Niestroj <m.niestroj@emb.dev>
diff --git a/scripts/west_commands/runners/openocd.py b/scripts/west_commands/runners/openocd.py
index 6af2b70..6e61a3d 100644
--- a/scripts/west_commands/runners/openocd.py
+++ b/scripts/west_commands/runners/openocd.py
@@ -74,7 +74,7 @@
self.openocd_cmd = [cfg.openocd or 'openocd'] + search_args
# openocd doesn't cope with Windows path names, so convert
# them to POSIX style just to be sure.
- self.elf_name = Path(cfg.elf_file).as_posix()
+ self.elf_name = Path(cfg.elf_file).as_posix() if cfg.elf_file else None
self.pre_init = pre_init or []
self.reset_halt_cmd = reset_halt_cmd
self.pre_load = pre_load or []