X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/blobdiff_plain/e818fbb5f39d790ab62316ab5800c9c9c0b46ac3..ba52fbce443a159a16b8a04bb362eef9ee8a902f:/firmware/Makefile diff --git a/firmware/Makefile b/firmware/Makefile index 75eeacf..f6b9170 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -4,6 +4,7 @@ # Creation Date: 2007-12-10 # Author: Stephan Bärwolf # Improvement Date: 2012-07-31 +# Improvement Date: 2012-09-12 # Tabsize: 4 # Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH # License: GNU GPL v2 (see License.txt) @@ -17,41 +18,50 @@ include ../Makefile.inc -# 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) -DBOOTLOADER_ADDRESS=$(BOOTLOADER_ADDRESS) -DF_CPU=$(F_CPU) $(DEFINES) -LDFLAGS = -Wl,--relax,--gc-sections -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS) +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) +LDFLAGS = -Wl,--relax,--gc-sections -Wl,--section-start=.text=$(BOOTLOADER_ADDRESS) -Wl,--defsym=nullVector=0 -OBJECTS = usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o +DEPENDS = bootloaderconfig.h ../Makefile.inc # symbolic targets: -all: main.hex +all: main.hex $(DEPENDS) -.c.o: - $(CC) $(CFLAGS) -c $< -o $@ +usbdrv/usbdrvasm.o: usbdrv/usbdrvasm.S $(DEPENDS) + $(CC) -x assembler-with-cpp -c usbdrv/usbdrvasm.S -o usbdrv/usbdrvasm.o $(CFLAGS) -.S.o: - $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@ -# "-x assembler-with-cpp" should not be necessary since this is the default -# file type for the .S (with capital S) extension. However, upper case -# characters are not always preserved on Windows. To ensure WinAVR -# compatibility define the file type manually. +usbdrv/oddebug.o: usbdrv/oddebug.c $(DEPENDS) + $(CC) usbdrv/oddebug.c -c -o usbdrv/oddebug.o $(CFLAGS) -.c.s: - $(CC) $(CFLAGS) -S $< -o $@ +main.o: main.c $(DEPENDS) + $(CC) main.c -c -o main.o $(CFLAGS) flash: all + $(ECHO) "." $(AVRDUDE) -U flash:w:main.hex:i + $(ECHO) "." + $(ECHO) "." readflash: + $(ECHO) "." $(AVRDUDE) -U flash:r:read.hex:i + $(ECHO) "." + $(ECHO) "." + fuse: + $(ECHO) "." $(AVRDUDE) $(FUSEOPT) + $(ECHO) "." + $(ECHO) "." + lock: + $(ECHO) "." $(AVRDUDE) $(LOCKOPT) + $(ECHO) "." + $(ECHO) "." + read_fuses: $(UISP) --rd_fuses @@ -59,20 +69,41 @@ read_fuses: deepclean: clean $(RM) *~ -clean: - $(RM) main.hex main.bin *.o usbdrv/*.o main.s usbdrv/oddebug.s usbdrv/usbdrv.s +clean: + $(RM) main.hex + $(RM) main.asm + $(RM) main.map + $(RM) main.elf + $(RM) main.o + $(RM) main.s + $(RM) usbdrv/usbdrvasm.o + $(RM) usbdrv/oddebug.o + $(RM) usbdrv/oddebug.s + $(RM) usbdrv/usbdrv.s # file targets: -main.bin: $(OBJECTS) - $(CC) $(CFLAGS) -o main.bin $(OBJECTS) $(LDFLAGS) +main.elf: usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o $(DEPENDS) + $(CC) $(CFLAGS) -o main.elf usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o -Wl,-Map,main.map $(LDFLAGS) -main.hex: main.bin - $(RM) main.hex main.eep.hex - $(OBC) -j .text -j .data -O ihex main.bin main.hex - $(SIZ) main.bin - -disasm: main.bin - $(OBD) -d main.bin +main.asm: main.elf $(DEPENDS) + $(OBD) -Stdr main.elf > main.asm -cpp: +main.hex: main.elf main.asm $(DEPENDS) + $(RM) main.hex main.eep.hex + $(OBC) -j .text -j .data -O ihex main.elf main.hex + $(ECHO) "." + $(ECHO) "." + $(ECHO) "." + $(ECHO) "!!!ATTANTION!!!" + $(ECHO) "(data+text) MUST fit into your MCUs bootloader section" + $(ECHO) "." + $(SIZ) --mcu $(DEVICE) main.elf + $(ECHO) "." + $(ECHO) "." + $(ECHO) "." + +disasm: main.elf $(DEPENDS) + $(OBD) -d main.elf + +cpp: $(DEPENDS) $(CC) $(CFLAGS) -E main.c