add device-signature for my atmega1284p
[pub/USBaspLoader.git] / firmware / Makefile
index 5792da9..7a0a8ea 100644 (file)
@@ -5,7 +5,6 @@
 # Tabsize: 4
 # Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
 # License: GNU GPL v2 (see License.txt)
-# This Revision: $Id: Makefile 798 2010-07-27 17:29:28Z cs $
 
 ###############################################################################
 # Configure the following variables according to your AVR.
 #     make lock    # to protect the boot loader from overwriting
 
 F_CPU = 16000000
-DEVICE = atmega168
+DEVICE = atmega8
+
 # BOOTLOADER_ADDRESS is 1800 for 8k devices, 3800 for 16k and 7800 for 32k.
-BOOTLOADER_ADDRESS = 3800
-FUSEOPT = $(FUSEOPT_168)
-LOCKOPT = -U lock:w:0x2f:m
+BOOTLOADER_ADDRESS = 1800
 
-PROGRAMMER = -c stk500v2 -P avrdoper
 # PROGRAMMER contains AVRDUDE options to address your programmer
+# PROGRAMMER = -c pony-stk200
+PROGRAMMER = -c usbasp
+
+#  since USBaspLoader supports HAVE_BLB11_SOFTW_LOCKBIT...
+LOCKOPT = -U lock:w:0x3f:m
+FUSEOPT = $(FUSEOPT_8)
+
+
+# standard atmega8 needs BODLEVEL to be programed, since it is a 5V device
+# you may also want to UNprogram  SUT1 to get a SLOWER bootup (lfuse then would be 0x3f)
+FUSEOPT_8 = -U hfuse:w:0xc0:m -U lfuse:w:0x1f:m
 
-FUSEOPT_8 = -U hfuse:w:0xc0:m -U lfuse:w:0x9f:m
 FUSEOPT_88 = -U hfuse:w:0xd6:m -U lfuse:w:0xdf:m -U efuse:w:0x00:m
 FUSEOPT_168 = -U hfuse:w:0xd6:m -U lfuse:w:0xdf:m -U efuse:w:0x00:m
 FUSEOPT_328 = -U lfuse:w:0xf7:m -U hfuse:w:0xda:m -U efuse:w:0x03:m
@@ -100,13 +107,13 @@ FUSEOPT_328 = -U lfuse:w:0xf7:m -U hfuse:w:0xda:m -U efuse:w:0x03:m
 ###############################################################################
 
 # Tools:
-AVRDUDE = avrdude $(PROGRAMMER) -p $(DEVICE)
+AVRDUDE = @echo avrdude $(PROGRAMMER) -p $(DEVICE)
 CC = avr-gcc
 
 # Options:
 DEFINES = #-DDEBUG_LEVEL=2
 # Remove the -fno-* options when you use gcc 3, it does not understand them
-CFLAGS = -Wall -Os -fno-move-loop-invariants -fno-tree-scev-cprop -fno-inline-small-functions -I. -mmcu=$(DEVICE) -DF_CPU=$(F_CPU) $(DEFINES)
+CFLAGS = -Wall -Os -fno-move-loop-invariants -fno-tree-scev-cprop -fno-inline-small-functions -I. -mmcu=$(DEVICE) -DBOOTLOADER_ADDRESS=0x$(BOOTLOADER_ADDRESS) -DF_CPU=$(F_CPU) $(DEFINES)
 LDFLAGS = -Wl,--relax,--gc-sections -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS)
 
 OBJECTS =  usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o
@@ -142,6 +149,9 @@ lock:
 read_fuses:
        $(UISP) --rd_fuses
 
+deepclean: clean
+       rm -f *~
+
 clean:
        rm -f main.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s
 
@@ -152,7 +162,7 @@ main.bin:   $(OBJECTS)
 main.hex:      main.bin
        rm -f main.hex main.eep.hex
        avr-objcopy -j .text -j .data -O ihex main.bin main.hex
-       avr-size main.hex
+       avr-size main.bin
 
 disasm:        main.bin
        avr-objdump -d main.bin