]> git.gag.com Git - fw/altos/blob - src/microkite/Makefile
had the sense backwards .. presence of 'attached' should put us in the loader
[fw/altos] / src / microkite / Makefile
1 #
2 # Tiny AltOS build
3 #
4 #
5 vpath % ../attiny:../drivers:../kernel:../product:..
6 vpath ao-make-product.5c ../util
7 vpath make-altitude-pa ../util
8
9 include ../avr/Makefile.defs
10
11 PROGNAME=microkite-v0.1
12 PROG=$(PROGNAME)-$(VERSION).elf
13 HEX=$(PROGNAME)-$(VERSION).ihx
14
15 SCRIPT=microkite-load
16
17 PUBLISH_DIR=$(HOME)/altusmetrumllc/Binaries
18 PUBLISH_HEX=$(PUBLISH_DIR)/$(HEX)
19 PUBLISH_SCRIPT=$(PUBLISH_DIR)/$(SCRIPT)
20
21 MCU=attiny85
22 DUDECPUTYPE=t85
23 #PROGRAMMER=stk500v2 -P usb
24 LOADSLOW=-i 32 -B 32
25 LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w:
26
27 #LDFLAGS=-L$(LDSCRIPTS) -Tavr25.x
28
29 ALTOS_SRC = \
30         ao_micropeak.c \
31         ao_spi_attiny.c \
32         ao_led.c \
33         ao_clock.c \
34         ao_ms5607.c \
35         ao_exti.c \
36         ao_convert_pa.c \
37         ao_report_micro.c \
38         ao_notask.c \
39         ao_eeprom_tiny.c \
40         ao_panic.c \
41         ao_log_micro.c \
42         ao_async.c \
43         ao_microflight.c \
44         ao_microkalman.c
45
46 INC=\
47         ao.h \
48         ao_pins.h \
49         ao_arch.h \
50         ao_arch_funcs.h \
51         ao_exti.h \
52         ao_ms5607.h \
53         ao_log_micro.h \
54         ao_micropeak.h \
55         altitude-pa.h
56
57 IDPRODUCT=0
58 PRODUCT=MicroKite-v0.1
59 PRODUCT_DEF=-DMICROPEAK
60 CFLAGS = $(PRODUCT_DEF) -I. -I../attiny -I../kernel -I.. -I../drivers -I../product
61 CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -O2 -mcall-prologues -DATTINY
62
63 NICKLE=nickle
64
65 SRC=$(ALTOS_SRC)
66 OBJ=$(SRC:.c=.o)
67
68 V=0
69 # The user has explicitly enabled quiet compilation.
70 ifeq ($(V),0)
71 quiet = @printf "  $1 $2 $@\n"; $($1)
72 endif
73 # Otherwise, print the full command line.
74 quiet ?= $($1)
75
76 all: $(PROG) $(HEX) microkite-load
77
78 CHECK=sh ../util/check-avr-mem
79
80 $(PROG): Makefile $(OBJ)
81         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ)
82         $(call quiet,CHECK) $(PROG) || ($(RM) -f $(PROG); exit 1)
83
84 $(HEX): $(PROG)
85         avr-size $(PROG)
86         $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@
87
88
89 load: $(HEX)
90         $(LOADCMD) $(LOADARG)$(HEX)
91
92 load-slow: $(HEX)
93         $(LOADCMD) $(LOADSLOW) $(LOADARG)$(HEX)
94
95 ao_product.h: ao-make-product.5c ../Version
96         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
97
98 ao_product.o: ao_product.c ao_product.h
99
100 %.o : %.c $(INC)
101         $(call quiet,CC) -c $(CFLAGS) $<
102
103 distclean:      clean
104
105 clean:
106         rm -f *.o $(PROG) $(HEX) $(SCRIPT)
107         rm -f ao_product.h
108
109 publish: $(PUBLISH_HEX) $(PUBLISH_SCRIPT)
110
111 $(PUBLISH_HEX): $(HEX)
112         cp -a $(HEX) $@
113
114 $(PUBLISH_SCRIPT): $(SCRIPT)
115         cp -a $(SCRIPT) $@
116
117 load-product:
118         ./$(SCRIPT) fast
119
120 load-product-slow:
121         ./$(SCRIPT) slow
122
123 ../altitude-pa.h: make-altitude-pa
124         nickle $< > $@
125
126 $(SCRIPT): $(SCRIPT).tmpl Makefile ../Version
127         sed -e 's/%HEX%/$(HEX)/' -e 's/%LOADCMD%/$(LOADCMD)/' -e 's/%LOADARG%/$(LOADARG)/' -e 's/%LOADSLOW%/$(LOADSLOW)/' $(SCRIPT).tmpl > $@ || (rm $@ && exit 1)
128         chmod +x $@
129
130 install:
131
132 uninstall:
133
134 $(OBJ): ao_product.h $(INC)