aboutsummaryrefslogtreecommitdiff
path: root/ports/nrf
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
parent1f1b78752f0c2d777f97e34b652de43371834147 (diff)
nrf: Add openocd as a supported flasher.
Tested with the Particle Debugger on a Xenon.
Diffstat (limited to 'ports/nrf')
-rw-r--r--ports/nrf/Makefile18
-rw-r--r--ports/nrf/boards/particle_xenon/mpconfigboard.mk4
2 files changed, 22 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
diff --git a/ports/nrf/boards/particle_xenon/mpconfigboard.mk b/ports/nrf/boards/particle_xenon/mpconfigboard.mk
index ca555d393..34bead59f 100644
--- a/ports/nrf/boards/particle_xenon/mpconfigboard.mk
+++ b/ports/nrf/boards/particle_xenon/mpconfigboard.mk
@@ -5,3 +5,7 @@ SOFTDEV_VERSION = 6.1.1
LD_FILES += boards/nrf52840_1M_256k.ld
NRF_DEFINES += -DNRF52840_XXAA
+
+# The nrf52-particle.cfg is not included here, it can be found in the Particle Workbench
+# Note: This requires openocd >0.10
+OPENOCD_TARGET ?= boards/$(BOARD)/nrf52-particle.cfg