build: remove flash/debug shell scripts

The functionality of the shell scripts for flashing and debugging has
now been replaced by zephyr_flash_debug.py. Remove the legacy scripts
as part of transitioning all of this to Python.

Signed-off-by: Marti Bolivar <marti.bolivar@linaro.org>
This commit is contained in:
Marti Bolivar 2017-10-24 12:40:18 -04:00 committed by Anas Nashif
commit 81f2d21fac
14 changed files with 6 additions and 747 deletions

View file

@ -1374,30 +1374,19 @@ run:
endif
ifneq ($(FLASH_SCRIPT),)
ifeq ($(USE_ZEPHYR_FLASH_DEBUG_SHELL),)
flash: zephyr
@echo "Flashing $(BOARD_NAME)"
$(Q)$(srctree)/scripts/support/zephyr_flash_debug.py flash $(srctree)/scripts/support/$(FLASH_SCRIPT)
else
flash: zephyr
@echo "Flashing $(BOARD_NAME)"
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/support/$(FLASH_SCRIPT) flash
endif
else
flash: FORCE
@echo Flashing not supported with this board.
@echo Please check the documentation for alternate instructions.
endif
ifneq ($(DEBUG_SCRIPT),)
ifeq ($(USE_ZEPHYR_FLASH_DEBUG_SHELL),)
debug: zephyr
$(Q)$(srctree)/scripts/support/zephyr_flash_debug.py debug $(srctree)/scripts/support/$(DEBUG_SCRIPT)
else
debug: zephyr
$(Q)$(CONFIG_SHELL) $(srctree)/scripts/support/$(DEBUG_SCRIPT) debug
endif
else
debug: FORCE
@echo Debugging not supported with this board.
@echo Please check the documentation for alternate instructions.

View file

@ -100,14 +100,9 @@ export BOARD_NAME
endif
ifneq ($(DEBUG_SCRIPT),)
ifeq ($(USE_ZEPHYR_FLASH_DEBUG_SHELL),)
debugserver: FORCE
$(Q)$(ZEPHYR_BASE)/scripts/support/zephyr_flash_debug.py debugserver $(ZEPHYR_BASE)/scripts/support/$(DEBUG_SCRIPT)
else
debugserver: FORCE
$(Q)$(CONFIG_SHELL) $(ZEPHYR_BASE)/scripts/support/$(DEBUG_SCRIPT) debugserver
endif
else
debugserver: FORCE
@echo Debugging not supported with this board.
@echo Please check the documentation for alternate instructions.

View file

