2016-03-29 10:41:06 +00:00
|
|
|
#!/bin/bash
|
2016-06-12 23:24:47 +00:00
|
|
|
|
2016-11-16 22:45:56 +00:00
|
|
|
source emu.config 2>/dev/null
|
|
|
|
|
2017-08-07 14:56:41 +00:00
|
|
|
EXE=build/unix/micropython
|
2016-11-16 22:45:56 +00:00
|
|
|
OPTLEVEL="${OPTLEVEL:-0}"
|
2016-06-12 23:24:47 +00:00
|
|
|
MAIN="${MAIN:-main.py}"
|
|
|
|
BROWSER="${BROWSER:-chromium}"
|
2017-04-19 19:39:44 +00:00
|
|
|
if file $EXE | grep -q 80386 ; then
|
2017-11-06 13:56:16 +00:00
|
|
|
HEAPSIZE="${HEAPSIZE:-163K}"
|
2017-04-19 19:39:44 +00:00
|
|
|
else
|
2017-11-06 13:56:16 +00:00
|
|
|
HEAPSIZE="${HEAPSIZE:-326K}"
|
2017-04-19 19:39:44 +00:00
|
|
|
fi
|
2016-06-12 23:24:47 +00:00
|
|
|
|
2016-11-16 22:45:56 +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
|
2017-04-19 19:39:44 +00:00
|
|
|
gdb --args ../$EXE $ARGS $* $MAIN
|
2016-06-12 23:24:47 +00:00
|
|
|
;;
|
2016-11-17 12:08:49 +00:00
|
|
|
"-r")
|
|
|
|
shift
|
|
|
|
while true; do
|
2017-04-19 19:39:44 +00:00
|
|
|
../$EXE $ARGS $* $MAIN &
|
2016-11-17 12:08:49 +00:00
|
|
|
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
|
2017-04-19 19:39:44 +00:00
|
|
|
../$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
|
|
|
|
;;
|
|
|
|
*)
|
2017-04-19 19:39:44 +00:00
|
|
|
../$EXE $ARGS $* $MAIN
|
2016-06-12 23:24:47 +00:00
|
|
|
esac
|