1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-28 00:58:09 +00:00
trezor-firmware/core/emu.sh

39 lines
791 B
Bash
Raw Normal View History

2019-05-28 08:19:18 +00:00
#!/bin/sh
2016-06-12 23:24:47 +00:00
2019-05-28 08:19:18 +00:00
if [ -f emu.config ]; then
. emu.config
fi
2017-08-07 14:56:41 +00:00
EXE=build/unix/micropython
PYOPT="${PYOPT:-1}"
2019-05-03 19:28:24 +00:00
MAIN="${MAIN:-src/main.py}"
2018-10-09 12:35:52 +00:00
HEAPSIZE="${HEAPSIZE:-50M}"
2016-06-12 23:24:47 +00:00
ARGS="-O${PYOPT} -X heapsize=${HEAPSIZE}"
2019-05-03 19:28:24 +00:00
cd `dirname $0`
2016-06-12 23:24:47 +00:00
case "$1" in
"-d")
shift
2018-10-09 12:35:52 +00:00
OPERATING_SYSTEM=$(uname)
2019-05-28 08:19:18 +00:00
if [ "$OPERATING_SYSTEM" = "Darwin" ]; then
2019-05-03 19:28:24 +00:00
PATH=/usr/bin /usr/bin/lldb -f $EXE -- $ARGS $* $MAIN
2018-10-09 12:35:52 +00:00
else
2019-05-03 19:28:24 +00:00
gdb --args $EXE $ARGS $* $MAIN
2018-10-09 12:35:52 +00:00
fi
2016-06-12 23:24:47 +00:00
;;
"-r")
shift
while true; do
2019-05-03 19:28:24 +00:00
$EXE $ARGS $* $MAIN &
UPY_PID=$!
find -name '*.py' | inotifywait -q -e close_write --fromfile -
echo Restarting ...
kill $UPY_PID
done
;;
2016-06-12 23:24:47 +00:00
*)
2019-05-03 19:28:24 +00:00
$EXE $ARGS $* $MAIN
2016-06-12 23:24:47 +00:00
esac