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