Skip to content

Commit

Permalink
scripts: openocd: allow to overwrite elf file used to flash device
Browse files Browse the repository at this point in the history
So far zephyr.elf file was hardcoded in cmake files. Remove it from
there and use cfg.elf_file from python, which can be overwritten by
specifying --elf-file command line option.

Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com>
  • Loading branch information
mniestroj authored and carlescufi committed Aug 8, 2019
1 parent ed10c90 commit 6778468
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 2 additions & 5 deletions boards/common/openocd.board.cmake
Expand Up @@ -13,11 +13,8 @@ else()
set_ifndef(OPENOCD_FLASH "flash write_image erase")
endif()

# zephyr.elf, or something else?
set_ifndef(OPENOCD_IMAGE "${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME}")

set(OPENOCD_CMD_LOAD_DEFAULT "${OPENOCD_FLASH} ${OPENOCD_IMAGE}")
set(OPENOCD_CMD_VERIFY_DEFAULT "verify_image ${OPENOCD_IMAGE}")
set(OPENOCD_CMD_LOAD_DEFAULT "${OPENOCD_FLASH}")
set(OPENOCD_CMD_VERIFY_DEFAULT "verify_image")

board_finalize_runner_args(openocd
--cmd-load "${OPENOCD_CMD_LOAD_DEFAULT}"
Expand Down
4 changes: 2 additions & 2 deletions scripts/west_commands/runners/openocd.py
Expand Up @@ -114,9 +114,9 @@ def do_flash(self, **kwargs):
'-c', 'targets'] +
pre_cmd +
['-c', 'reset halt',
'-c', self.load_cmd,
'-c', self.load_cmd + ' ' + self.elf_name,
'-c', 'reset halt',
'-c', self.verify_cmd] +
'-c', self.verify_cmd + ' ' + self.elf_name] +
post_cmd +
['-c', 'reset run',
'-c', 'shutdown'])
Expand Down

0 comments on commit 6778468

Please sign in to comment.