dde51a684cc85308645e2bb0587ec2dad77b47b8
[fw/altos] / src / stm / Makefile-flash.defs
1 vpath % $(TOPDIR)/stm:$(TOPDIR)/product:$(TOPDIR)/drivers:$(TOPDIR)/kernel:$(TOPDIR)/util:$(TOPDIR)
2 vpath ao-make-product.5c $(TOPDIR)/util
3
4 .SUFFIXES: .elf .ihx
5
6 .elf.ihx:
7         objcopy -O ihex $*.elf $@
8
9 ifndef VERSION
10 include $(TOPDIR)/Version
11 endif
12 include $(TOPDIR)/Makedefs
13
14 CC=$(ARM_CC)
15 LIBS=$(PDCLIB_LIBS_M3) -lgcc
16
17 AO_CFLAGS=-I. -I$(TOPDIR)/stm -I$(TOPDIR)/kernel -I$(TOPDIR)/drivers -I$(TOPDIR)/product -I$(TOPDIR) $(PDCLIB_INCLUDES)
18 STM_CFLAGS=-std=gnu99 -mlittle-endian -mcpu=cortex-m3 -mthumb -ffreestanding -nostdlib $(AO_CFLAGS) $(SAT_CFLAGS)
19
20 LDFLAGS=-L$(TOPDIR)/stm -Wl,-Taltos-loader.ld
21
22 NICKLE=nickle
23
24 V=0
25 # The user has explicitly enabled quiet compilation.
26 ifeq ($(V),0)
27 quiet = @printf "  $1 $2 $@\n"; $($1)
28 endif
29 # Otherwise, print the full command line.
30 quiet ?= $($1)
31
32 .c.o:
33         $(call quiet,CC) -c $(CFLAGS) -o $@ $<
34
35 INC = \
36         ao.h \
37         ao_arch.h \
38         ao_arch_funcs.h \
39         ao_flash_pins.h \
40         ao_flash_stm_pins.h \
41         ao_flash_task.h \
42         ao_pins.h \
43         ao_product.h \
44         Makefile
45
46 #
47 # Common AltOS sources
48 #
49 SRC = \
50         ao_interrupt.c \
51         ao_romconfig.c \
52         ao_boot_chain.c \
53         ao_boot_pin.c \
54         ao_product.c \
55         ao_notask.c \
56         ao_timer.c \
57         ao_usb_stm.c \
58         ao_flash_stm.c \
59         ao_flash_task.c \
60         ao_flash_loader_stm.c
61
62 OBJ=$(SRC:.c=.o)
63
64 PRODUCT=AltosFlash
65 PRODUCT_DEF=-DALTOS_FLASH
66 IDPRODUCT=0x000a
67
68 CFLAGS = $(PRODUCT_DEF) $(STM_CFLAGS) -g -Os
69
70 PROGNAME=altos-flash
71 PROG=$(HARDWARE)-$(PROGNAME)-$(VERSION).elf
72
73 $(PROG): Makefile $(OBJ) altos-loader.ld
74         $(call quiet,CC) $(LDFLAGS) $(CFLAGS) -o $(PROG) $(OBJ) $(LIBS)
75
76 ao_product.h: ao-make-product.5c $(TOPDIR)/Version
77         $(call quiet,NICKLE,$<) $< -m altusmetrum.org -i $(IDPRODUCT) -p $(PRODUCT) -v $(VERSION) > $@
78
79 $(OBJ): $(INC)
80
81 all: $(PROG)
82
83 distclean:      clean
84
85 clean:
86         rm -f *.o $(HARDWARE)-$(PROGNAME)-*.elf
87         rm -f ao_product.h
88
89 install:
90
91 uninstall: