Skip to content
Permalink
Browse files

scripts: openocd: allow to overwrite elf file used to flash device

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 Jul 27, 2019
1 parent ed10c90 commit 6778468c734da9a8f5907a03f94d56196a5f972c
Showing with 4 additions and 7 deletions.
  1. +2 −5 boards/common/openocd.board.cmake
  2. +2 −2 scripts/west_commands/runners/openocd.py
@@ -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}"
@@ -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'])

0 comments on commit 6778468

Please sign in to comment.
You can’t perform that action at this time.