From: Stephan Baerwolf Date: Mon, 26 Aug 2013 18:04:29 +0000 (+0200) Subject: cleanup and extend Makefiles X-Git-Tag: testing-head~28 X-Git-Url: http://git.linex4red.de/pub/USBaspLoader.git/commitdiff_plain/46e5d78c08ff324cf95cc1a11ca2234feddb7713?ds=inline cleanup and extend Makefiles Signed-off-by: Stephan Baerwolf --- diff --git a/firmware/Makefile b/firmware/Makefile index df886aa..486003f 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -18,7 +18,7 @@ include ../Makefile.inc # 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) +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 @@ -74,7 +74,9 @@ deepclean: clean clean: $(RM) main.hex - $(RM) main.bin + $(RM) main.asm + $(RM) main.map + $(RM) main.elf $(RM) main.o $(RM) main.s $(RM) usbdrv/usbdrvasm.o @@ -83,25 +85,28 @@ clean: $(RM) usbdrv/usbdrv.s # file targets: -main.bin: $(OBJECTS) bootloaderconfig.h - $(CC) $(CFLAGS) -o main.bin $(OBJECTS) $(LDFLAGS) +main.elf: $(OBJECTS) bootloaderconfig.h + $(CC) $(CFLAGS) -o main.elf $(OBJECTS) -Wl,-Map,main.map $(LDFLAGS) -main.hex: main.bin +main.asm: main.elf + $(OBD) -Stdr main.elf > main.asm + +main.hex: main.elf main.asm $(RM) main.hex main.eep.hex - $(OBC) -j .text -j .data -O ihex main.bin main.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.bin + $(SIZ) --mcu $(DEVICE) main.elf $(ECHO) "." $(ECHO) "." $(ECHO) "." -disasm: main.bin - $(OBD) -d main.bin +disasm: main.elf + $(OBD) -d main.elf cpp: $(CC) $(CFLAGS) -E main.c diff --git a/updater/Makefile b/updater/Makefile index 7764cad..6c677ed 100644 --- a/updater/Makefile +++ b/updater/Makefile @@ -8,7 +8,7 @@ include ../Makefile.inc # elsewise gcc would complain unnecessary -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) +CFLAGS = -Wall -Wno-pointer-to-int-cast -Os -g3 -ggdb -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) -DFLASHADDRESS=$(FLASHADDRESS) $(DEFINES) LDFLAGS = -Wl,--relax,--gc-sections ifneq ($(FLASHADDRESS), 0) @@ -43,12 +43,12 @@ flash: all $(ECHO) "." -../firmware/main.bin: +../firmware/main.elf: $(MAKE) -C ../firmware main.hex -usbasploader.raw: ../firmware/main.bin - $(OBC) -j .text -j .data -O binary ../firmware/main.bin usbasploader.raw +usbasploader.raw: ../firmware/main.elf + $(OBC) -j .text -j .data -O binary ../firmware/main.elf usbasploader.raw usbasploader.o: usbasploader.raw $(OBC) -B $(MCUARCH) -I binary -O elf32-avr --rename-section .data=.text --redefine-sym _binary_usbasploader_raw_start=usbasploader usbasploader.raw usbasploader.o @@ -59,9 +59,12 @@ updater.o: updater.c usbasploader.h usbasploader.raw usbasploader.o # $(CC) updater.c -c -o updater.o $(CFLAGS) updater.elf: updater.o usbasploader.o - $(CC) updater.o usbasploader.o -o updater.elf $(CFLAGS) $(LDFLAGS) + $(CC) updater.o usbasploader.o -o updater.elf -Wl,-Map,updater.map $(CFLAGS) $(LDFLAGS) -updater.hex: updater.elf +updater.asm: updater.elf + $(OBD) -Stdr updater.elf > updater.asm + +updater.hex: updater.elf updater.asm $(OBC) -j .text -j .data -O ihex updater.elf updater.hex $(ECHO) "." $(ECHO) "." @@ -76,5 +79,7 @@ clean: $(RM) updater.o $(RM) usbasploader.raw $(RM) updater.hex + $(RM) updater.asm $(RM) updater.elf + $(RM) updater.map $(RM) usbasploader.raw \ No newline at end of file