From: Kevin Rosenberg Date: Sun, 30 Mar 2008 18:58:04 +0000 (-0600) Subject: Improve makefiles with more listing outputs as well as stop linker crashes using... X-Git-Url: http://git.kpe.io/?p=avr_bc100.git;a=commitdiff_plain;h=7997f136b12114035265bd082c854bff95fd73dc Improve makefiles with more listing outputs as well as stop linker crashes using -Wl,-gc-sections --- diff --git a/BaseTinyFirmware/GCC/ChangeLog b/BaseTinyFirmware/GCC/ChangeLog index 87d741b..9c5d2d5 100644 --- a/BaseTinyFirmware/GCC/ChangeLog +++ b/BaseTinyFirmware/GCC/ChangeLog @@ -1,3 +1,8 @@ +2008-03-30 Kevin Rosenberg + * GCC Makefile's improved with more listing output as well as + added -Wl,-gc-sections option which stops crashes using linker + relaxation [thanks to Eric Weddington] + 2008-03-28 Kevin Rosenberg * BaseTinyFirmware/GCC/avr463/Makefile: Added -Wl,-relax to linker flags. On my system this crashes avr-ld.exe, but others have reported diff --git a/BaseTinyFirmware/GCC/avr458/Makefile b/BaseTinyFirmware/GCC/avr458/Makefile index 38e74fb..412aa8d 100644 --- a/BaseTinyFirmware/GCC/avr458/Makefile +++ b/BaseTinyFirmware/GCC/avr458/Makefile @@ -13,8 +13,10 @@ COMMON = -mmcu=$(MCU) ## Compile options common for all C compilation units. CFLAGS = $(COMMON) -CFLAGS += -Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -DLIION -CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +CFLAGS += -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections +CFLAGS += -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=./$(*F).lst +CFLAGS += -MMD -MP -MF dep/$(@F).d +CFLAGS += -DLIION ## Assembly specific flags ASMFLAGS = $(COMMON) @@ -23,12 +25,10 @@ ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 ## Linker flags LDFLAGS = $(COMMON) -LDFLAGS += -Wl,-Map=$(PROJECT).map -Wl,--relax - +LDFLAGS += -Wl,-Map=$(PROJECT).map,--cref -Wl,-gc-sections -Wl,-relax ## Intel Hex file production flags HEX_FLASH_FLAGS = -R .eeprom - HEX_EEPROM_FLAGS = -j .eeprom HEX_EEPROM_FLAGS += --set-section-flags=.eeprom="alloc,load" HEX_EEPROM_FLAGS += --change-section-lma .eeprom=0 --no-change-warnings @@ -100,7 +100,7 @@ size: ${TARGET} ## Clean target .PHONY: clean clean: - -rm -rf $(OBJECTS) $(PROJECT).elf dep $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss $(PROJECT).map + -rm -rf $(OBJECTS) $(PROJECT).elf dep $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss $(PROJECT).map *.lst ## Other dependencies diff --git a/BaseTinyFirmware/GCC/avr463/Makefile b/BaseTinyFirmware/GCC/avr463/Makefile index fd8c0f6..c2c00b0 100644 --- a/BaseTinyFirmware/GCC/avr463/Makefile +++ b/BaseTinyFirmware/GCC/avr463/Makefile @@ -13,8 +13,10 @@ COMMON = -mmcu=$(MCU) ## Compile options common for all C compilation units. CFLAGS = $(COMMON) -CFLAGS += -Wall -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -DNIMH -CFLAGS += -MD -MP -MT $(*F).o -MF dep/$(@F).d +CFLAGS += -gdwarf-2 -std=gnu99 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -ffunction-sections +CFLAGS += -Wall -Wstrict-prototypes -Wundef -Wa,-adhlns=./$(*F).lst +CFLAGS += -MMD -MP -MF dep/$(@F).d +CFLAGS += -DNIMH ## Assembly specific flags ASMFLAGS = $(COMMON) @@ -23,7 +25,7 @@ ASMFLAGS += -x assembler-with-cpp -Wa,-gdwarf2 ## Linker flags LDFLAGS = $(COMMON) -LDFLAGS += -Wl,-Map=$(PROJECT).map -Wl,--relax +LDFLAGS += -Wl,-Map=$(PROJECT).map,--cref -Wl,-gc-sections -Wl,-relax ## Intel Hex file production flags @@ -100,7 +102,7 @@ size: ${TARGET} ## Clean target .PHONY: clean clean: - -rm -rf $(OBJECTS) $(PROJECT).elf dep $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss $(PROJECT).map + -rm -rf $(OBJECTS) $(PROJECT).elf dep $(PROJECT).hex $(PROJECT).eep $(PROJECT).lss $(PROJECT).map *.lst ## Other dependencies