1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-15 20:19:23 +00:00
trezor-firmware/emu.sh

47 lines
1.1 KiB
Bash
Raw Normal View History

2016-03-29 10:41:06 +00:00
#!/bin/bash
2016-06-12 23:24:47 +00:00
source emu.config 2>/dev/null
2017-08-07 14:56:41 +00:00
EXE=build/unix/micropython
PYOPT="${PYOPT:-1}"
2018-10-09 12:35:52 +00:00
MAIN="${MAIN:-${PWD}/src/main.py}"
2016-06-12 23:24:47 +00:00
BROWSER="${BROWSER:-chromium}"
2018-10-09 12:35:52 +00:00
HEAPSIZE="${HEAPSIZE:-50M}"
SOURCE_PY_DIR="${SOURCE_PY_DIR:-src}"
2016-06-12 23:24:47 +00:00
ARGS="-O${PYOPT} -X heapsize=${HEAPSIZE}"
cd `dirname $0`/$SOURCE_PY_DIR
2016-06-12 23:24:47 +00:00
case "$1" in
"-d")
shift
2018-10-09 12:35:52 +00:00
OPERATING_SYSTEM=$(uname)
if [ $OPERATING_SYSTEM == "Darwin" ]; then
PATH=/usr/bin /usr/bin/lldb -f ../$EXE -- $ARGS $* $MAIN
else
gdb --args ../$EXE $ARGS $* $MAIN
fi
2016-06-12 23:24:47 +00:00
;;
"-r")
shift
while true; do
../$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
"-p")
shift
../$EXE $ARGS $* $MAIN &
2016-06-12 23:24:47 +00:00
perf record -F 100 -p $! -g -- sleep 600
perf script > perf.trace
../vendor/flamegraph/stackcollapse-perf.pl perf.trace | ../vendor/flamegraph/flamegraph.pl > perf.svg
$BROWSER perf.svg
;;
*)
../$EXE $ARGS $* $MAIN
2016-06-12 23:24:47 +00:00
esac