Make ao_flight_test show AGL altitude and positive acceleration under boost
[fw/altos] / Makefile
1 #
2 # AltOS build
3 #
4
5 CC=sdcc
6
7 VERSION=$(shell git describe)
8
9 CFLAGS=--model-small --debug --opt-code-speed 
10
11 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size 0x8000 \
12         --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
13
14 SERIAL=1
15
16 INC = \
17         ao.h \
18         cc1111.h \
19         altitude.h \
20         25lc1024.h
21
22 #
23 # Common AltOS sources
24 #
25 ALTOS_SRC = \
26         ao_cmd.c \
27         ao_dbg.c \
28         ao_dma.c \
29         ao_mutex.c \
30         ao_panic.c \
31         ao_task.c \
32         ao_timer.c \
33         _bp.c
34
35 #
36 # Shared AltOS drivers
37 #
38 ALTOS_DRIVER_SRC = \
39         ao_beep.c \
40         ao_config.c \
41         ao_led.c \
42         ao_radio.c \
43         ao_stdio.c \
44         ao_usb.c
45
46 TELE_COMMON_SRC = \
47         ao_gps_print.c
48
49 #
50 # Receiver code
51 #
52 TELE_RECEIVER_SRC =\
53         ao_monitor.c
54
55 #
56 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
57 #
58
59 TELE_DRIVER_SRC = \
60         ao_convert.c \
61         ao_gps.c \
62         ao_serial.c
63
64 #
65 # Drivers for partially-flled boards (TT, TD and TI)
66 #
67 TELE_FAKE_SRC = \
68         ao_adc_fake.c \
69         ao_ee_fake.c
70
71
72 # Drivers only on TeleMetrum
73 #
74 TM_DRIVER_SRC = \
75         ao_adc.c \
76         ao_ee.c \
77         ao_gps_report.c \
78         ao_ignite.c
79
80 #
81 # Tasks run on TeleMetrum
82 #
83 TM_TASK_SRC = \
84         ao_flight.c \
85         ao_log.c \
86         ao_report.c \
87         ao_telemetry.c
88
89 TM_MAIN_SRC = \
90         ao_telemetrum.c
91
92 #
93 # All sources for TeleMetrum
94 #
95 TM_SRC = \
96         $(ALTOS_SRC) \
97         $(ALTOS_DRIVER_SRC) \
98         $(TELE_DRIVER_SRC) \
99         $(TELE_RECEIVER_SRC) \
100         $(TELE_COMMON_SRC) \
101         $(TM_DRIVER_SRC) \
102         $(TM_TASK_SRC) \
103         $(TM_MAIN_SRC)
104
105 TI_MAIN_SRC = \
106         ao_tidongle.c
107
108 #
109 # All sources for the TI debug dongle
110 #
111 TI_SRC = \
112         $(ALTOS_SRC) \
113         $(ALTOS_DRIVER_SRC) \
114         $(TELE_RECEIVER_SRC) \
115         $(TELE_COMMON_SRC) \
116         $(TELE_FAKE_SRC) \
117         $(TI_MAIN_SRC)
118         
119 TT_MAIN_SRC = \
120         ao_teleterra.c
121 #
122 # All sources for TeleTerra
123 #
124 TT_SRC = \
125         $(ALTOS_SRC) \
126         $(ALTOS_DRIVER_SRC) \
127         $(TELE_RECEIVER_SRC) \
128         $(TELE_DRIVER_SRC) \
129         $(TELE_COMMON_SRC) \
130         $(TELE_FAKE_SRC) \
131         $(TT_MAIN_SRC)
132         
133         
134 #
135 # Sources for TeleDongle
136 #
137
138 TD_MAIN_SRC = \
139         ao_teledongle.c
140
141 TD_SRC = \
142         $(ALTOS_SRC) \
143         $(ALTOS_DRIVER_SRC) \
144         $(TELE_RECEIVER_SRC) \
145         $(TELE_COMMON_SRC) \
146         $(TELE_FAKE_SRC) \
147         $(TD_MAIN_SRC)
148
149 SRC = \
150         $(ALTOS_SRC) \
151         $(ALTOS_DRIVER_SRC) \
152         $(TELE_DRIVER_SRC) \
153         $(TELE_RECEIVER_SRC) \
154         $(TELE_COMMON_SRC) \
155         $(TELE_FAKE_SRC) \
156         $(TM_DRIVER_SRC) \
157         $(TM_TASK_SRC) \
158         $(TM_MAIN_SRC) \
159         $(TI_MAIN_SRC) \
160         $(TD_MAIN_SRC) \
161         $(TT_MAIN_SRC)
162
163 TM_REL=$(TM_SRC:.c=.rel) ao_product-telemetrum-$(SERIAL).rel
164 TI_REL=$(TI_SRC:.c=.rel) ao_product-tidongle-$(SERIAL).rel
165 TT_REL=$(TT_SRC:.c=.rel) ao_product-teleterra-$(SERIAL).rel
166 TD_REL=$(TD_SRC:.c=.rel) ao_product-teledongle-$(SERIAL).rel
167
168 PROD_REL=\
169         ao_product-telemetrum-$(SERIAL).rel \
170         ao_product-tidongle-$(SERIAL).rel \
171         ao_product-teleterra-$(SERIAL).rel \
172         ao_product-teledongle-$(SERIAL).rel
173
174 REL=$(SRC:.c=.rel) $(PROD_REL)
175 ADB=$(REL:.rel=.adb)
176 ASM=$(REL:.rel=.asm)
177 LNK=$(REL:.rel=.lnk)
178 LST=$(REL:.rel=.lst)
179 RST=$(REL:.rel=.rst)
180 SYM=$(REL:.rel=.sym)
181
182 PROGS=  telemetrum-$(SERIAL).ihx tidongle-$(SERIAL).ihx \
183         teleterra-$(SERIAL).ihx teledongle-$(SERIAL).ihx
184
185 HOST_PROGS=ao_flight_test
186
187 PCDB=$(PROGS:.ihx=.cdb)
188 PLNK=$(PROGS:.ihx=.lnk)
189 PMAP=$(PROGS:.ihx=.map)
190 PMEM=$(PROGS:.ihx=.mem)
191 PAOM=$(PROGS:.ihx=)
192
193 %.rel : %.c $(INC)
194         $(CC) -c $(CFLAGS) -o$*.rel $*.c
195
196 all: $(PROGS) $(HOST_PROGS)
197
198 telemetrum-$(SERIAL).ihx: $(TM_REL) Makefile
199         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TM_REL)
200         sh check-stack ao.h telemetrum-$(SERIAL).mem
201
202 tidongle-$(SERIAL).ihx: $(TI_REL) Makefile
203         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TI_REL)
204         sh check-stack ao.h tidongle-$(SERIAL).mem
205
206 tidongle-$(SERIAL).ihx: telemetrum-$(SERIAL).ihx
207
208 teleterra-$(SERIAL).ihx: $(TT_REL) Makefile
209         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TT_REL)
210         sh check-stack ao.h teleterra-$(SERIAL).mem
211
212 teleterra-$(SERIAL).ihx: tidongle-$(SERIAL).ihx
213
214 teledongle-$(SERIAL).ihx: $(TD_REL) Makefile
215         $(CC) $(LDFLAGS) $(CFLAGS) -o $@ $(TD_REL)
216         sh check-stack ao.h teledongle-$(SERIAL).mem
217
218 teledongle-$(SERIAL).ihx: teleterra-$(SERIAL).ihx
219
220 altitude.h: make-altitude
221         nickle make-altitude > altitude.h
222
223 TELEMETRUM_DEFS=ao-telemetrum-$(SERIAL).h
224 TELETERRA_DEFS=ao-teleterra-$(SERIAL).h
225 TELEDONGLE_DEFS=ao-teledongle-$(SERIAL).h
226 TIDONGLE_DEFS=ao-tidongle-$(SERIAL).h
227
228 ALL_DEFS=$(TELEMETRUM_DEFS) $(TELETERRA_DEFS) \
229         $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
230 ao_product-telemetrum-$(SERIAL).rel: ao_product.c $(TELEMETRUM_DEFS)
231         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEMETRUM_DEFS)\"' -o$@ ao_product.c
232
233 ao_product-teleterra-$(SERIAL).rel: ao_product.c $(TELETERRA_DEFS)
234         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELETERRA_DEFS)\"' -o$@ ao_product.c
235
236 ao_product-teledongle-$(SERIAL).rel: ao_product.c $(TELEDONGLE_DEFS)
237         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TELEDONGLE_DEFS)\"' -o$@ ao_product.c
238
239 ao_product-tidongle-$(SERIAL).rel: ao_product.c $(TIDONGLE_DEFS)
240         $(CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"$(TIDONGLE_DEFS)\"' -o$@ ao_product.c
241
242 $(TELEMETRUM_DEFS): ao-make-product.5c
243         nickle ao-make-product.5c -m altusmetrum.org -p TeleMetrum -s $(SERIAL) -v $(VERSION) > $@
244
245 $(TELETERRA_DEFS): ao-make-product.5c
246         nickle ao-make-product.5c -m altusmetrum.org -p TeleTerra -s $(SERIAL) -v $(VERSION) > $@
247
248 $(TELEDONGLE_DEFS): ao-make-product.5c
249         nickle ao-make-product.5c -m altusmetrum.org -p TeleDongle -s $(SERIAL) -v $(VERSION) > $@
250
251 $(TIDONGLE_DEFS): ao-make-product.5c
252         nickle ao-make-product.5c -m altusmetrum.org -p TIDongle -s $(SERIAL) -v $(VERSION) > $@
253
254 clean:
255         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
256         rm -f $(PROGS) $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
257         rm -f $(ALL_DEFS) $(HOST_PROGS)
258         rm -f $(TELEMETRUM_DEFS) $(TELETERRA_DEFS) $(TELEDONGLE_DEFS) $(TIDONGLE_DEFS)
259
260 install:
261
262 ao_flight_test: ao_flight.c ao_flight_test.c
263         cc -g -o $@ ao_flight_test.c