1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-24 15:28:10 +00:00
trezor-firmware/emu.sh

45 lines
1023 B
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
EXE=vendor/micropython/unix/micropython
OPTLEVEL="${OPTLEVEL:-0}"
2016-06-12 23:24:47 +00:00
MAIN="${MAIN:-main.py}"
BROWSER="${BROWSER:-chromium}"
if file $EXE | grep -q 80386 ; then
HEAPSIZE="${HEAPSIZE:-100000}"
else
HEAPSIZE="${HEAPSIZE:-1000000}"
fi
2016-06-12 23:24:47 +00:00
ARGS="-O${OPTLEVEL} -X heapsize=${HEAPSIZE}"
2016-03-29 10:41:06 +00:00
cd `dirname $0`/src
2016-06-12 23:24:47 +00:00
case "$1" in
"-d")
shift
gdb --args ../$EXE $ARGS $* $MAIN
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