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