summaryrefslogtreecommitdiff
path: root/tmk_core/avr.mk
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/avr.mk')
-rw-r--r--tmk_core/avr.mk34
1 files changed, 18 insertions, 16 deletions
diff --git a/tmk_core/avr.mk b/tmk_core/avr.mk
index ccecdb1929..4af34ba574 100644
--- a/tmk_core/avr.mk
+++ b/tmk_core/avr.mk
@@ -12,7 +12,7 @@ HEX = $(OBJCOPY) -O $(FORMAT) -R .eeprom -R .fuse -R .lock -R .signature
EEP = $(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" --change-section-lma .eeprom=0 --no-change-warnings -O $(FORMAT)
BIN =
-
+COMMON_VPATH += $(DRIVER_PATH)/avr
COMPILEFLAGS += -funsigned-char
COMPILEFLAGS += -funsigned-bitfields
@@ -87,11 +87,13 @@ DEBUG_PORT = 4242
DEBUG_HOST = localhost
#============================================================================
-# Autodecct teensy loader
-ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
- TEENSY_LOADER_CLI ?= teensy-loader-cli
-else
- TEENSY_LOADER_CLI ?= teensy_loader_cli
+# Autodetect teensy loader
+ifndef TEENSY_LOADER_CLI
+ ifneq (, $(shell which teensy-loader-cli 2>/dev/null))
+ TEENSY_LOADER_CLI ?= teensy-loader-cli
+ else
+ TEENSY_LOADER_CLI ?= teensy_loader_cli
+ endif
endif
# Program the device.
@@ -115,11 +117,11 @@ dfu: $(BUILD_DIR)/$(TARGET).hex sizeafter
echo "Error: Bootloader not found. Trying again in 5s." ;\
sleep 5 ;\
done
-ifneq (, $(findstring 0.7, $(shell $(DFU_PROGRAMMER) --version 2>&1)))
- $(DFU_PROGRAMMER) $(MCU) erase --force
-else
- $(DFU_PROGRAMMER) $(MCU) erase
-endif
+ if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
+ $(DFU_PROGRAMMER) $(MCU) erase --force;\
+ else\
+ $(DFU_PROGRAMMER) $(MCU) erase;\
+ fi
$(DFU_PROGRAMMER) $(MCU) flash $(BUILD_DIR)/$(TARGET).hex
$(DFU_PROGRAMMER) $(MCU) reset
@@ -135,11 +137,11 @@ flip-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
$(REMOVE) $(BUILD_DIR)/$(TARGET)eep.hex
dfu-ee: $(BUILD_DIR)/$(TARGET).hex $(BUILD_DIR)/$(TARGET).eep
-ifneq (, $(findstring 0.7, $(shell dfu-programmer --version 2>&1)))
- $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep
-else
- $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep
-endif
+ if $(DFU_PROGRAMMER) --version 2>&1 | grep -q 0.7 ; then\
+ $(DFU_PROGRAMMER) $(MCU) flash --eeprom $(BUILD_DIR)/$(TARGET).eep;\
+ else\
+ $(DFU_PROGRAMMER) $(MCU) flash-eeprom $(BUILD_DIR)/$(TARGET).eep;\
+ fi
$(DFU_PROGRAMMER) $(MCU) reset
# Convert hex to bin.