2 # Project: USBaspLoader
3 # Author: Christian Starkjohann
4 # Creation Date: 2007-12-10
5 # Author: Stephan Bärwolf
6 # Improvement Date: 2012-07-31
7 # Improvement Date: 2012-09-12
9 # Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
10 # License: GNU GPL v2 (see License.txt)
12 ###############################################################################
13 # Configure the following variables according to your AVR.
14 # Program the device with
15 # make fuse # to set the clock generator, boot section size etc.
16 # make flash # to load the boot loader into flash
17 # make lock # to protect the boot loader from overwriting
19 include ..
/Makefile.inc
21 # Remove the -fno-* options when you use gcc 3, it does not understand them
22 CFLAGS
= -Wall
-Os
-g3
-ggdb
-fno-move-loop-invariants
-fno-tree-scev-cprop
-fno-inline-small-functions
-I.
-mmcu
=$(DEVICE
) -DBOOTLOADER_ADDRESS
=$(BOOTLOADER_ADDRESS
) -DF_CPU
=$(F_CPU
) $(DEFINES
)
23 LDFLAGS
= -Wl
,--relax
,--gc-sections
-Wl
,--section-start
=.text
=$(BOOTLOADER_ADDRESS
) -Wl
,--defsym
=nullVector
=0
25 DEPENDS
= bootloaderconfig.h ..
/Makefile.inc
28 all: main.hex
$(DEPENDS
)
30 usbdrv
/usbdrvasm.o
: usbdrv
/usbdrvasm.S
$(DEPENDS
)
31 $(CC
) -x assembler-with-cpp
-c usbdrv
/usbdrvasm.S
-o usbdrv
/usbdrvasm.o
$(CFLAGS
)
33 usbdrv
/oddebug.o
: usbdrv
/oddebug.c
$(DEPENDS
)
34 $(CC
) usbdrv
/oddebug.c
-c
-o usbdrv
/oddebug.o
$(CFLAGS
)
36 main.o
: main.c
$(DEPENDS
)
37 $(CC
) main.c
-c
-o main.o
$(CFLAGS
)
41 $(AVRDUDE
) -U flash
:w
:main.hex
:i
47 $(AVRDUDE
) -U flash
:r
:read.hex
:i
79 $(RM
) usbdrv
/usbdrvasm.o
80 $(RM
) usbdrv
/oddebug.o
81 $(RM
) usbdrv
/oddebug.s
85 main.elf
: usbdrv
/usbdrvasm.o usbdrv
/oddebug.o main.o
$(DEPENDS
)
86 $(CC
) $(CFLAGS
) -o main.elf usbdrv
/usbdrvasm.o usbdrv
/oddebug.o main.o
-Wl
,-Map
,main.map
$(LDFLAGS
)
88 main.asm
: main.elf
$(DEPENDS
)
89 $(OBD
) -Stdr main.elf
> main.asm
91 main.hex
: main.elf main.asm
$(DEPENDS
)
92 $(RM
) main.hex main.eep.hex
93 $(OBC
) -j .text
-j .data
-O ihex main.elf main.hex
97 $(ECHO
) "!!!ATTANTION!!!"
98 $(ECHO
) "(data+text) MUST fit into your MCUs bootloader section"
100 $(SIZ
) --mcu
$(DEVICE
) main.elf
105 disasm
: main.elf
$(DEPENDS
)
109 $(CC
) $(CFLAGS
) -E main.c