@ -1,127 +0,0 @@
#!/bin/sh
# This script is loosly based on a script with same purpose provided
# by RIOT-OS (https://github.com/RIOT-OS/RIOT)
OPENOCD=${OPENOCD:-openocd}
OPENOCD_CMD="${OPENOCD}${OPENOCD_DEFAULT_PATH:+ -s $OPENOCD_DEFAULT_PATH}"
OPENOCD_CONFIG=${ZEPHYR_BASE}/boards/${ARCH}/${BOARD_NAME}/support/openocd.cfg
BIN_NAME=${O}/${KERNEL_BIN_NAME}
ELF_NAME=${O}/${KERNEL_ELF_NAME}
test_config() {
if [ ! -f "${OPENOCD_CONFIG}" ]; then
echo "Error: Unable to locate OpenOCD configuration file: ${OPENOCD_CONFIG}"
exit 1
fi
if ! which ${OPENOCD} >/dev/null 2>&1; then
echo "Error: Unable to locate OpenOCD executable: ${OPENOCD}"
exit 1
fi
}
test_bin() {
if [ ! -f "${BIN_NAME}" ]; then
echo "Error: Unable to locate image binary: ${BIN_NAME}"
exit 1
fi
}
do_flash() {
test_config
test_bin
# flash device with specified image
# setsid is needed so that Ctrl+C in GDB doesn't kill OpenOCD
[ -z "${SETSID}" ] && SETSID="$(which setsid)"
# temporary file that saves OpenOCD pid
OCD_PIDFILE=$(mktemp -t "openocd_pid.XXXXXXXXXX")
# cleanup after script terminates
trap "cleanup ${OCD_PIDFILE}" EXIT
# don't trap on Ctrl+C, because GDB keeps running
trap '' INT
# start OpenOCD as GDB server
${SETSID} sh -c "${OPENOCD_CMD} -f '${OPENOCD_CONFIG}' \
${OPENOCD_EXTRA_INIT} \
-c 'tcl_port ${TCL_PORT:-6333}' \
-c 'telnet_port ${TELNET_PORT:-4444}' \
-c 'gdb_port ${GDB_PORT:-3333}' \
-c 'init' \
-c 'targets' \
-c 'halt' \
& \
echo \$! > $OCD_PIDFILE" &
# connect to the GDB server
${GDB} ${TUI} -ex "target remote :${GDB_PORT:-3333}" \
-ex "load" -ex "c" ${ELF_NAME}
# will be called by trap
cleanup() {
OCD_PID="$(cat $OCD_PIDFILE)"
kill ${OCD_PID} &>/dev/null
rm -f "$OCD_PIDFILE"
exit 0
}
}
do_debug() {
test_config
test_bin
# setsid is needed so that Ctrl+C in GDB doesn't kill OpenOCD
[ -z "${SETSID}" ] && SETSID="$(which setsid)"
# temporary file that saves OpenOCD pid
OCD_PIDFILE=$(mktemp -t "openocd_pid.XXXXXXXXXX")
# cleanup after script terminates
trap "cleanup ${OCD_PIDFILE}" EXIT
# don't trap on Ctrl+C, because GDB keeps running
trap '' INT
# start OpenOCD as GDB server
${SETSID} sh -c "${OPENOCD_CMD} -f '${OPENOCD_CONFIG}' \
${OPENOCD_EXTRA_INIT} \
-c 'tcl_port ${TCL_PORT:-6333}' \
-c 'telnet_port ${TELNET_PORT:-4444}' \
-c 'gdb_port ${GDB_PORT:-3333}' \
-c 'init' \
-c 'targets' \
-c 'halt' \
& \
echo \$! > $OCD_PIDFILE" &
# connect to the GDB server
${GDB} ${TUI} -ex "target remote :${GDB_PORT:-3333}" -ex "load" ${ELF_NAME}
# will be called by trap
cleanup() {
OCD_PID="$(cat $OCD_PIDFILE)"
kill ${OCD_PID} &>/dev/null
rm -f "$OCD_PIDFILE"
exit 0
}
}
do_debugserver() {
test_config
sh -c "${OPENOCD_CMD} -f '${OPENOCD_CONFIG}' \
-c 'init' \
-c 'targets' \
-c 'reset halt'"
}
CMD="$1"
shift
if [ "$KBUILD_VERBOSE" -eq 1 ]
then
set -x
fi
case "${CMD}" in
flash)
echo "Flashing Target Device"
do_flash "$@"
;;
debugserver)
do_debugserver "$@"
;;
debug)
do_debug "$@"
;;
esac

View file

@ -1,15 +0,0 @@
#!/bin/sh
# This script is loosly based on a script with same purpose provided
# by RIOT-OS (https://github.com/RIOT-OS/RIOT)
BOSSAC_CMD="${BOSSAC:-bossac}"
BOSSAC_PORT=${BOSSAC_PORT:-"/dev/ttyACM0"}
if [ `uname` = "Linux" ]; then
stty -F ${BOSSAC_PORT} raw ispeed 1200 ospeed 1200 cs8 \
-cstopb ignpar eol 255 eof 255
${BOSSAC_CMD} -p ${BOSSAC_PORT} -R -e -w -v -b "${O}/${KERNEL_BIN_NAME}"
else
echo "CAUTION: No flash tool for your host system found!"
fi

View file

