X-Git-Url: https://git.friedersdorff.com/?a=blobdiff_plain;f=rules.mk;h=060f660c94aab66ff8de8905ceff823ed0060f35;hb=3d81d5221eac9ca9620ba9043a250dcb8371b22e;hp=f1d0a301caf653e401749ad31db9b22b474bfcf1;hpb=e67c988824f5ec0c965beb412f8ee5953dfd3c8c;p=max%2Ftmk_keyboard.git diff --git a/rules.mk b/rules.mk index f1d0a301..060f660c 100644 --- a/rules.mk +++ b/rules.mk @@ -109,8 +109,10 @@ CFLAGS += -O$(OPT) CFLAGS += -funsigned-char CFLAGS += -funsigned-bitfields CFLAGS += -ffunction-sections +CFLAGS += -fno-inline-small-functions CFLAGS += -fpack-struct CFLAGS += -fshort-enums +CFLAGS += -fno-strict-aliasing CFLAGS += -Wall CFLAGS += -Wstrict-prototypes #CFLAGS += -mshort-calls @@ -121,7 +123,9 @@ CFLAGS += -Wstrict-prototypes CFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) CFLAGS += $(CSTANDARD) -CFLAGS += -include $(CONFIG_H) +ifdef CONFIG_H + CFLAGS += -include $(CONFIG_H) +endif #---------------- Compiler Options C++ ---------------- @@ -149,7 +153,9 @@ CPPFLAGS += -Wundef CPPFLAGS += -Wa,-adhlns=$(@:%.o=%.lst) CPPFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) #CPPFLAGS += $(CSTANDARD) -CPPFLAGS += -include $(CONFIG_H) +ifdef CONFIG_H + CPPFLAGS += -include $(CONFIG_H) +endif #---------------- Assembler Options ---------------- @@ -162,7 +168,9 @@ CPPFLAGS += -include $(CONFIG_H) # -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 += -include $(CONFIG_H) +ifdef CONFIG_H + ASFLAGS += -include $(CONFIG_H) +endif #---------------- Library Options ---------------- @@ -230,6 +238,8 @@ LDFLAGS += $(EXTMEMOPTS) LDFLAGS += $(patsubst %,-L%,$(EXTRALIBDIRS)) LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) #LDFLAGS += -T linker_script.x +# You can give EXTRALDFLAGS at 'make' command line. +LDFLAGS += $(EXTRALDFLAGS) @@ -315,9 +325,10 @@ GENDEPFLAGS = -MMD -MP -MF .dep/$(@F).d # Combine all necessary flags and optional flags. # Add target processor to flags. -ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) -ALL_CPPFLAGS = -mmcu=$(MCU) -I. -x c++ $(CPPFLAGS) $(GENDEPFLAGS) -ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) +# 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) @@ -378,6 +389,30 @@ gccversion : program: $(TARGET).hex $(TARGET).eep $(PROGRAM_CMD) +teensy: $(TARGET).hex + teensy_loader_cli -mmcu=$(MCU) -w -v $(TARGET).hex + +flip: $(TARGET).hex + batchisp -hardware usb -device $(MCU) -operation erase f + batchisp -hardware usb -device $(MCU) -operation loadbuffer $(TARGET).hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + +dfu: $(TARGET).hex + dfu-programmer $(MCU) erase + dfu-programmer $(MCU) flash $(TARGET).hex + dfu-programmer $(MCU) reset + +flip-ee: $(TARGET).hex $(TARGET).eep + $(COPY) $(TARGET).eep $(TARGET)eep.hex + batchisp -hardware usb -device $(MCU) -operation memory EEPROM erase + batchisp -hardware usb -device $(MCU) -operation memory EEPROM loadbuffer $(TARGET)eep.hex program + batchisp -hardware usb -device $(MCU) -operation start reset 0 + $(REMOVE) $(TARGET)eep.hex + +dfu-ee: $(TARGET).hex $(TARGET).eep + dfu-programmer $(MCU) eeprom-flash $(TARGET).eep + dfu-programmer $(MCU) reset + # Generate avr-gdb config/init file which does the following: # define the reset signal, load the target file, connect to target, and set @@ -479,6 +514,7 @@ extcoff: $(TARGET).elf # Compile: create object files from C source files. $(OBJDIR)/%.o : %.c @echo + mkdir -p $(@D) @echo $(MSG_COMPILING) $< $(CC) -c $(ALL_CFLAGS) $< -o $@ @@ -529,7 +565,7 @@ clean_list : $(REMOVE) $(OBJ:.o=.s) $(REMOVE) $(OBJ:.o=.i) $(REMOVE) -r .dep - $(REMOVEDIR) $(OBJDIR) + $(REMOVE) -r $(OBJDIR) # Create object files directory