Skip to content

Commit

Permalink
west: linkserver: Add ELF file support to flash command
Browse files Browse the repository at this point in the history
For files with multiple regions use ELF file instead so that all regions
get flashed

Signed-off-by: Peter van der Perk <[email protected]>
  • Loading branch information
PetervdPerk-NXP authored and PetervdPerk committed Jul 4, 2024
1 parent 574f939 commit a489b90
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/west_commands/runners/linkserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,11 @@ def flash(self, **kwargs):
if self.erase:
self.do_erase()

# Use .hex or .bin, preferring .hex over .bin
# Use .elf, .hex or .bin, preferring .hex over .elf over .bin
if self.supports_hex and self.hex_name is not None and os.path.isfile(self.hex_name):
flash_cmd = (["load", self.hex_name])
elif self.elf_name is not None and os.path.isfile(self.elf_name):
flash_cmd = (["load", self.elf_name])
elif self.bin_name is not None and os.path.isfile(self.bin_name):
if self.dt_flash:
load_addr = self.flash_address_from_build_conf(self.build_conf)
Expand All @@ -199,8 +201,8 @@ def flash(self, **kwargs):

flash_cmd = (["load", "--addr", str(load_addr), self.bin_name])
else:
err = 'Cannot flash; no hex ({}) or bin ({}) file found.'
raise ValueError(err.format(self.hex_name, self.bin_name))
err = 'Cannot flash; no hex ({}), elf ({}) or bin ({}) file found.'
raise ValueError(err.format(self.hex_name, self.elf_name, self.bin_name))

# Flash the selected file
linkserver_cmd = linkserver_cmd + flash_cmd
Expand Down

0 comments on commit a489b90

Please sign in to comment.