Leave serial number writing to aoload
[fw/altos] / Makefile
index 5c3dccc26e82dbf2e0b9bae7fb3fa448eff3c6bb..ca296c6f0c800639682c822606a10762f02a01dd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -4,10 +4,12 @@
 # 
 CC=sdcc
 
+VERSION=$(shell git describe)
+
 CFLAGS=--model-small --debug --opt-code-speed 
 
 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
-       --xram-loc 0xf000 --xram-size 0xf00 --iram-size 0xff
+       --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
 
 INC = \
        ao.h \
@@ -33,19 +35,22 @@ ALTOS_SRC = \
 #
 ALTOS_DRIVER_SRC = \
        ao_beep.c \
+       ao_config.c \
        ao_led.c \
        ao_radio.c \
        ao_stdio.c \
        ao_usb.c
 
 TELE_COMMON_SRC = \
-       ao_gps_print.c
+       ao_gps_print.c \
+       ao_state.c
 
 #
 # Receiver code
 #
 TELE_RECEIVER_SRC =\
-       ao_monitor.c
+       ao_monitor.c \
+       ao_rssi.c
 
 #
 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
@@ -56,12 +61,21 @@ TELE_DRIVER_SRC = \
        ao_gps.c \
        ao_serial.c
 
+#
+# Drivers for partially-flled boards (TT, TD and TI)
+#
+TELE_FAKE_SRC = \
+       ao_adc_fake.c \
+       ao_ee_fake.c
+
 # 
 # Drivers only on TeleMetrum
 #
 TM_DRIVER_SRC = \
        ao_adc.c \
-       ao_ee.c
+       ao_ee.c \
+       ao_gps_report.c \
+       ao_ignite.c
 
 #
 # Tasks run on TeleMetrum
@@ -70,7 +84,9 @@ TM_TASK_SRC = \
        ao_flight.c \
        ao_log.c \
        ao_report.c \
-       ao_telemetry.c \
+       ao_telemetry.c
+
+TM_MAIN_SRC = \
        ao_telemetrum.c
 
 #
@@ -82,9 +98,10 @@ TM_SRC = \
        $(TELE_DRIVER_SRC) \
        $(TELE_COMMON_SRC) \
        $(TM_DRIVER_SRC) \
-       $(TM_TASK_SRC)
+       $(TM_TASK_SRC) \
+       $(TM_MAIN_SRC)
 
-TI_TASK_SRC = \
+TI_MAIN_SRC = \
        ao_tidongle.c
 
 #
@@ -95,9 +112,10 @@ TI_SRC = \
        $(ALTOS_DRIVER_SRC) \
        $(TELE_RECEIVER_SRC) \
        $(TELE_COMMON_SRC) \
-       $(TI_TASK_SRC)
+       $(TELE_FAKE_SRC) \
+       $(TI_MAIN_SRC)
        
-TT_TASK_SRC = \
+TT_MAIN_SRC = \
        ao_teleterra.c
 #
 # All sources for TeleTerra
@@ -108,33 +126,63 @@ TT_SRC = \
        $(TELE_RECEIVER_SRC) \
        $(TELE_DRIVER_SRC) \
        $(TELE_COMMON_SRC) \
-       $(TT_TASK_SRC)
+       $(TELE_FAKE_SRC) \
+       $(TT_MAIN_SRC)
        
        
+#
+# Sources for TeleDongle
+#
+
+TD_MAIN_SRC = \
+       ao_teledongle.c
+
+TD_SRC = \
+       $(ALTOS_SRC) \
+       $(ALTOS_DRIVER_SRC) \
+       $(TELE_RECEIVER_SRC) \
+       $(TELE_COMMON_SRC) \
+       $(TELE_FAKE_SRC) \
+       $(TD_MAIN_SRC)
+
 SRC = \
        $(ALTOS_SRC) \
        $(ALTOS_DRIVER_SRC) \
        $(TELE_DRIVER_SRC) \
        $(TELE_RECEIVER_SRC) \
        $(TELE_COMMON_SRC) \
+       $(TELE_FAKE_SRC) \
        $(TM_DRIVER_SRC) \
        $(TM_TASK_SRC) \
