diff --git a/scripts/west_commands/runners/pyocd.py b/scripts/west_commands/runners/pyocd.py index 793da476320..d754291d915 100644 --- a/scripts/west_commands/runners/pyocd.py +++ b/scripts/west_commands/runners/pyocd.py @@ -148,18 +148,19 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner): self.debug_debugserver(command, **kwargs) def flash(self, **kwargs): + # Use hex, bin or elf file provided by the buildsystem. + # Preferring .hex over .bin and .elf if self.hex_name is not None and os.path.isfile(self.hex_name): fname = self.hex_name + # Preferring .bin over .elf elif self.bin_name is not None and os.path.isfile(self.bin_name): - self.logger.warning( - 'hex file ({}) does not exist; falling back on .bin ({}). '. - format(self.hex_name, self.bin_name) + - 'Consider enabling CONFIG_BUILD_OUTPUT_HEX.') fname = self.bin_name + elif self.elf_name is not None and os.path.isfile(self.elf_name): + fname = self.elf_name else: raise ValueError( - 'Cannot flash; no hex ({}) or bin ({}) files found. '.format( - self.hex_name, self.bin_name)) + 'Cannot flash; no hex ({}), bin ({}) or elf ({}) files found. '.format( + self.hex_name, self.bin_name, self.elf_name)) erase_method = 'chip' if self.erase else 'sector'