]> git.gag.com Git - fw/altos/blob - src/Makefile.proto
altos: Switch telemetrum over to kalman filter
[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 # Skytraq driver source
141 #
142 SKY_DRIVER_SRC = \
143         ao_gps_skytraq.c
144
145 #
146 # Tasks run on TeleMetrum
147 #
148 TM_TASK_SRC = \
149         ao_flight.c \
150         ao_log.c \
151         ao_log_big.c \
152         ao_report.c \
153         ao_telemetry.c
154
155 TM_MAIN_SRC = \
156         ao_telemetrum.c
157
158 #
159 # Base sources for TeleMetrum
160 #
161 TM_BASE_SRC = \
162         $(ALTOS_SRC) \
163         $(ALTOS_DRIVER_SRC) \
164         $(TELE_DRIVER_SRC) \
165         $(SERIAL_DRIVER_SRC) \
166         $(TELE_COMMON_SRC) \
167         $(TM_DRIVER_SRC) \
168         $(TM_TASK_SRC) \
169         $(TM_MAIN_SRC)
170
171 #
172 # Sources for TeleMini
173 TMINI_DRIVER_SRC = \
174         ao_adc.c \
175         ao_ignite.c \
176         ao_config.c \
177         ao_storage.c \
178         ao_intflash.c
179
180 TMINI_TASK_SRC = \
181         ao_flight.c \
182         ao_log.c \
183         ao_log_tiny.c \
184         ao_report.c \
185         ao_telemetry_tiny.c
186
187 TMINI_MAIN_SRC = \
188         ao_telemini.c
189
190 TMINI_BASE_SRC = \
191         $(ALTOS_SRC) \
192         $(ALTOS_DRIVER_SRC) \
193         $(TELE_DRIVER_SRC) \
194         $(TELE_COMMON_SRC) \
195         $(TMINI_DRIVER_SRC) \
196         $(TMINI_TASK_SRC) \
197         $(TMINI_MAIN_SRC)
198
199 #
200 # Sources for TeleNano
201 TNANO_DRIVER_SRC = \
202         ao_adc.c \
203         ao_ignite.c \
204         ao_config.c \
205         ao_storage.c \
206         ao_intflash.c
207
208 TNANO_TASK_SRC = \
209         ao_flight.c \
210         ao_log.c \
211         ao_log_tiny.c \
212         ao_report.c \
213         ao_telemetry_tiny.c
214
215 TNANO_MAIN_SRC = \
216         ao_telenano.c
217
218 TNANO_BASE_SRC = \
219         $(ALTOS_SRC) \
220         $(ALTOS_DRIVER_SRC) \
221         $(TELE_DRIVER_SRC) \
222         $(TELE_COMMON_SRC) \
223         $(TNANO_DRIVER_SRC) \
224         $(TNANO_TASK_SRC) \
225         $(TNANO_MAIN_SRC)
226
227 #
228 # TI Dongle sources
229 #
230 TI_MAIN_SRC = \
231         ao_tidongle.c
232
233 #
234 # All sources for the TI debug dongle
235 #
236 TI_SRC = \
237         $(ALTOS_SRC) \
238         $(ALTOS_DRIVER_SRC) \
239         $(TELE_RECEIVER_SRC) \
240         $(TELE_COMMON_SRC) \
241         $(USB_DRIVER_SRC) \
242         $(TI_MAIN_SRC) \
243         $(DBG_SRC)
244
245 TT_MAIN_SRC = \
246         ao_teleterra.c
247 #
248 # All sources for TeleTerra
249 #
250 TT_SRC = \
251         $(ALTOS_SRC) \
252         $(ALTOS_DRIVER_SRC) \
253         $(TELE_RECEIVER_SRC) \
254         $(TELE_DRIVER_SRC) \
255         $(TELE_COMMON_SRC) \
256         $(USB_DRIVER_SRC) \
257         $(TT_MAIN_SRC)
258
259
260 #
261 # Sources for TeleDongle
262 #
263
264 TD_MAIN_SRC = \
265         ao_teledongle.c
266
267 TD_SRC = \
268         $(ALTOS_SRC) \
269         $(ALTOS_DRIVER_SRC) \
270         $(TELE_RECEIVER_SRC) \
271         $(TELE_COMMON_SRC) \
272         $(USB_DRIVER_SRC) \
273         $(TD_MAIN_SRC)
274
275 include Makefile.defs
276
277 CFLAGS += $(PRODUCT_DEF) -I.
278
279 NICKLE=nickle
280 CHECK_STACK=sh ../check-stack
281
282 REL=$(SRC:.c=.rel) ao_product.rel
283 ADB=$(REL:.rel=.adb)
284 ASM=$(REL:.rel=.asm)
285 LNK=$(REL:.rel=.lnk)
286 LST=$(REL:.rel=.lst)
287 RST=$(REL:.rel=.rst)
288 SYM=$(REL:.rel=.sym)
289
290 PCDB=$(PROG:.ihx=.cdb)
291 PLNK=$(PROG:.ihx=.lnk)
292 PMAP=$(PROG:.ihx=.map)
293 PMEM=$(PROG:.ihx=.mem)
294 PAOM=$(PROG:.ihx=)
295
296 V=0
297 # The user has explicitly enabled quiet compilation.
298 ifeq ($(V),0)
299 quiet = @printf "  $1 $2 $@\n"; $($1)
300 endif
301 # Otherwise, print the full command line.
302 quiet ?= $($1)
303
304 %.rel : %.c $(INC)
305         $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $<
306
307 all: ../$(PROG)
308
309 ../$(PROG): $(REL) Makefile Makefile.defs ../Makefile.proto
310         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
311         $(call quiet,CHECK_STACK) ../ao.h $(PMEM)
312
313 ../altitude.h: make-altitude
314         nickle $< > $@
315
316 ../ao_kalman.h: make-kalman kalman.5c kalman_filter.5c load_csv.5c matrix.5c
317         sh $< > $@
318
319 ao_product.h: ao-make-product.5c ../Version
320         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
321
322 ao_product.rel: ao_product.c ao_product.h
323         $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<
324
325 distclean:      clean
326
327 clean:
328         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
329         rm -f $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
330         rm -f ao_product.h
331         rm -f ../$(PROG)
332
333 install:
334
335 uninstall: