src-avr: Add LCD driver for NHD-C0216CU-FN-GWB-3V display
[fw/altos] / src / Makefile.proto
1 #
2 # AltOS build
3 #
4 #
5 vpath %.c ..
6 vpath %.h ..
7 vpath make-altitude ..
8 vpath make-kalman ..
9 vpath kalman.5c ../kalman
10 vpath kalman_filter.5c ../kalman
11 vpath load_csv.5c ../kalman
12 vpath matrix.5c ../kalman
13 vpath ao-make-product.5c ..
14
15 CC=sdcc
16
17 ifndef VERSION
18 include ../Version
19 endif
20
21 CFLAGS=--model-small --debug --opt-code-speed -DCODESIZE=$(CODESIZE)
22
23 CODESIZE ?= 0x8000
24
25 LDFLAGS=--out-fmt-ihx --code-loc 0x0000 --code-size $(CODESIZE) \
26         --xram-loc 0xf000 --xram-size 0xda2 --iram-size 0xff
27
28 INC = \
29         ao.h \
30         ao_pins.h \
31         cc1111.h \
32         altitude.h \
33         ao_kalman.h \
34         25lc1024.h
35
36 #
37 # Common AltOS sources
38 #
39 ALTOS_SRC = \
40         ao_cmd.c \
41         ao_dma.c \
42         ao_mutex.c \
43         ao_panic.c \
44         ao_task.c \
45         ao_timer.c \
46         ao_romconfig.c \
47         _bp.c
48
49 #
50 # Shared AltOS drivers
51 #
52 ALTOS_DRIVER_SRC = \
53         ao_config.c \
54         ao_led.c \
55         ao_radio.c \
56         ao_stdio.c
57
58 BEEP_DRIVER_SRC = \
59         ao_beep.c
60
61 USB_DRIVER_SRC = \
62         ao_usb.c
63
64 TELE_COMMON_SRC = \
65         ao_packet.c \
66         ao_packet_slave.c \
67         ao_state.c
68
69 #
70 # Receiver code
71 #
72 TELE_RECEIVER_SRC =\
73         ao_monitor.c \
74         ao_gps_print.c \
75         ao_packet_master.c \
76         ao_rssi.c
77
78 #
79 # Shared Tele drivers (on TeleMetrum, TeleTerra, TeleDongle)
80 #
81
82 TELE_DRIVER_SRC = \
83         ao_convert.c
84
85 #
86 # Serial port driver
87 #
88 SERIAL_DRIVER_SRC = \
89         ao_serial.c
90
91 #
92 # Spi bus driver
93 #
94 SPI_DRIVER_SRC = \
95         ao_spi.c
96
97 #
98 # Debug dongle driver (only on TI)
99 #
100 DBG_SRC = \
101         ao_dbg.c
102
103 #
104 # Drivers only on TeleMetrum
105 #
106 TM_DRIVER_SRC = \
107         ao_adc.c \
108         ao_gps_report.c \
109         ao_ignite.c \
110         $(BEEP_DRIVER_SRC) \
111         $(USB_DRIVER_SRC)
112
113 #
114 # 25LC1024 driver source
115 EE_DRIVER_SRC = \
116         ao_storage.c \
117         ao_ee.c
118
119 #
120 # AT45DB161D driver source
121
122 FLASH_DRIVER_SRC = \
123         ao_storage.c \
124         ao_flash.c
125
126 #
127 # Numonyx M25P80 driver source
128 #
129
130 M25_DRIVER_SRC = \
131         ao_storage.c \
132         ao_m25.c
133
134 #
135 # SiRF driver source
136 #
137 SIRF_DRIVER_SRC = \
138         ao_gps_sirf.c
139
140 #
141 # Skytraq driver source
142 #
143 SKY_DRIVER_SRC = \
144         ao_gps_skytraq.c
145
146
147 #
148 # BTM-182 driver source
149 #
150 BTM_DRIVER_SRC = \
151         ao_btm.c
152
153 #
154 # Tasks run on TeleMetrum
155 #
156 TM_TASK_SRC = \
157         ao_flight.c \
158         ao_sample.c \
159         ao_kalman.c \
160         ao_log.c \
161         ao_log_big.c \
162         ao_report.c \
163         ao_telemetry.c
164
165 TM_MAIN_SRC = \
166         ao_telemetrum.c
167
168 #
169 # Base sources for TeleMetrum
170 #
171 TM_BASE_SRC = \
172         $(ALTOS_SRC) \
173         $(ALTOS_DRIVER_SRC) \
174         $(TELE_DRIVER_SRC) \
175         $(SERIAL_DRIVER_SRC) \
176         $(TELE_COMMON_SRC) \
177         $(TM_DRIVER_SRC) \
178         $(TM_TASK_SRC) \
179         $(TM_MAIN_SRC)
180
181 #
182 # Sources for TeleMini
183 TMINI_DRIVER_SRC = \
184         ao_adc.c \
185         ao_ignite.c \
186         ao_config.c \
187         ao_storage.c \
188         ao_intflash.c
189
190 TMINI_TASK_SRC = \
191         ao_flight.c \
192         ao_sample.c \
193         ao_kalman.c \
194         ao_log.c \
195         ao_log_tiny.c \
196         ao_report.c \
197         ao_telemetry_tiny.c
198
199 TMINI_MAIN_SRC = \
200         ao_telemini.c
201
202 TMINI_BASE_SRC = \
203         $(ALTOS_SRC) \
204         $(ALTOS_DRIVER_SRC) \
205         $(TELE_DRIVER_SRC) \
206         $(TELE_COMMON_SRC) \
207         $(TMINI_DRIVER_SRC) \
208         $(TMINI_TASK_SRC) \
209         $(TMINI_MAIN_SRC)
210
211 #
212 # Sources for TeleNano
213 TNANO_DRIVER_SRC = \
214         ao_adc.c \
215         ao_config.c \
216         ao_storage.c \
217         ao_intflash.c
218
219 TNANO_TASK_SRC = \
220         ao_flight_nano.c \
221         ao_sample.c \
222         ao_kalman.c \
223         ao_log.c \
224         ao_log_tiny.c \
225         ao_report.c \
226         ao_telemetry_tiny.c
227
228 TNANO_MAIN_SRC = \
229         ao_telenano.c
230
231 TNANO_BASE_SRC = \
232         $(ALTOS_SRC) \
233         $(ALTOS_DRIVER_SRC) \
234         $(TELE_DRIVER_SRC) \
235         $(TELE_COMMON_SRC) \
236         $(TNANO_DRIVER_SRC) \
237         $(TNANO_TASK_SRC) \
238         $(TNANO_MAIN_SRC)
239
240
241 #
242 # Sources for TeleTest
243 #
244
245 #
246 # Drivers only on TeleTest
247 #
248 TTEST_DRIVER_SRC = \
249         ao_adc_usb.c \
250         ao_gps_report.c \
251         ao_ignite.c \
252         $(BEEP_DRIVER_SRC) \
253         $(USB_DRIVER_SRC)
254
255 TTEST_MAIN_SRC = \
256         ao_telemetrum.c
257
258 TTEST_BASE_SRC = \
259         $(ALTOS_SRC) \
260         $(ALTOS_DRIVER_SRC) \
261         $(TELE_DRIVER_SRC) \
262         $(SERIAL_DRIVER_SRC) \
263         $(TELE_COMMON_SRC) \
264         $(TTEST_DRIVER_SRC) \
265         $(TM_TASK_SRC) \
266         $(TM_MAIN_SRC)
267
268 #
269 # Sources for TeleBluetooth
270 #
271
272 TBT_MAIN_SRC = \
273         ao_telebt.c
274
275 TBT_BASE_SRC = \
276         $(ALTOS_SRC) \
277         $(ALTOS_DRIVER_SRC) \
278         $(TELE_RECEIVER_SRC) \
279         $(TELE_COMMON_SRC) \
280         $(SERIAL_DRIVER_SRC) \
281         $(USB_DRIVER_SRC) \
282         $(BTM_DRIVER_SRC) \
283         $(DBG_SRC) \
284         $(TBT_MAIN_SRC)
285
286 TBT_V_0_1_SRC = \
287         $(TBT_BASE_SRC) \
288         $(SPI_DRIVER_SRC) \
289         $(M25_DRIVER_SRC) \
290         $(BEEP_DRIVER_SRC) \
291         ao_log_telem.c
292
293 #
294 # TI Dongle sources
295 #
296 TI_MAIN_SRC = \
297         ao_tidongle.c
298
299 #
300 # All sources for the TI debug dongle
301 #
302 TI_SRC = \
303         $(ALTOS_SRC) \
304         $(ALTOS_DRIVER_SRC) \
305         $(TELE_RECEIVER_SRC) \
306         $(TELE_COMMON_SRC) \
307         $(USB_DRIVER_SRC) \
308         $(TI_MAIN_SRC) \
309         $(DBG_SRC)
310
311 TT_MAIN_SRC = \
312         ao_teleterra.c
313 #
314 # All sources for TeleTerra
315 #
316 TT_SRC = \
317         $(ALTOS_SRC) \
318         $(ALTOS_DRIVER_SRC) \
319         $(TELE_RECEIVER_SRC) \
320         $(TELE_DRIVER_SRC) \
321         $(TELE_COMMON_SRC) \
322         $(USB_DRIVER_SRC) \
323         $(TT_MAIN_SRC)
324
325
326 #
327 # Sources for TeleDongle
328 #
329
330 TD_MAIN_SRC = \
331         ao_teledongle.c
332
333 TD_SRC = \
334         $(ALTOS_SRC) \
335         $(ALTOS_DRIVER_SRC) \
336         $(TELE_RECEIVER_SRC) \
337         $(TELE_COMMON_SRC) \
338         $(USB_DRIVER_SRC) \
339         $(TD_MAIN_SRC)
340
341 include Makefile.defs
342
343 CFLAGS += $(PRODUCT_DEF) -I.
344
345 NICKLE=nickle
346 CHECK_STACK=sh ../check-stack
347
348 REL=$(SRC:.c=.rel) ao_product.rel
349 ADB=$(REL:.rel=.adb)
350 ASM=$(REL:.rel=.asm)
351 LNK=$(REL:.rel=.lnk)
352 LST=$(REL:.rel=.lst)
353 RST=$(REL:.rel=.rst)
354 SYM=$(REL:.rel=.sym)
355
356 PCDB=$(PROG:.ihx=.cdb)
357 PLNK=$(PROG:.ihx=.lnk)
358 PMAP=$(PROG:.ihx=.map)
359 PMEM=$(PROG:.ihx=.mem)
360 PAOM=$(PROG:.ihx=)
361
362 V=0
363 # The user has explicitly enabled quiet compilation.
364 ifeq ($(V),0)
365 quiet = @printf "  $1 $2 $@\n"; $($1)
366 endif
367 # Otherwise, print the full command line.
368 quiet ?= $($1)
369
370 %.rel : %.c $(INC)
371         $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $<
372
373 all: ../$(PROG)
374
375 ../$(PROG): $(REL) Makefile Makefile.defs ../Makefile.proto
376         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
377         $(call quiet,CHECK_STACK) ../ao.h $(PMEM)
378
379 ../altitude.h: make-altitude
380         nickle $< > $@
381
382 ../ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c
383         sh $< > $@
384
385 ao_product.h: ao-make-product.5c ../Version
386         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
387
388 ao_product.rel: ao_product.c ao_product.h
389         $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<
390
391 distclean:      clean
392
393 clean:
394         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
395         rm -f $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
396         rm -f ao_product.h
397         rm -f ../$(PROG)
398
399 install:
400
401 uninstall: