summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Palsson <karlp@tweak.net.au>2016-03-30 17:22:52 +0000
committerKarl Palsson <karlp@tweak.net.au>2016-03-30 17:22:52 +0000
commit09ea7a8695f4e5eb770558982de706ef77c464b7 (patch)
treec90da3d99df72d6ee1a2bd5763da297d950868c2
parent614482176cffcdf7f23d022e067a94b0f89ab601 (diff)
downloadolsndot-09ea7a8695f4e5eb770558982de706ef77c464b7.tar.gz
olsndot-09ea7a8695f4e5eb770558982de706ef77c464b7.tar.bz2
olsndot-09ea7a8695f4e5eb770558982de706ef77c464b7.zip
rules: attempt to connect to a running openocd first.
-rw-r--r--rules.mk6
1 files changed, 4 insertions, 2 deletions
diff --git a/rules.mk b/rules.mk
index c063c3a..d812d73 100644
--- a/rules.mk
+++ b/rules.mk
@@ -152,12 +152,14 @@ $(PROJECT).elf: $(OBJS) $(LDSCRIPT)
%.flash: %.elf
@printf " FLASH\t$<\n"
ifeq (,$(OOCD_FILE))
- $(Q)$(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
+ $(Q)(echo "halt; program $(*).elf verify reset" | nc -4 localhost 4444 ) || \
+ $(OOCD) -f interface/$(OOCD_INTERFACE).cfg \
-f target/$(OOCD_TARGET).cfg \
-c "program $(*).elf verify reset exit" \
$(NULL)
else
- $(Q)$(OOCD) -f $(OOCD_FILE) \
+ $(Q)(echo "halt; program $(*).elf verify reset" | nc -4 localhost 4444 ) || \
+ $(OOCD) -f $(OOCD_FILE) \
-c "program $(*).elf verify reset exit" \
$(NULL)
endif