aboutsummaryrefslogtreecommitdiff
path: root/ports/nrf/Makefile
diff options
context:
space:
mode:
authorJim Mussared2020-04-20 16:22:28 +1000
committerDamien George2020-05-15 15:06:02 +1000
commitcd9a8c174209c869bd590e8408503dc20863c291 (patch)
tree65dda3de5b7821b1ea4a03b125a5b39e26e8697d /ports/nrf/Makefile
parent1f1b78752f0c2d777f97e34b652de43371834147 (diff)
nrf: Add openocd as a supported flasher.
Tested with the Particle Debugger on a Xenon.
Diffstat (limited to 'ports/nrf/Makefile')
-rw-r--r--ports/nrf/Makefile18
1 files changed, 18 insertions, 0 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index b6602de0b..23d5cd20d 100644
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -419,6 +419,24 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).elf
-ex 'quit' \
$<
+else ifeq ($(FLASHER), openocd)
+
+OPENOCD ?= openocd
+
+ifeq ($(MCU_VARIANT), nrf51)
+OPENOCD_TARGET ?= target/nrf52.cfg
+else ifeq ($(MCU_VARIANT), nrf52)
+OPENOCD_TARGET ?= target/nrf52.cfg
+else
+$(error Unsupported openocd target)
+endif
+
+deploy: $(BUILD)/$(OUTPUT_FILENAME).hex
+ $(Q)$(OPENOCD) -f interface/cmsis-dap.cfg -f $(OPENOCD_TARGET) -c "init" -c "program $< verify reset" -c "exit"
+
+sd: $(BUILD)/$(OUTPUT_FILENAME).hex
+ $(Q)$(OPENOCD) -f interface/cmsis-dap.cfg -f $(OPENOCD_TARGET) -c "init" -c "program $(SOFTDEV_HEX) verify reset" -c "exit"
+
endif
flash: deploy