altos: Split telenano main from telemini
[fw/altos] / src / Makefile.proto
index c98abca60d101f84fd7fda12cbcfd21ba0bea50f..68fa46541a533acf578d5a8ab39d35129be8ed66 100644 (file)
@@ -10,12 +10,14 @@ vpath ao-make-product.5c ..
 CC=sdcc
 
 ifndef VERSION
-VERSION=$(shell git describe)
+include ../Version
 endif
 
-CFLAGS=--model-small --debug --opt-code-speed
+CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE)
 
-LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
+CODESIZE ?= 0x8000
+
+LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size $(CODESIZE) \
        --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
 
 INC = \
@@ -35,17 +37,22 @@ ALTOS_SRC = \
        ao_panic.c \
        ao_task.c \
        ao_timer.c \
+       ao_romconfig.c \
        _bp.c
 
 #
 # Shared AltOS drivers
 #
 ALTOS_DRIVER_SRC = \
-       ao_beep.c \
        ao_config.c \
        ao_led.c \
        ao_radio.c \
-       ao_stdio.c \
+       ao_stdio.c
+
+BEEP_DRIVER_SRC = \
+       ao_beep.c
+
+USB_DRIVER_SRC = \
        ao_usb.c
 
 TELE_COMMON_SRC = \
@@ -67,9 +74,20 @@ TELE_RECEIVER_SRC =\
 #
 
 TELE_DRIVER_SRC = \
-       ao_convert.c \
+       ao_convert.c
+
+#
+# Serial port driver
+#
+SERIAL_DRIVER_SRC = \
        ao_serial.c
 
+#
+# Spi bus driver
+#
+SPI_DRIVER_SRC = \
+       ao_spi.c
+
 #
 # Debug dongle driver (only on TI)
 #
@@ -82,19 +100,31 @@ DBG_SRC = \
 TM_DRIVER_SRC = \
        ao_adc.c \
        ao_gps_report.c \
-       ao_ignite.c
+       ao_ignite.c \
+       $(BEEP_DRIVER_SRC) \
+       $(USB_DRIVER_SRC)
 
 #
 # 25LC1024 driver source
 EE_DRIVER_SRC = \
+       ao_storage.c \
        ao_ee.c
 
 #
 # AT45DB161D driver source
 
 FLASH_DRIVER_SRC = \
+       ao_storage.c \
        ao_flash.c
 
+#
+# Numonyx M25P80 driver source
+#
+
+M25_DRIVER_SRC = \
+       ao_storage.c \
+       ao_m25.c
+
 #
 # SiRF driver source
 #
@@ -112,6 +142,7 @@ SKY_DRIVER_SRC = \
 TM_TASK_SRC = \
        ao_flight.c \
        ao_log.c \
+       ao_log_big.c \
        ao_report.c \
        ao_telemetry.c
 
@@ -125,11 +156,71 @@ TM_BASE_SRC = \
        $(ALTOS_SRC) \
        $(ALTOS_DRIVER_SRC) \
        $(TELE_DRIVER_SRC) \
+       $(SERIAL_DRIVER_SRC) \
        $(TELE_COMMON_SRC) \
        $(TM_DRIVER_SRC) \
        $(TM_TASK_SRC) \
        $(TM_MAIN_SRC)
 
+#
+# Sources for TeleMini
+TMINI_DRIVER_SRC = \
+       ao_adc.c \
+       ao_ignite.c \
+       ao_config.c \
+       ao_storage.c \
+       ao_intflash.c
+
+TMINI_TASK_SRC = \
+       ao_flight.c \
+       ao_log.c \
+       ao_log_tiny.c \
+       ao_report.c \
+       ao_telemetry_tiny.c
+
+TMINI_MAIN_SRC = \
+       ao_telemini.c
+
+TMINI_BASE_SRC = \
+       $(ALTOS_SRC) \
+       $(ALTOS_DRIVER_SRC) \
+       $(TELE_DRIVER_SRC) \
+       $(TELE_COMMON_SRC) \
+       $(TMINI_DRIVER_SRC) \
+       $(TMINI_TASK_SRC) \
+       $(TMINI_MAIN_SRC)
+
+#
+# Sources for TeleNano
+TNANO_DRIVER_SRC = \
+       ao_adc.c \
+       ao_ignite.c \
+       ao_config.c \
+       ao_storage.c \
+       ao_intflash.c
+
+TNANO_TASK_SRC = \
+       ao_flight.c \
+       ao_log.c \
+       ao_log_tiny.c \
+       ao_report.c \
+       ao_telemetry_tiny.c
+
+TNANO_MAIN_SRC = \
+       ao_telenano.c
+
+TNANO_BASE_SRC = \
+       $(ALTOS_SRC) \
+       $(ALTOS_DRIVER_SRC) \
+       $(TELE_DRIVER_SRC) \
+       $(TELE_COMMON_SRC) \
+       $(TNANO_DRIVER_SRC) \
+       $(TNANO_TASK_SRC) \
+       $(TNANO_MAIN_SRC)
+
+#
+# TI Dongle sources
+#
 TI_MAIN_SRC = \
        ao_tidongle.c
 
@@ -141,6 +232,7 @@ TI_SRC = \
        $(ALTOS_DRIVER_SRC) \
        $(TELE_RECEIVER_SRC) \
        $(TELE_COMMON_SRC) \
+       $(USB_DRIVER_SRC) \
        $(TI_MAIN_SRC) \
        $(DBG_SRC)
 
@@ -155,6 +247,7 @@ TT_SRC = \
        $(TELE_RECEIVER_SRC) \
        $(TELE_DRIVER_SRC) \
        $(TELE_COMMON_SRC) \
+       $(USB_DRIVER_SRC) \
        $(TT_MAIN_SRC)
 
 
@@ -170,6 +263,7 @@ TD_SRC = \
        $(ALTOS_DRIVER_SRC) \
        $(TELE_RECEIVER_SRC) \
        $(TELE_COMMON_SRC) \
+       $(USB_DRIVER_SRC) \
        $(TD_MAIN_SRC)
 
 include Makefile.defs
@@ -177,6 +271,7 @@ include Makefile.defs
 CFLAGS += $(PRODUCT_DEF) -I.
 
 NICKLE=nickle
+CHECK_STACK=sh ../check-stack
 
 REL=$(SRC:.c=.rel) ao_product.rel
 ADB=$(REL:.rel=.adb)
@@ -206,13 +301,14 @@ quiet ?= $($1)
 all: ../$(PROG)
 
 ../$(PROG): $(REL) Makefile Makefile.defs ../Makefile.proto
-       $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && mv $(PROG) ..
+       $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
+       $(call quiet,CHECK_STACK) ../ao.h $(PMEM)
 
 ../altitude.h: make-altitude
        nickle $< > $@
 
-ao_product.h: ao-make-product.5c
-       $(call quiet,NICKLE,$<) $< -m altusmetrum.org -p $(PRODUCT) -v $(VERSION) > $@
+ao_product.h: ao-make-product.5c ../Version
+       $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
 
 ao_product.rel: ao_product.c ao_product.h
        $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<