@ -1,91 +0,0 @@
#!/bin/sh
# This script is inspired from ./openocd.sh, and from both flash_dfu.sh and
# fwversion.sh, included in arduino101-factory_recovery-flashpack.tar.bz2,
# which is available from https://downloadcenter.intel.com/download/25470
# It requires the following environment variables to be defined, typically
# exported from Makefile.board:
# - DFUUTIL_PID: vendor_ID:product_ID of the board in DFU mode
# - DFUUTIL_ALT: alternate setting name or number of the DFU interface
# - DFUUTIL_IMG: path to the binary image sent to the board
# - DFUUTIL_DFUSE_ADDR: target address, for DfuSe devices
DFUUTIL_EXE=${DFUUTIL:-dfu-util}
DFUUTIL_CMD="$DFUUTIL_EXE -d,$DFUUTIL_PID"
# Is DFUUTIL_ALT a numeric value?
num=$(printf '%u' "$DFUUTIL_ALT" 2>/dev/null)
if [ $? -eq 0 -a "$num" = "$DFUUTIL_ALT" ]; then
# alternate setting number
pattern=", alt=$DFUUTIL_ALT,"
else
# alternate setting name
pattern=", name=\"$DFUUTIL_ALT\","
fi
test_exe() {
if ! which $DFUUTIL_EXE >/dev/null 2>&1; then
echo "Error: Unable to locate dfu-util executable: $DFUUTIL_EXE"
exit 1
fi
}
test_img() {
if [ ! -f "$DFUUTIL_IMG" ]; then
echo "Error: Unable to locate binary image: $DFUUTIL_IMG"
exit 1
fi
}
find_dfu() {
$DFUUTIL_CMD -l |grep "$pattern" >/dev/null 2>&1
}
do_flash() {
test_exe
test_img
# Wait until DFU device is ready
reset_dfu=0
if ! find_dfu; then
reset_dfu=1
echo "Please reset your board to switch to DFU mode..."
until find_dfu; do
sleep 0.1
done
fi
# Allow DfuSe based devices by checking for DFUUTIL_DFUSE_ADDR
if [ -n "${DFUUTIL_DFUSE_ADDR}" ]; then
DFUUTIL_CMD="${DFUUTIL_CMD} -s ${DFUUTIL_DFUSE_ADDR}:leave"
fi
# Flash DFU device with specified image
# Do NOT reset with -R, to avoid random 'error resetting after download'
$DFUUTIL_CMD -a "$DFUUTIL_ALT" -D $DFUUTIL_IMG
ok=$?
if [ $ok -eq 0 -a $reset_dfu -eq 1 ]; then
echo "Now reset your board again to switch back to runtime mode."
fi
return $ok
}
if [ "$KBUILD_VERBOSE" -eq 1 ]
then
set -x
fi
CMD=$1
shift
case "$CMD" in
flash)
do_flash "$@"
;;
*)
echo "Unsupported command '$CMD'"
exit 1
;;
esac

View file

@ -1,50 +0,0 @@
#!/bin/bash
ESP_DEVICE=${ESP_DEVICE:-/dev/ttyUSB0}
ESP_BAUD_RATE=${ESP_BAUD_RATE:-921600}
ESP_FLASH_SIZE=${ESP_FLASH_SIZE:-detect}
ESP_FLASH_FREQ=${ESP_FLASH_FREQ:-40m}
ESP_FLASH_MODE=${ESP_FLASH_MODE:-dio}
ESP_TOOL=${ESP_TOOL:-espidf}
cmd_flash() {
local esptool
local elf_name=${O}/${KERNEL_ELF_NAME}
if [ "x${ESP_TOOL}" = "xespidf" ]; then
esptool=${ESP_IDF_PATH}/components/esptool_py/esptool/esptool.py
else
esptool=${ESP_TOOL}
fi
if [ ! -x ${esptool} ]; then
echo "esptool could not be found at ${esptool}"
exit 1
fi
echo "Converting ELF to BIN"
${esptool} --chip esp32 elf2image ${elf_name}
echo "Flashing ESP32 on ${ESP_DEVICE} (${ESP_BAUD_RATE}bps)"
${esptool} --chip esp32 \
--port ${ESP_DEVICE} \
--baud ${ESP_BAUD_RATE} \
--before default_reset \
--after hard_reset \
write_flash \
-u \
--flash_mode ${ESP_FLASH_MODE} \
--flash_freq ${ESP_FLASH_FREQ} \
--flash_size ${ESP_FLASH_SIZE} \
0x1000 ${elf_name/.elf/.bin}
}
CMD="$1"; shift
case "${CMD}" in
flash)
cmd_flash "$@"
;;
*)
echo "${CMD} not supported"
exit 1
;;
esac

