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