From 18fdf152bd106c6282a7ebe016f6f496735ffc1c Mon Sep 17 00:00:00 2001 From: Mateusz Grzegorzek Date: Fri, 6 Aug 2021 14:03:30 +0200 Subject: [PATCH] [BH-742] Handle different products in run script Handle different products in run script --- config/common.sh | 9 +++------ run.sh | 27 ++++++++++++++++++++------- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/config/common.sh b/config/common.sh index 00fcaab0691b24f50450e6ee65717f163e9e9392..9ed0e5a42fdd812ebe7b2383d4768d68e4f6cceb 100644 --- a/config/common.sh +++ b/config/common.sh @@ -19,19 +19,16 @@ IMAGE_FILES="data assets country-codes.db Luts.bin user .boot.json .boot.json.cr IMAGE_MOVE_TO_ROOT="user .boot.json .boot.json.crc32" check_any_arch() { local path="${1}" - local arch="${2}" + local product="${2}" + local arch="${3}" [ -d ${path} ] || ( echo "no such directory: ${path}" > /dev/stderr ; exit 1) - file ${path}/PurePhone.elf | grep "$arch" -q || ( echo "Bad file: $1/PurePhone.elf for selected architecture!" ; exit 1 ) + file ${path}/${product}.elf | grep "$arch" -q || ( echo "Bad file: ${path}/${product}.elf for selected architecture!" ; exit 1 ) } check_target_rt1051() { check_any_arch "${@}" 'ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), statically linked' } -check_target_linux() { - check_any_arch "${@}" '(GNU/Linux)' -} - MUDITAOS_GIT_TAG=`git describe --tags | awk -F'-' '{print $2}'` MUDITAOS_GIT_REV=`git log --pretty=format:'%h' -n 1` MUDITAOS_GIT_BRANCH=`git rev-parse --abbrev-ref HEAD` diff --git a/run.sh b/run.sh index 9655c29ebbae207b95205df933983e63713fa536..b4ad5e85bfd004a9d407a7ee0ee1d4b035a3f555 100755 --- a/run.sh +++ b/run.sh @@ -20,12 +20,14 @@ Script accepts two parameters: ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py default: gdb from your PATH + --product PARAM + product to run [PurePhone|BellHybrid] + examples: -./run.sh build-rt1051-RelWithDebInfo/ --gdb ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py // full specification -./run.sh build-rt1051-RelWithDebInfo // binary for gdb specified -./run.sh --gdb ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py // gdb binary specified -./run.sh // full defaults -./run.sh --help // help +./run.sh --product PurePhone build-purephone-rt1051-RelWithDebInfo/ --gdb ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py // full specification +./run.sh --product BellHybrid build-bell-rt1051-RelWithDebInfo // binary for gdb specified +./run.sh --product BellHybrid --gdb ~/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gdb-py // gdb binary specified +./run.sh --help // help EOF } @@ -40,6 +42,11 @@ while [[ $# -gt 0 ]]; do echo "Loaded $GDB_ARM" shift ;; + --product) + PRODUCT_NAME="$2" + echo "Product $PRODUCT_NAME" + shift + ;; --help) echo "HELP!" help @@ -54,6 +61,12 @@ while [[ $# -gt 0 ]]; do shift done -check_target_rt1051 "${BIN_DIR}" +if [ -z "${PRODUCT_NAME}" ]; then + echo "ERROR! Product param not provided" + help + exit 1 +fi + +check_target_rt1051 "${BIN_DIR}" "${PRODUCT_NAME}" -${GDB_ARM} "${BIN_DIR}"/PurePhone.elf -x .gdbinit-1051 +${GDB_ARM} "${BIN_DIR}"/"${PRODUCT_NAME}".elf -x .gdbinit-1051