altos: Add tiny logging for TeleMini/TeleNano
[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.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 TI_MAIN_SRC = \
194         ao_tidongle.c
195
196 #
197 # All sources for the TI debug dongle
198 #
199 TI_SRC = \
200         $(ALTOS_SRC) \
201         $(ALTOS_DRIVER_SRC) \
202         $(TELE_RECEIVER_SRC) \
203         $(TELE_COMMON_SRC) \
204         $(USB_DRIVER_SRC) \
205         $(TI_MAIN_SRC) \
206         $(DBG_SRC)
207
208 TT_MAIN_SRC = \
209         ao_teleterra.c
210 #
211 # All sources for TeleTerra
212 #
213 TT_SRC = \
214         $(ALTOS_SRC) \
215         $(ALTOS_DRIVER_SRC) \
216         $(TELE_RECEIVER_SRC) \
217         $(TELE_DRIVER_SRC) \
218         $(TELE_COMMON_SRC) \
219         $(USB_DRIVER_SRC) \
220         $(TT_MAIN_SRC)
221
222
223 #
224 # Sources for TeleDongle
225 #
226
227 TD_MAIN_SRC = \
228         ao_teledongle.c
229
230 TD_SRC = \
231         $(ALTOS_SRC) \
232         $(ALTOS_DRIVER_SRC) \
233         $(TELE_RECEIVER_SRC) \
234         $(TELE_COMMON_SRC) \
235         $(USB_DRIVER_SRC) \
236         $(TD_MAIN_SRC)
237
238 include Makefile.defs
239
240 CFLAGS += $(PRODUCT_DEF) -I.
241
242 NICKLE=nickle
243 CHECK_STACK=sh ../check-stack
244
245 REL=$(SRC:.c=.rel) ao_product.rel
246 ADB=$(REL:.rel=.adb)
247 ASM=$(REL:.rel=.asm)
248 LNK=$(REL:.rel=.lnk)
249 LST=$(REL:.rel=.lst)
250 RST=$(REL:.rel=.rst)
251 SYM=$(REL:.rel=.sym)
252
253 PCDB=$(PROG:.ihx=.cdb)
254 PLNK=$(PROG:.ihx=.lnk)
255 PMAP=$(PROG:.ihx=.map)
256 PMEM=$(PROG:.ihx=.mem)
257 PAOM=$(PROG:.ihx=)
258
259 V=0
260 # The user has explicitly enabled quiet compilation.
261 ifeq ($(V),0)
262 quiet = @printf "  $1 $2 $@\n"; $($1)
263 endif
264 # Otherwise, print the full command line.
265 quiet ?= $($1)
266
267 %.rel : %.c $(INC)
268         $(call quiet,CC,$(PRODUCT_DEF)) $(CFLAGS) -c -o$@ $<
269
270 all: ../$(PROG)
271
272 ../$(PROG): $(REL) Makefile Makefile.defs ../Makefile.proto
273         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(REL) && cp $(PROG) $(PMAP) ..
274         $(call quiet,CHECK_STACK) ../ao.h $(PMEM)
275
276 ../altitude.h: make-altitude
277         nickle $< > $@
278
279 ao_product.h: ao-make-product.5c ../Version
280         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
281
282 ao_product.rel: ao_product.c ao_product.h
283         $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<
284
285 distclean:      clean
286
287 clean:
288         rm -f $(ADB) $(ASM) $(LNK) $(LST) $(REL) $(RST) $(SYM)
289         rm -f $(PCDB) $(PLNK) $(PMAP) $(PMEM) $(PAOM)
290         rm -f ao_product.h
291         rm -f ../$(PROG)
292
293 install:
294
295 uninstall: