-PROG = mbed
-OBJS = main.o test.o serial_dma.o timer_dma.o
+# Common settings
+UART0 = /dev/ttyACM0
+UART1 = /dev/ttyACM1
+CLEAN = control tags
CPPFLAGS =
LDFLAGS = -lm
-default: info install
+# Common rules
+default: all
+
+all: mbed.elf tester.elf control
+
+terms:
+ test -c $(UART0) && term $(UART0) &
+ test -c $(UART1) && term $(UART1) &
dist:
zip mbed.zip makefile ../common.mk *.{c,cpp,h} */*.{cpp,.h}
+# Primary mbed (mbed1/mbed2)
+mbed.elf: main.o serial_irq.o serial_dma.o timer_dma.o
+
+mbed-run: mbed.bin control install.sh
+ @./install.sh $<
+ @./control $(UART0) 1
+ @./control $(UART1) 2 sync
+
+# Testing mbed (mbed3)
+tester.elf: tester.o
+
+tester-run: tester.bin install.sh
+ @./install.sh $< /dev/sdb /mnt/usb
+
+# Controls programs
+control: control.c messages.h
+ gcc -Wall -o $@ $<
+
-include ../config.mk
-include ../common.mk