View file

@ -1,68 +0,0 @@
#!/bin/sh
# This script is loosly based on a script with same purpose provided
# by RIOT-OS (https://github.com/RIOT-OS/RIOT)
JLINK_GDBSERVER=${JLINK_GDBSERVER:-JLinkGDBServer}
JLINK_IF=${JLINK_IF:-swd}
BIN_NAME=${O}/${KERNEL_BIN_NAME}
ELF_NAME=${O}/${KERNEL_ELF_NAME}
GDB_PORT=${GDB_PORT:-2331}
test_config() {
if ! which ${JLINK_GDBSERVER} >/dev/null 2>&1; then
echo "Error: Unable to locate JLink GDB server: ${JLINK_GDBSERVER}"
exit 1
fi
}
test_bin() {
if [ ! -f "${BIN_NAME}" ]; then
echo "Error: Unable to locate image binary: ${BIN_NAME}"
exit 1
fi
}
do_debug() {
do_debugserver 1 &
# connect to the GDB server
${GDB} ${TUI} ${ELF_NAME} \
-ex "target remote :${GDB_PORT}" \
-ex 'monitor halt' \
-ex 'load' \
-ex 'monitor reset'
}
do_debugserver() {
test_config
# Calling with an arg will result in setsid being used, which will prevent
# Ctrl-C in GDB from killing the server. The server automatically exits
# when the remote GDB disconnects.
if [ -n "$1" ]; then
SETSID=/usr/bin/setsid
else
SETSID=
fi
echo "JLink GDB server running on port ${GDB_PORT}"
${SETSID} ${JLINK_GDBSERVER} \
-port ${GDB_PORT} \
-if ${JLINK_IF} \
-device ${JLINK_DEVICE} \
-silent \
-singlerun
}
CMD="$1"
shift
case "${CMD}" in
debugserver)
do_debugserver "$@"
;;
debug)
do_debug "$@"
;;
esac

View file