-       $(TI_TASK_SRC) \
-       $(TT_TASK_SRC)
-
-TM_REL=$(TM_SRC:.c=.rel)
-TI_REL=$(TI_SRC:.c=.rel)
-TT_REL=$(TT_SRC:.c=.rel)
-
-ADB=$(SRC:.c=.adb)
-ASM=$(SRC:.c=.asm)
-LNK=$(SRC:.c=.lnk)
-LST=$(SRC:.c=.lst)
-REL=$(SRC:.c=.rel)
-RST=$(SRC:.c=.rst)
-SYM=$(SRC:.c=.sym)
-
-PROGS=telemetrum.ihx tidongle.ihx teleterra.ihx
+       $(TM_MAIN_SRC) \
+       $(TI_MAIN_SRC) \
+       $(TD_MAIN_SRC) \
+       $(TT_MAIN_SRC)
+
+TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum.rel
+TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle.rel
+TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra.rel
+TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle.rel
+
+PROD_REL=\
+       ao_product-telemetrum.rel \
+       ao_product-tidongle.rel \
+       ao_product-teleterra.rel \
+       ao_product-teledongle.rel
+
+REL=$(SRC:.c=.rel) $(PROD_REL)
+ADB=$(REL:.rel=.adb)
+ASM=$(REL:.rel=.asm)
+LNK=$(REL:.rel=.lnk)
+LST=$(REL:.rel=.lst)
+RST=$(REL:.rel=.rst)
+SYM=$(REL:.rel=.sym)
+
+PROGS= telemetrum.ihx tidongle.ihx \
+       teleterra.ihx teledongle.ihx
+
+HOST_PROGS=ao_flight_test
+
 PCDB=$(PROGS:.ihx=.cdb)
 PLNK=$(PROGS:.ihx=.lnk)
 PMAP=$(PROGS:.ihx=.map)
@@ -144,7 +192,7 @@ PAOM=$(PROGS:.ihx=)
 %.rel : %.c $(INC)
        $(CC) -c $(CFLAGS) -o$*.rel $*.c
 
-all: $(PROGS)
+all: $(PROGS) $(HOST_PROGS)
 
 telemetrum.ihx: $(TM_REL) Makefile
        $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
@@ -162,11 +210,53 @@ teleterra.ihx: $(TT_REL) Makefile
 
 teleterra.ihx: tidongle.ihx
 
+teledongle.ihx: $(TD_REL) Makefile
+       $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
+       sh check-stack ao.h teledongle.mem
+
+teledongle.ihx: teleterra.ihx
+
 altitude.h: make-altitude
        nickle make-altitude > altitude.h
 
+TELEMETRUM_DEFS=ao-telemetrum.h
+TELETERRA_DEFS=ao-teleterra.h
+TELEDONGLE_DEFS=ao-teledongle.h
+TIDONGLE_DEFS=ao-tidongle.h
+
+ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
+       $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
+ao_product-telemetrum.rel: ao_product.c $(TELEMETRUM_DEFS)
+       $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
+
+ao_product-teleterra.rel: ao_product.c $(TELETERRA_DEFS)
+       $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
+
+ao_product-teledongle.rel: ao_product.c $(TELEDONGLE_DEFS)
+       $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
+
+ao_product-tidongle.rel: ao_product.c $(TIDONGLE_DEFS)
+       $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
+
+$(TELEMETRUM_DEFS): ao-make-product.5c
+       nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -v $(VERSION) > $@
+
+$(TELETERRA_DEFS): ao-make-product.5c
+       nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -v $(VERSION) > $@
+
+$(TELEDONGLE_DEFS): ao-make-product.5c
+       nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -v $(VERSION) > $@
+
+$(TIDONGLE_DEFS): ao-make-product.5c
+       nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -v $(VERSION) > $@
+
 clean:
        rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
        rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
+       rm -f $(ALL_DEFS) $(HOST_PROGS)
+       rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
 
 install:
+
+ao_flight_test: ao_flight.c ao_flight_test.c
+       cc -g -o $@ ao_flight_test.c