]> git.gag.com Git - fw/altos/blob - src/avr-demo/Makefile
altos/lpc: Don't disable all interrupts when disabling one interrupt
[fw/altos] / src / avr-demo / Makefile
1 #
2 # AltOS build
3 #
4 #
5 vpath % ..:../core:../product:../drivers:../avr
6 vpath make-altitude ..
7 vpath make-kalman ..
8 vpath kalman.5c ../kalman
9 vpath kalman_filter.5c ../kalman
10 vpath load_csv.5c ../kalman
11 vpath matrix.5c ../kalman
12 vpath ao-make-product.5c ../util
13
14 MCU=atmega32u4
15 DUDECPUTYPE=m32u4
16 #PROGRAMMER=stk500v2 -P usb
17 PROGRAMMER=usbtiny
18 LOADCMD=avrdude
19 LOADARG=-p $(DUDECPUTYPE) -c $(PROGRAMMER) -e -U flash:w:
20 CC=avr-gcc
21 OBJCOPY=avr-objcopy
22
23 ifndef VERSION
24 include ../Version
25 endif
26
27 INC = \
28         ao.h \
29         ao_pins.h \
30         altitude.h \
31         ao_kalman.h
32
33 #
34 # Common AltOS sources
35 #
36 ALTOS_SRC = \
37         ao_cmd.c \
38         ao_mutex.c \
39         ao_panic.c \
40         ao_product.c \
41         ao_romconfig.c \
42         ao_serial_avr.c \
43         ao_avr_stdio.c \
44         ao_stdio.c \
45         ao_task.c \
46         ao_timer.c \
47         ao_led.c \
48         ao_usb_avr.c \
49         ao_lcd.c
50
51 PRODUCT=AvrDemo-v0.0
52 MCU=atmega32u4
53 PRODUCT_DEF=-DAVR_DEMO
54 IDPRODUCT=0x000a
55 CFLAGS = $(PRODUCT_DEF) -I. -I../avr -I../core -I..
56 CFLAGS += -g -mmcu=$(MCU) -Wall -Wstrict-prototypes -Os -mcall-prologues
57
58 NICKLE=nickle
59
60 PROG=avr-demo
61
62 SRC=$(ALTOS_SRC) ao_demo.c ao_debug_avr.c
63 OBJ=$(SRC:.c=.o)
64
65 V=0
66 # The user has explicitly enabled quiet compilation.
67 ifeq ($(V),0)
68 quiet = @printf "  $1 $2 $@\n"; $($1)
69 endif
70 # Otherwise, print the full command line.
71 quiet ?= $($1)
72
73 all: $(PROG)
74
75 $(PROG): Makefile $(OBJ)
76         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ)
77
78 $(PROG).hex: $(PROG)
79         avr-size $(PROG)
80         $(OBJCOPY) -R .eeprom -O ihex $(PROG) $@
81
82
83 load: $(PROG).hex
84         $(LOADCMD) $(LOADARG)$(PROG).hex
85
86 ../altitude.h: make-altitude
87         nickle $< > $@
88
89 ao_product.h: ao-make-product.5c ../Version
90         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
91
92 ao_product.rel: ao_product.c ao_product.h
93         $(call quiet,CC) -c $(CFLAGS) -D PRODUCT_DEFS='\"ao_product.h\"' -o$@ $<
94
95 distclean:      clean
96
97 clean:
98         rm -f $(OBJ)
99         rm -f ao_product.h
100
101 install:
102
103 uninstall:
104
105 $(OBJ): ao.h ao_product.h