@ -1,76 +0,0 @@
#!/bin/bash
set -e
HEX_NAME=${O}/${KERNEL_HEX_NAME}
ELF_NAME=${O}/${KERNEL_ELF_NAME}
# XXX nios2-gdb-server doesn't seem to clean up after itself properly,
# and often will report "Unable to bind (98)" when restarting a session.
# Eventually the kernel cleans things up, but it takes a couple minutes.
# Use a random port each time so this doesn't annoy users. Use netstat to
# confirm that the randomly selected port isn't being used.
GDB_TCP_PORT=
while [ -z "$GDB_TCP_PORT" ]; do
GDB_TCP_PORT=$(shuf -i1024-49151 -n1)
netstat -atn | grep "127[.]0[.]0[.]1[:]$GDB_TCP_PORT" || break
GDB_TCP_PORT=
done
REQUIRED_PROGRAMS="quartus_cpf quartus_pgm nios2-gdb-server nios2-download"
for pgm in ${REQUIRED_PROGRAMS}; do
type -P $pgm > /dev/null 2>&1 || { echo >&2 "$pgm not found in PATH"; exit 1; }
done
# XXX do_flash() and do_debug() only support cases where the .elf is sent
# over the JTAG and the CPU directly boots from __start. CONFIG_XIP and
# CONFIG_INCLUDE_RESET_VECTOR must be disabled.
do_flash() {
if [ -z "${NIOS2_CPU_SOF}" ]; then
echo "Please set NIOS2_CPU_SOF variable to location of CPU .sof data"
exit 1
fi
${ZEPHYR_BASE}/scripts/support/quartus-flash.py \
--sof ${NIOS2_CPU_SOF} \
--kernel ${HEX_NAME}
}
do_debug() {
do_debugserver 1 &
# connect to the GDB server
${GDB} ${TUI} ${ELF_NAME} -ex "target remote :${GDB_TCP_PORT}"
}
do_debugserver() {
# Calling with an arg will result in setsid being used, which will prevent
# Ctrl-C in GDB from killing the server. The server automatically exits
# when the remote GDB disconnects.
if [ -n "$1" ]; then
SETSID=/usr/bin/setsid
else
SETSID=
fi
echo "Nios II GDB server running on port ${GDB_TCP_PORT}"
${SETSID} nios2-gdb-server --tcpport ${GDB_TCP_PORT} --stop --reset-target
}
CMD="$1"
shift
case "${CMD}" in
flash)
do_flash
;;
debugserver)
do_debugserver
;;
debug)
do_debug
;;
esac

View file

@ -1,57 +0,0 @@
#!/bin/sh
HEX_NAME=${O}/${KERNEL_HEX_NAME}
command -v nrfjprog >/dev/null 2>&1 || { echo >&2 "Can't flash nRF board,"\
"nrfjprog is not installed."\
"Aborting."; exit 1; }
CONNECTED_BOARDS=`nrfjprog --ids`
read -s -a BOARD_LIST <<< $CONNECTED_BOARDS
BOARDS_NUM=`echo "$CONNECTED_BOARDS" | wc -l`
if [ $BOARDS_NUM == 1 ]
then
BOARD_SNR=$BOARD_LIST
else
echo "There are multiple boards connected."
for i in $(seq 1 1 $BOARDS_NUM)
do
echo $i. ${BOARD_LIST[$i - 1]}
done
prompt="Please select one with desired serial number (1-$BOARDS_NUM):"
while true; do
read -p "$prompt" ANS
if [ 1 -le $ANS -a $ANS -le $BOARDS_NUM ]
then
break;
else
echo -n
fi
done
BOARD_SNR=${BOARD_LIST[$ANS - 1]}
fi
echo "Flashing file: "${HEX_NAME}
nrfjprog --eraseall -f $NRF_FAMILY --snr $BOARD_SNR &&
nrfjprog --program $HEX_NAME -f $NRF_FAMILY --snr $BOARD_SNR &&
if [ $NRF_FAMILY == NRF52 ]
then
# Set reset pin
nrfjprog --memwr 0x10001200 --val 0x00000015 \
-f $NRF_FAMILY --snr $BOARD_SNR
nrfjprog --memwr 0x10001204 --val 0x00000015 \
-f $NRF_FAMILY --snr $BOARD_SNR
nrfjprog --reset -f $NRF_FAMILY --snr $BOARD_SNR
fi
nrfjprog --pinreset -f $NRF_FAMILY --snr $BOARD_SNR
if [ $? -eq 0 ]; then
echo "${BOARD} Serial Number $BOARD_SNR flashed with success."
else
echo "Flashing ${BOARD} failed."
exit 2;
fi

View file

