summaryrefslogtreecommitdiff
path: root/tmk_core/avr.mk
diff options
context:
space:
mode:
authorThat-Canadian <poole.chris.11@gmail.com>2017-07-10 16:53:49 -0400
committerThat-Canadian <poole.chris.11@gmail.com>2017-07-10 16:53:49 -0400
commit55ed97af1e2fb183d2b6c34bc8659a03cbda090c (patch)
treea3950f5dbe7d12f29c2b9a77d49b4e807af87ae6 /tmk_core/avr.mk
parent1fdf3c84fe2bb10698bf528a9726aab5af12ca6d (diff)
parent07bf8522ca23a7665852bb9defff0749c76f5e91 (diff)
Merge branch 'master' into minidox
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.