1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-21 22:08:08 +00:00
trezor-firmware/core/emu.sh
2019-06-26 12:16:41 +02:00

36 lines
916 B
Bash
Executable File

#!/usr/bin/env bash
MICROPYTHON="${MICROPYTHON:-${PWD}/build/unix/micropython}"
TREZOR_SRC=$(cd "${PWD}/src/"; pwd)
BROWSER="${BROWSER:-chromium}"
source ./trezor_cmd.sh
cd "${TREZOR_SRC}"
case "$1" in
"-d")
shift
OPERATING_SYSTEM=$(uname)
if [ "$OPERATING_SYSTEM" = "Darwin" ]; then
PATH=/usr/bin /usr/bin/lldb -f $MICROPYTHON -- $ARGS $* $MAIN
else
gdb --args $MICROPYTHON $ARGS $* $MAIN
fi
;;
"-r")
shift
while true; do
$MICROPYTHON $ARGS $* $MAIN &
UPY_PID=$!
find -name '*.py' | inotifywait -q -e close_write --fromfile -
echo Restarting ...
kill $UPY_PID
done
;;
*)
echo "Starting emulator: $MICROPYTHON $ARGS $* $MAIN"
$MICROPYTHON $ARGS $* $MAIN 2>&1 | tee "${TREZOR_LOGFILE}"
exit ${PIPESTATUS[0]}
esac