@ -1,109 +0,0 @@
#!/bin/sh
# This script is loosly based on a script with same purpose provided
# by RIOT-OS (https://github.com/RIOT-OS/RIOT)
OPENOCD=${OPENOCD:-openocd}
OPENOCD_CMD="${OPENOCD}${OPENOCD_DEFAULT_PATH:+ -s $OPENOCD_DEFAULT_PATH}"
OPENOCD_CONFIG=${ZEPHYR_BASE}/boards/${ARCH}/${BOARD_NAME}/support/openocd.cfg
BIN_NAME=${O}/${KERNEL_BIN_NAME}
ELF_NAME=${O}/${KERNEL_ELF_NAME}
test_config() {
if [ ! -f "${OPENOCD_CONFIG}" ]; then
echo "Error: Unable to locate OpenOCD configuration file: ${OPENOCD_CONFIG}"
exit 1
fi
if ! which ${OPENOCD} >/dev/null 2>&1; then
echo "Error: Unable to locate OpenOCD executable: ${OPENOCD}"
exit 1
fi
}
test_bin() {
if [ ! -f "${BIN_NAME}" ]; then
echo "Error: Unable to locate image binary: ${BIN_NAME}"
exit 1
fi
}
do_flash() {
test_config
test_bin
# flash device with specified image
sh -c "${OPENOCD_CMD} -f '${OPENOCD_CONFIG}' \
-c 'init' \
-c 'targets' \
${OPENOCD_PRE_CMD:+-c $OPENOCD_PRE_CMD} \
-c 'reset halt' \
-c ${OPENOCD_LOAD_CMD} \
-c 'reset halt' \
-c ${OPENOCD_VERIFY_CMD} \
${OPENOCD_POST_CMD:+-c $OPENOCD_POST_CMD} \
-c 'reset run' \
-c 'shutdown'"
}
do_debug() {
test_config
test_bin
# setsid is needed so that Ctrl+C in GDB doesn't kill OpenOCD
[ -z "${SETSID}" ] && SETSID="$(which setsid)"
# temporary file that saves OpenOCD pid
OCD_PIDFILE=$(mktemp -t "openocd_pid.XXXXXXXXXX")
# cleanup after script terminates
trap "cleanup ${OCD_PIDFILE}" EXIT
# don't trap on Ctrl+C, because GDB keeps running
trap '' INT
# start OpenOCD as GDB server
${SETSID} sh -c "${OPENOCD_CMD} -f '${OPENOCD_CONFIG}' \
${OPENOCD_EXTRA_INIT} \
-c 'tcl_port ${TCL_PORT:-6333}' \
-c 'telnet_port ${TELNET_PORT:-4444}' \
-c 'gdb_port ${GDB_PORT:-3333}' \
-c 'init' \
-c 'targets' \
-c 'halt' \
& \
echo \$! > $OCD_PIDFILE" &
# connect to the GDB server
${GDB} ${TUI} -ex "target remote :${GDB_PORT:-3333}" ${ELF_NAME}
# will be called by trap
cleanup() {
OCD_PID="$(cat $OCD_PIDFILE)"
kill ${OCD_PID} &>/dev/null
rm -f "$OCD_PIDFILE"
exit 0
}
}
do_debugserver() {
test_config
sh -c "${OPENOCD_CMD} -f '${OPENOCD_CONFIG}' \
-c 'init' \
-c 'targets' \
-c 'reset halt'"
}
CMD="$1"
shift
if [ "$KBUILD_VERBOSE" -eq 1 ]
then
set -x
fi
case "${CMD}" in
flash)
echo "Flashing Target Device"
do_flash "$@"
;;
debugserver)
do_debugserver "$@"
;;
debug)
do_debug "$@"
;;
esac

View file

