msp4th: PC testing wrapper + make target
authorDan White <dan@whiteaudio.com>
Tue, 14 May 2013 19:24:49 +0000 (14:24 -0500)
committerDan White <dan@whiteaudio.com>
Tue, 14 May 2013 19:24:49 +0000 (14:24 -0500)
msp4th/Makefile
msp4th/pc4th [new file with mode: 0755]

index 15d2e474af17b89626c19232a387e95cb5105b9a..2ec2a1398ab57a98656efa5636d43c379c4b21c1 100644 (file)
@@ -133,8 +133,8 @@ bootrom.rcf: $(SOURCES) flashboot.s
        $(MAKE) -B DEFINE=-DBOOTROM LDSCRIPT=ldscript_ns430_bootrom all
        ../ihex2rcf.py --width=16 --start=0x3000 --length=0x1000 --default=0x0000 main.hex > $@
 
-pc4th: test4th.c msp4th.c msp4th.h
-       gcc -Wall -o pc4th test4th.c msp4th.c
+_pc4th: test4th.c msp4th.c msp4th.h
+       gcc -Wall -o _pc4th test4th.c msp4th.c
 
 .PHONY:        flash
 flash: $(TARGET).hex
@@ -147,5 +147,5 @@ clean:
        $(RM) $(TARGET).{elf,hex,txt,map,xout}
        $(RM) $(SOURCES:.c=.lst)
        $(RM) $(DEPEND)
-       $(RM) pc4th
+       $(RM) _pc4th
 
diff --git a/msp4th/pc4th b/msp4th/pc4th
new file mode 100755 (executable)
index 0000000..5d1b5a9
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+make _pc4th >/dev/null && (
+    OLD_STTY=$(stty -g)
+    stty cbreak
+    stty -echo
+    stty -icrnl
+
+    if [ "$1" == "" ]; then
+        ./_pc4th
+    else
+        ./_pc4th < $1
+    fi
+
+    stty "$OLD_STTY"
+    )