X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=rules.mk;h=7a40d1de9f4ae5a05015a9896b1dec0cb434a3c3;hb=fa545c87f74833856761572ef631d20accc1d026;hp=a58de2f11b096c070396920db1a405bf9a16dd47;hpb=cc68adeb5744cba9e8650bab04ff0f0a4033db9f;p=tmk_firmware.git diff --git a/rules.mk b/rules.mk index a58de2f..7a40d1d 100644 --- a/rules.mk +++ b/rules.mk @@ -158,6 +158,10 @@ CPPFLAGS += -funsigned-bitfields CPPFLAGS += -fpack-struct CPPFLAGS += -fshort-enums CPPFLAGS += -fno-exceptions +CPPFLAGS += -ffunction-sections +CPPFLAGS += -fdata-sections +# to supress "warning: only initialized variables can be placed into program memory area" +CPPFLAGS += -w CPPFLAGS += -Wall CPPFLAGS += -Wundef #CPPFLAGS += -mshort-calls @@ -183,6 +187,7 @@ endif # -listing-cont-lines: Sets the maximum number of continuation lines of hex # dump that will be displayed for a given single line of source input. ASFLAGS = $(ADEFS) -Wa,-adhlns=$(@:%.o=%.lst),-gstabs,--listing-cont-lines=100 +ASFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) ifdef CONFIG_H ASFLAGS += -include $(CONFIG_H) endif @@ -247,7 +252,7 @@ EXTMEMOPTS = # (.vectors+0x30): relocation truncated to fit: R_AVR_13_PCREL against symbol `__vector_12' # LDFLAGS = -Wl,-Map=$(TARGET).map,--cref -LDFLAGS += -Wl,--relax +#LDFLAGS += -Wl,--relax LDFLAGS += -Wl,--gc-sections LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) @@ -335,15 +340,16 @@ LST = $(patsubst %.c,$(OBJDIR)/%.lst,$(patsubst %.cpp,$(OBJDIR)/%.lst,$(patsubst # Compiler flags to generate dependency files. -GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d +#GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d +GENDEPFLAGS = -MMD -MP -MF .dep/$(subst /,_,$@).d # Combine all necessary flags and optional flags. # Add target processor to flags. # You can give extra flags at 'make' command line like: make EXTRAFLAGS=-DFOO=bar -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) +ALL_CFLAGS = -mmcu=$(MCU) $(CFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS) +ALL_CPPFLAGS = -mmcu=$(MCU) -x c++ $(CPPFLAGS) $(GENDEPFLAGS) $(EXTRAFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -x assembler-with-cpp $(ASFLAGS) $(EXTRAFLAGS) @@ -416,6 +422,10 @@ dfu: $(TARGET).hex dfu-programmer $(MCU) erase dfu-programmer $(MCU) flash $(TARGET).hex dfu-programmer $(MCU) reset + +dfu-start: + dfu-programmer $(MCU) reset + dfu-programmer $(MCU) start flip-ee: $(TARGET).hex $(TARGET).eep $(COPY) $(TARGET).eep $(TARGET)eep.hex @@ -537,6 +547,7 @@ $(OBJDIR)/%.o : %.c # Compile: create object files from C++ source files. $(OBJDIR)/%.o : %.cpp @echo + mkdir -p $(@D) @echo $(MSG_COMPILING_CPP) $< $(CC) -c $(ALL_CPPFLAGS) $< -o $@ @@ -560,7 +571,7 @@ $(OBJDIR)/%.o : %.S # Create preprocessed source for use in sending a bug report. %.i : %.c - $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + $(CC) -E -mmcu=$(MCU) $(CFLAGS) $< -o $@ # Target: clean project. @@ -599,4 +610,4 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) .PHONY : all begin finish end sizebefore sizeafter gccversion \ build elf hex eep lss sym coff extcoff \ clean clean_list debug gdb-config show_path \ -program teensy dfu flip dfu-ee flip-ee +program teensy dfu flip dfu-ee flip-ee dfu-start