2 # Project: USBaspLoader
3 # Author: Christian Starkjohann
4 # Creation Date: 2007-12-10
5 # Author: Stephan Bärwolf
6 # Improvement Date: 2012-07-31
8 # Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
9 # License: GNU GPL v2 (see License.txt)
11 ###############################################################################
12 # Configure the following variables according to your AVR.
13 # Program the device with
14 # make fuse # to set the clock generator, boot section size etc.
15 # make flash # to load the boot loader into flash
16 # make lock # to protect the boot loader from overwriting
18 include ..
/Makefile.inc
20 # Remove the -fno-* options when you use gcc 3, it does not understand them
21 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
)
22 LDFLAGS
= -Wl
,--relax
,--gc-sections
-Wl
,--section-start
=.text
=$(BOOTLOADER_ADDRESS
) -Wl
,--defsym
=nullVector
=0
24 OBJECTS
= usbdrv
/usbdrvasm.o usbdrv
/oddebug.o main.o
30 $(CC
) $(CFLAGS
) -c
$< -o
$@
33 $(CC
) $(CFLAGS
) -x assembler-with-cpp
-c
$< -o
$@
34 # "-x assembler-with-cpp" should not be necessary since this is the default
35 # file type for the .S (with capital S) extension. However, upper case
36 # characters are not always preserved on Windows. To ensure WinAVR
37 # compatibility define the file type manually.
40 $(CC
) $(CFLAGS
) -S
$< -o
$@
44 $(AVRDUDE
) -U flash
:w
:main.hex
:i
50 $(AVRDUDE
) -U flash
:r
:read.hex
:i
82 $(RM
) usbdrv
/usbdrvasm.o
83 $(RM
) usbdrv
/oddebug.o
84 $(RM
) usbdrv
/oddebug.s
88 main.elf
: $(OBJECTS
) bootloaderconfig.h
89 $(CC
) $(CFLAGS
) -o main.elf
$(OBJECTS
) -Wl
,-Map
,main.map
$(LDFLAGS
)
92 $(OBD
) -Stdr main.elf
> main.asm
94 main.hex
: main.elf main.asm
95 $(RM
) main.hex main.eep.hex
96 $(OBC
) -j .text
-j .data
-O ihex main.elf main.hex
100 $(ECHO
) "!!!ATTANTION!!!"
101 $(ECHO
) "(data+text) MUST fit into your MCUs bootloader section"
103 $(SIZ
) --mcu
$(DEVICE
) main.elf
112 $(CC
) $(CFLAGS
) -E main.c