]> git.gag.com Git - fw/altos/blob - src/telescience-v0.1/Makefile
altos: Clear stm i2c transfer timeout alarm
[fw/altos] / src / telescience-v0.1 / Makefile
1 #
2 # AltOS build
3 #
4 #
5 vpath % ..:../core:../product:../drivers:../avr
6 vpath ao-make-product.5c ../util
7
8 MCU=atmega32u4
9 DUDECPUTYPE=m32u4
10 #PROGRAMMER=stk500v2 -P usb
11 PROGRAMMER=usbtiny
12 LOADCMD=avrdude
13 LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w:
14 CC=avr-gcc
15 OBJCOPY=avr-objcopy
16
17 ifndef VERSION
18 include ../Version
19 endif
20
21 INC = \
22         ao.h \
23         ao_arch.h \
24         ao_usb.h \
25         ao_pins.h \
26         ao_product.h
27
28 #
29 # Common AltOS sources
30 #
31 TELESCIENCE_STORAGE= \
32         ao_m25.c \
33         ao_spi_usart.c \
34         ao_storage.c
35
36 TELESCIENCE_LOG= \
37         ao_log_single.c \
38         ao_log_telescience.c
39
40 ALTOS_SRC = \
41         ao_clock.c \
42         ao_cmd.c \
43         ao_mutex.c \
44         ao_panic.c \
45         ao_product.c \
46         ao_stdio.c \
47         ao_task.c \
48         ao_timer.c \
49         ao_led.c \
50         ao_avr_stdio.c \
51         ao_romconfig.c \
52         ao_usb_avr.c \
53         ao_adc_avr.c \
54         ao_science_slave.c \
55         ao_spi_slave.c \
56         $(TELESCIENCE_STORAGE)\
57         $(TELESCIENCE_LOG)
58
59 PRODUCT=TeleScience-v0.1
60 MCU=atmega32u4
61 PRODUCT_DEF=-DTELESCIENCE
62 IDPRODUCT=0x0011
63 CFLAGS = $(PRODUCT_DEF) -I. -I../avr -I../core -I..
64 CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O3 -mcall-prologues -DAVR
65
66 NICKLE=nickle
67
68 PROG=telescience-v0.1
69
70 SRC=$(ALTOS_SRC) ao_telescience.c
71 OBJ=$(SRC:.c=.o)
72
73 V=0
74 # The user has explicitly enabled quiet compilation.
75 ifeq ($(V),0)
76 quiet = @printf "  $1 $2 $@\n"; $($1)
77 endif
78 # Otherwise, print the full command line.
79 quiet ?= $($1)
80
81 all: $(PROG)
82
83 CHECK=sh ../util/check-avr-mem
84
85 $(PROG): Makefile $(OBJ)
86         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ)
87         $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1)
88
89 $(PROG).hex: $(PROG)
90         avr-size $(PROG)
91         $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@
92
93
94 load: $(PROG).hex
95         $(LOADCMD) $(LOADARG)$(PROG).hex
96
97 ao_product.h: ao-make-product.5c ../Version
98         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
99
100 ao_product.o: ao_product.c ao_product.h
101
102 %.o : %.c $(INC)
103         $(call quiet,CC) -c $(CFLAGS) $<
104
105 distclean:      clean
106
107 clean:
108         rm -f $(OBJ)
109         rm -f ao_product.h
110
111 install:
112
113 uninstall:
114
115 $(OBJ): ao_product.h $(INC)