1
0
Fork 0

Don't run dfu-programmer unless specified as a target

This introduces a grep dependency, which I believe we didn't have
before, but it should be available and installed by default on all the
supported systems.
This commit is contained in:
Fred Sundvik 2017-07-10 13:46:39 +03:00 committed by Jack Humbert
parent fcd08b8c7d
commit 7ea8753b72

View file

@ -115,11 +115,11 @@ dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
echo "Error: Bootloader not found. Trying again in 5s." ;\ echo "Error: Bootloader not found. Trying again in 5s." ;\
sleep 5 ;\ sleep 5 ;\
done done
ifneq (, $(findstring 0.7, $(shell $(DFU_PROGRAMMER) --version 2>&1))) if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
$(DFU_PROGRAMMER) $(MCU) erase --force $(DFU_PROGRAMMER) $(MCU) erase --force;\
else else\
$(DFU_PROGRAMMER) $(MCU) erase $(DFU_PROGRAMMER) $(MCU) erase;\
endif fi
$(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex $(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
$(DFU_PROGRAMMER) $(MCU) reset $(DFU_PROGRAMMER) $(MCU) reset
@ -135,11 +135,11 @@ flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
$(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex $(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1))) if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
$(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\
else else\
$(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\
endif fi
$(DFU_PROGRAMMER) $(MCU) reset $(DFU_PROGRAMMER) $(MCU) reset
# Convert hex to bin. # Convert hex to bin.