Rev Author Line No. Line
3328 povik 1 BINARY = webserver_demo
2  
3 UIP_SRCS = Utilities/uip/cgi.c Utilities/uip/fs.c Utilities/uip/httpd.c Utilities/uip/memb.c Utilities/uip/slipdev.c Utilities/uip/telnetd.c Utilities/uip/telnetd-shell.c Utilities/uip/uip_arch.c Utilities/uip/uip_arp.c Utilities/uip/uip.c Utilities/uip/uIPMain.c
4  
5 SRCS = Utilities/STM32_EVAL/stm32_eval.c $(UIP_SRCS) $(wildcard Project/Webserver_Demo_uIP/*.c) $(wildcard Libraries/CMSIS/Core/CM3/*.c) $(wildcard Libraries/STM32F10x_StdPeriph_Driver/src/*.c) $(wildcard Libraries/STM32_ETH_Driver/src/*.c) Libraries/CMSIS/Core/CM3/startup/gcc/startup_stm32f10x_cl.s
6 OBJS = $(patsubst %.s, %.o, $(patsubst %.c, %.o, $(SRCS)))
7  
8 INCLUDE = -I Libraries/CMSIS/Core/CM3/ -I Libraries/STM32F10x_StdPeriph_Driver/inc/ -I Libraries/STM32_ETH_Driver/inc -I Project/Webserver_Demo_uIP/ -I Utilities/uip/ -I Utilities/STM32_EVAL/
9  
10 PREFIX ?= arm-none-eabi
11 CC = $(PREFIX)-gcc
12 LD = $(PREFIX)-gcc
13 OBJCOPY = $(PREFIX)-objcopy
14 OBJDUMP = $(PREFIX)-objdump
15 GDB = $(PREFIX)-gdb
16  
17 ARCH_FLAGS = -mthumb -mcpu=cortex-m3 -msoft-float
18 CFLAGS += -g -Wall -Wextra $(INCLUDE) -fno-common $(ARCH_FLAGS) -MD -DNULL=0 \
19 -DSTM32F1 -DHSE_VALUE=25000000 -DSTM32F10X_CL -DUSE_STDPERIPH_DRIVER # -DUIP_DEBUG
20 LDSCRIPT = linker.ld
21 LDFLAGS += -lc -lnosys -lm \
22 -T$(LDSCRIPT) -nostartfiles -Wl,--gc-sections \
23 $(ARCH_FLAGS) -mfix-cortex-m3-ldrd
24  
25 ifneq ($(V),1)
26 Q := @
27 NULL := 2>/dev/null
28 else
29 LDFLAGS += -Wl,--print-gc-sections
30 endif
31  
32 .SUFFIXES: .elf .bin .hex .srec .list .images
33 .SECONDEXPANSION:
34 .SECONDARY:
35  
36 all: images
37  
38 gdb: images
39 $(GDB) bin/$(BINARY).elf
40  
41 images: $(OBJS) bin/$(BINARY).elf bin/$(BINARY).bin bin/$(BINARY).hex bin/$(BINARY).srec bin/$(BINARY).list
42  
43 bin/%.bin: bin/%.elf
44 @echo " OBJCOPY $@"
45 $(Q)$(OBJCOPY) -Obinary $< $@
46  
47 bin/%.hex: bin/%.elf
48 @echo " OBJCOPY $@"
49 $(Q)$(OBJCOPY) -Oihex $< $@
50  
51 bin/%.srec: bin/%.elf
52 @echo " OBJCOPY $@"
53 $(Q)$(OBJCOPY) -Osrec $< $@
54  
55 bin/%.list: bin/%.elf
56 @echo " OBJDUMP $@"
57 $(Q)$(OBJDUMP) -S $< > $@
58  
59 bin/%.elf: $(OBJS) $(LDSCRIPT)
60 @echo " LD $@"
61 $(Q)$(LD) -o $@ $(OBJS) $(LDFLAGS)
62  
63 %.o: %.c Makefile
64 @echo " CC $@"
65 $(Q)$(CC) $(CFLAGS) -o $@ -c $<
66  
67 %.o: %.s Makefile
68 @echo " ASM $@"
69 $(Q)$(CC) $(CFLAGS) -o $@ -c $<
70  
71 clean:
72 $(Q)rm -f $(OBJS)
73 $(Q)rm -f bin/*
74  
75 .PHONY: all clean images upload gdb