Commit e33ec242 authored by Martí Bolívar's avatar Martí Bolívar Committed by Anas Nashif
Browse files

scripts: refactor flash/debug scripts to remove "shell"



The Python-based runners have replaced the old shell scripts. Refactor
the build system accordingly:

- FLASH_SCRIPT is now BOARD_FLASH_RUNNER
- DEBUG_SCRIPT is now BOARD_DEBUG_RUNNER

The values, rather than being the names of files, are now the names of
runners in scripts/support/runner. They are still short, descriptive
names like "openocd", "jlink", "em-starterkit", etc.

Adjust the zephyr_flash_debug.py call and runner internals
accordingly. Have each runner class report a name and the commands it
can handle. This lets us move some boilerplate from each do_run()
method into the common run() routine, and enables further improvements
in future patches.

The handles_command() method is temporary, and will be replaced by a
more general mechanism for describing runner capabilities in a
subsequent patch. The initial use case for extending this is to add
device tree awareness to the runners.

To try to avoid user confusion, abort the configuration if an
xxx_SCRIPT is defined.

Signed-off-by: default avatarMarti Bolivar <marti@opensourcefoundries.com>
parent f8e0a0c5
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU})
  set(FLASH_SCRIPT dfuutil.sh)
  set(BOARD_FLASH_RUNNER dfu-util)

  set(DFUUTIL_PID 8087:0aba)
  set(DFUUTIL_ALT sensor_core)
@@ -11,10 +11,10 @@ if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU})
    DFUUTIL_IMG
    )
else()
  set(FLASH_SCRIPT openocd.sh)
  set(BOARD_FLASH_RUNNER openocd)
endif()

set(DEBUG_SCRIPT openocd.sh)
set(BOARD_DEBUG_RUNNER openocd)

set(OPENOCD_PRE_CMD "targets 1")
set(OPENOCD_LOAD_CMD "load_image     ${PROJECT_BINARY_DIR}/${KERNEL_BIN_NAME} ${CONFIG_FLASH_BASE_ADDRESS}")
+2 −2
Original line number Diff line number Diff line
set(FLASH_SCRIPT arc_debugger.sh)
set(DEBUG_SCRIPT arc_debugger.sh)
set(BOARD_FLASH_RUNNER em-starterkit)
set(BOARD_DEBUG_RUNNER em-starterkit)

set(OPENOCD_LOAD_CMD "load_image     ${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME} ${CONFIG_FLASH_BASE_ADDRESS}")
set(OPENOCD_VERIFY_CMD "verify_image ${PROJECT_BINARY_DIR}/${KERNEL_ELF_NAME} ${CONFIG_FLASH_BASE_ADDRESS}")
+1 −1
Original line number Diff line number Diff line
set(FLASH_SCRIPT dfuutil.sh)
set(BOARD_FLASH_RUNNER dfu-util)

set(DFUUTIL_PID 0483:df11)
set(DFUUTIL_ALT 0)
+2 −2
Original line number Diff line number Diff line
set(FLASH_SCRIPT pyocd.sh)
set(DEBUG_SCRIPT pyocd.sh)
set(BOARD_FLASH_RUNNER pyocd)
set(BOARD_DEBUG_RUNNER pyocd)

set(PYOCD_TARGET nrf52)

+1 −1
Original line number Diff line number Diff line
if(DEFINED ENV{ZEPHYR_FLASH_OVER_DFU})
  set(FLASH_SCRIPT dfuutil.sh)
  set(BOARD_FLASH_RUNNER dfu-util)

  set(DFUUTIL_PID 8087:0aba)
  set(DFUUTIL_ALT ble_core)
Loading