Skip to content

Commit

Permalink
minimal/Makefile: Avoid terminal reset, use BUILD variable.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
musteresel authored and dpgeorge committed Aug 11, 2022
1 parent f3285fe commit 9c6fd97
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions ports/minimal/Makefile
Expand Up @@ -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"
Expand Down

0 comments on commit 9c6fd97

Please sign in to comment.