2 # Project: USBaspLoader (updater)
3 # Author: Stephan Bärwolf
4 # Creation Date: 2012-09-01
6 # License: GNU GPL v2 (see License.txt)
8 include ..
/Makefile.inc
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
) -DBOOTLOADER_ADDRESS
=$(BOOTLOADER_ADDRESS
) -DNEW_BOOTLOADER_ADDRESS
=$(NEW_BOOTLOADER_ADDRESS
) $(DEFINES
)
12 LDFLAGS
= -Wl
,--relax
,--gc-sections
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
)
40 $(MAKE
) -C ..
/firmware main.hex
44 $(OBC
) -j .text
-j .data
-O binary ..
/firmware
/main.bin usbasploader.raw
46 usbasploader.o
: usbasploader.raw
47 $(OBC
) -I binary
-O elf32-avr
--rename-section .data
=.text
--redefine-sym _binary_usbasploader_raw_start
=usbasploader usbasploader.raw usbasploader.o
50 updater.o
: updater.c usbasploader.h usbasploader.raw usbasploader.o
51 $(CC
) updater.c
-c
-o updater.o
-DSIZEOF_new_firmware
=$(shell stat
-c
%s usbasploader.raw
) $(CFLAGS
)
52 # $(CC) updater.c -c -o updater.o $(CFLAGS)
54 updater.elf
: updater.o usbasploader.o
55 $(CC
) updater.o usbasploader.o
-o updater.elf
$(CFLAGS
) $(LDFLAGS
)
57 updater.hex
: updater.elf
58 $(OBC
) -j .text
-j .data
-O ihex updater.elf updater.hex
62 $(AVRDUDE
) -D
-U flash
:w
:updater.hex
:i
74 $(RM
) usbasploader.raw