runners: pyocd: Add support for .elf files to the pyocd flash command
As the .bin & .hex build output is optional and it can be disabled by CONFIG_BUILD_OUTPUT_BIN/HEX, add support for the mandatory .elf build output to the pyocd runner flash command. Signed-off-by: Andrej Butok <andrey.butok@nxp.com>
This commit is contained in:
parent
fd1be9849c
commit
c1fe3150e9
1 changed files with 7 additions and 6 deletions
|
@ -148,18 +148,19 @@ class PyOcdBinaryRunner(ZephyrBinaryRunner):
|
||||||
self.debug_debugserver(command, **kwargs)
|
self.debug_debugserver(command, **kwargs)
|
||||||
|
|
||||||
def flash(self, **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):
|
if self.hex_name is not None and os.path.isfile(self.hex_name):
|
||||||
fname = 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):
|
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
|
fname = self.bin_name
|
||||||
|
elif self.elf_name is not None and os.path.isfile(self.elf_name):
|
||||||
|
fname = self.elf_name
|
||||||
else:
|
else:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
'Cannot flash; no hex ({}) or bin ({}) files found. '.format(
|
'Cannot flash; no hex ({}), bin ({}) or elf ({}) files found. '.format(
|
||||||
self.hex_name, self.bin_name))
|
self.hex_name, self.bin_name, self.elf_name))
|
||||||
|
|
||||||
erase_method = 'chip' if self.erase else 'sector'
|
erase_method = 'chip' if self.erase else 'sector'
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue