~aleteoryx/muditaos

18fdf152bd106c6282a7ebe016f6f496735ffc1c — Mateusz Grzegorzek 4 years ago ec7dcfb
[BH-742] Handle different products in run script

Handle different products in run script
2 files changed, 23 insertions(+), 13 deletions(-)

M config/common.sh
M run.sh
M config/common.sh => config/common.sh +3 -6
@@ 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`

M run.sh => run.sh +20 -7
@@ 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