Last active
August 29, 2015 14:06
-
-
Save projectgus/8dab3f891c9bd694fc5f to your computer and use it in GitHub Desktop.
Looking for a nice way to have openocd upload via an existing instance if it exists, or run standalone if not
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
install: $(APP).elf | |
# try to upload via a running openocd instance first, if that | |
# fails then fail over to running openocd program | |
( echo "halt; flash write_image erase $(APP).elf; reset" | nc localhost 4444 ) || \ | |
$(OPENOCD) --command "program $(APP).elf; reset" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For future reference, the answer is:
netcat-traditional on Debian has undesirable behaviour with this snippet (you have to Ctrl-C out of netcat manually if openocd is running, because EOF from the input pipe doesn't close the TCP connection and exit netcat.)
netcat-openbsd on Debian has desirable behaviour (EOF from the input pipe does close the connection and exit netcat.)
So run netcat-openbsd or similar and life is good...
(Thanks Nattgris on #openocd for providing the key "this works for me" clue.)