From 9c6fd974f769ef1e907c1a41f4a5d9b1c1774df7 Mon Sep 17 00:00:00 2001 From: Daniel Jour Date: Sun, 31 Jul 2022 18:01:13 +0200 Subject: [PATCH] minimal/Makefile: Avoid terminal reset, use BUILD variable. stty can provide the current terminal settings, so that they can be stored in a shell variable and restored after running the firmware. This avoids the complete "blanking" of the terminal, and thus also removes the need for the sleep call. The run target now references the firmware file using the BUILD variable instead of using the hard coded "build/" path. --- ports/minimal/Makefile | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/ports/minimal/Makefile b/ports/minimal/Makefile index 169132a1a2..5ba6514c9e 100644 --- a/ports/minimal/Makefile +++ b/ports/minimal/Makefile @@ -103,12 +103,11 @@ deploy: $(BUILD)/firmware.dfu # Run emulation build on a POSIX system with suitable terminal settings run: - stty raw opost -echo - build/firmware.elf - @echo Resetting terminal... -# This sleep is useful to spot segfaults - sleep 1 - reset + @saved_=`stty -g`; \ + stty raw opost -echo; \ + $(BUILD)/firmware.elf; \ + echo "Exit status: $$?"; \ + stty $$saved_ test: $(BUILD)/firmware.elf $(Q)/bin/echo -e "print('hello world!', list(x+1 for x in range(10)), end='eol\\\\n')\\r\\n\\x04" | $(BUILD)/firmware.elf | tail -n2 | grep "^hello world! \\[1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\]eol"