update old information within Schematics
[pub/USBaspLoader.git] / updater / Makefile
1 # Name: Makefile
2 # Project: USBaspLoader (updater)
3 # Author: Stephan Bärwolf
4 # Creation Date: 2012-09-01
5 # Tabsize: 4
6 # License: GNU GPL v2 (see License.txt)
7
8 include ../Makefile.inc
9
10 # elsewise gcc would complain unnecessary
11 CFLAGS = -Wall -Wno-pointer-to-int-cast -Os -fno-move-loop-invariants -fno-tree-scev-cprop -fno-inline-small-functions -I. -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) -DNEW_BOOTLOADER_ADDRESS=$(NEW_BOOTLOADER_ADDRESS) $(DEFINES)
12 LDFLAGS = -Wl,--relax,--gc-sections
13
14 ifneq ($(FLASHADDRESS), 0)
15 ifneq ($(FLASHADDRESS), 00)
16 ifneq ($(FLASHADDRESS), 000)
17 ifneq ($(FLASHADDRESS), 0000)
18 ifneq ($(FLASHADDRESS), 00000)
19 ifneq ($(FLASHADDRESS), 0x0)
20 ifneq ($(FLASHADDRESS), 0x00)
21 ifneq ($(FLASHADDRESS), 0x000)
22 ifneq ($(FLASHADDRESS), 0x0000)
23 ifneq ($(FLASHADDRESS), 0x00000)
24 FLASHPREAMBLE = 0x0000
25 LDFLAGS += -Wl,--section-start=.text=$(FLASHADDRESS)
26 endif
27 endif
28 endif
29 endif
30 endif
31 endif
32 endif
33 endif
34 endif
35 endif
36
37 all: updater.hex
38
39 ../firmware/main.bin:
40 $(MAKE) -C ../firmware main.hex
41
42 updater.o: updater.c firmware.h
43 $(CC) updater.c -c -o updater.o $(CFLAGS)
44
45 updater.elf: updater.o
46 $(CC) updater.o -o updater.elf $(CFLAGS) $(LDFLAGS)
47
48 updater.hex: updater.elf
49 $(OBC) -j .text -j .data -O ihex updater.elf updater.hex
50 $(ECHO) "."
51 $(SIZ) updater.elf
52 $(ECHO) "."
53 $(AVRDUDE) -D -U flash:w:updater.hex:i
54 $(ECHO) "."
55
56
57
58 firmware_gen.o: firmware_gen.c
59 $(GCC) firmware_gen.c -c -o firmware_gen.o
60
61 firmware_gen: firmware_gen.o
62 $(GCC) firmware_gen.o -o firmware_gen
63
64 firmware.h: firmware_gen ../firmware/main.bin
65 $(OBC) -j .text -j .data -O binary ../firmware/main.bin usbasploader.raw
66 @./firmware_gen > firmware.h
67
68
69 deepclean: clean
70 $(RM) *~
71
72 clean:
73 $(RM) *.o
74 $(RM) *.raw
75 $(RM) updater.hex
76 $(RM) updater.elf
77 $(RM) firmware_gen
78 $(RM) firmware.h