1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-27 00:28:10 +00:00
trezor-firmware/emu.sh
2018-09-20 15:04:12 +02:00

42 lines
972 B
Bash
Executable File

#!/bin/bash
source emu.config 2>/dev/null
EXE=build/unix/micropython
PYOPT="${PYOPT:-1}"
MAIN="${MAIN:-main.py}"
BROWSER="${BROWSER:-chromium}"
HEAPSIZE="${HEAPSIZE:-800K}"
SOURCE_PY_DIR="${SOURCE_PY_DIR:-src}"
ARGS="-O${PYOPT} -X heapsize=${HEAPSIZE}"
cd `dirname $0`/$SOURCE_PY_DIR
case "$1" in
"-d")
shift
gdb --args ../$EXE $ARGS $* $MAIN
;;
"-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
;;
"-p")
shift
../$EXE $ARGS $* $MAIN &
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
esac