X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=rules.mk;h=83c9da5f84cd4917ff8d5908a1d3598e7b7e3893;hb=1f96edaed60def1f513ddd8adcdfa3e12b971006;hp=060f660c94aab66ff8de8905ceff823ed0060f35;hpb=dd93d2915f79d0b825fc6bbc4edb556a69eac406;p=tmk_firmware.git diff --git a/rules.mk b/rules.mk index 060f660..83c9da5 100644 --- a/rules.mk +++ b/rules.mk @@ -25,8 +25,23 @@ # # make extcoff = Convert ELF to AVR Extended COFF. # -# make program = Download the hex file to the device, using avrdude. -# Please customize the avrdude settings below first! +# make program = Download the hex file to the device. +# Please customize your programmer settings(PROGRAM_CMD) +# +# make teensy = Download the hex file to the device, using teensy_loader_cli. +# (must have teensy_loader_cli installed). +# +# make dfu = Download the hex file to the device, using dfu-programmer (must +# have dfu-programmer installed). +# +# make flip = Download the hex file to the device, using Atmel FLIP (must +# have Atmel FLIP installed). +# +# make dfu-ee = Download the eeprom file to the device, using dfu-programmer +# (must have dfu-programmer installed). +# +# make flip-ee = Download the eeprom file to the device, using Atmel FLIP +# (must have Atmel FLIP installed). # # make debug = Start either simulavr or avarice as specified for debugging, # with avr-gdb or avr-insight as the front end for debugging. @@ -143,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 @@ -168,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 @@ -232,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)) @@ -320,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) @@ -401,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 @@ -522,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 $@ @@ -539,13 +565,14 @@ $(OBJDIR)/%.o : %.cpp # Assemble: create object files from assembler source files. $(OBJDIR)/%.o : %.S @echo + mkdir -p $(@D) @echo $(MSG_ASSEMBLING) $< $(CC) -c $(ALL_ASFLAGS) $< -o $@ # 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. @@ -567,6 +594,10 @@ clean_list : $(REMOVE) -r .dep $(REMOVE) -r $(OBJDIR) +show_path: + @echo VPATH=$(VPATH) + @echo SRC=$(SRC) + # Create object files directory $(shell mkdir $(OBJDIR) 2>/dev/null) @@ -579,5 +610,5 @@ $(shell mkdir $(OBJDIR) 2>/dev/null) # Listing of phony targets. .PHONY : all begin finish end sizebefore sizeafter gccversion \ build elf hex eep lss sym coff extcoff \ -clean clean_list program debug gdb-config - +clean clean_list debug gdb-config show_path \ +program teensy dfu flip dfu-ee flip-ee dfu-start