@ -1,90 +0,0 @@
#!/bin/sh
# This script is loosly based on a script with same purpose provided
# by RIOT-OS (https://github.com/RIOT-OS/RIOT)
PYOCD_FLASHTOOL=${PYOCD_FLASHTOOL:-pyocd-flashtool}
PYOCD_GDBSERVER=${PYOCD_GDBSERVER:-pyocd-gdbserver}
BIN_NAME=${O}/${KERNEL_BIN_NAME}
ELF_NAME=${O}/${KERNEL_ELF_NAME}
GDB_PORT=${GDB_PORT:-3333}
PYOCD_BOARD_ID_ARG=""
if [ -n "${PYOCD_BOARD_ID}" ]; then
PYOCD_BOARD_ID_ARG="-b ${PYOCD_BOARD_ID}"
fi
PYOCD_DAPARG_ARG=""
if [ -n "${PYOCD_DAPARG}" ]; then
PYOCD_DAPARG_ARG="-da ${PYOCD_DAPARG}"
fi
test_config() {
if ! which ${PYOCD_FLASHTOOL} >/dev/null 2>&1; then
echo "Error: Unable to locate pyOCD flash tool: ${PYOCD_FLASHTOOL}"
exit 1
fi
if ! which ${PYOCD_GDBSERVER} >/dev/null 2>&1; then
echo "Error: Unable to locate pyOCD GDB server: ${PYOCD_GDBSERVER}"
exit 1
fi
}
test_bin() {
if [ ! -f "${BIN_NAME}" ]; then
echo "Error: Unable to locate image binary: ${BIN_NAME}"
exit 1
fi
}
do_flash() {
test_config
test_bin
# flash device with specified image
echo "Flashing Target Device"
${PYOCD_FLASHTOOL} ${PYOCD_DAPARG_ARG} -t ${PYOCD_TARGET} \
${PYOCD_BOARD_ID_ARG} ${BIN_NAME}
}
do_debug() {
do_debugserver 1 &
# connect to the GDB server
${GDB} ${TUI} ${ELF_NAME} \
-ex "target remote :${GDB_PORT}" \
-ex 'load' \
-ex 'monitor reset halt'
}
do_debugserver() {
test_config
# Calling with an arg will result in setsid being used, which will prevent
# Ctrl-C in GDB from killing the server. The server automatically exits
# when the remote GDB disconnects.
if [ -n "$1" ]; then
SETSID=/usr/bin/setsid
else
SETSID=
fi
echo "pyOCD GDB server running on port ${GDB_PORT}"
${SETSID} ${PYOCD_GDBSERVER} ${PYOCD_DAPARG_ARG} -p ${GDB_PORT} \
-t ${PYOCD_TARGET} ${PYOCD_BOARD_ID_ARG}
}
CMD="$1"
shift
case "${CMD}" in
flash)
do_flash "$@"
;;
debugserver)
do_debugserver "$@"
;;
debug)
do_debug "$@"
;;
esac

View file

@ -1,16 +0,0 @@
#!/bin/sh
# Just a place holder for any custimizations.
do_debugserver() {
echo "Detached GDB server"
}
CMD="$1"
shift
case "${CMD}" in
debugserver)
do_debugserver "$@"
;;
esac

View file

@ -1,23 +0,0 @@
#!/bin/bash
XT_GDB=$XCC_TOOLS/bin/xt-gdb
ELF_NAME=${O}/${KERNEL_ELF_NAME}
set -e
do_debug() {
${XT_GDB} ${ELF_NAME}
}
CMD="$1"
shift
case "${CMD}" in
debug)
do_debug "$@"
;;
*)
echo "${CMD} not supported"
exit 1
;;
esac

View file

@ -6,13 +6,12 @@
"""Zephyr flash/debug script
This script is a transparent replacement for existing Zephyr flash and debug
scripts, i.e. scripts to flash binaries, run them, and debug them on real or
emulated hardware. If it can invoke the relevant tools natively, it will do so;
otherwise, it delegates to the shell script."""
This script is a transparent replacement for legacy Zephyr flash and
debug scripts which have now been removed. It will be refactored over
time as the rest of the build system is taught to use it.
"""
from os import path
import subprocess
import sys
from runner.core import ZephyrBinaryRunner, get_env_bool_or
@ -33,11 +32,9 @@ def run(shell_script_full, command, debug):
command,
debug)
except ValueError:
# Unsupported; fall back on shell script.
print('Unsupported, falling back on shell script',
print('Unrecognized shell script {}'.format(shell_script_full),
file=sys.stderr)
subprocess.check_call([shell_script_full, command])
return
raise
runner.run(command)