From 31569dc9527d864461437b89821ed9dc6cb4e7d9 Mon Sep 17 00:00:00 2001 From: Glenn Ruben Bakke Date: Tue, 3 Jan 2017 17:00:06 +0100 Subject: [PATCH] nrf5: Makefile option to set FLASHER when doing flash target. If defined in board .mk file, this will be used, else nrfjprog will be used by default (segger). This opens up for using pyocd flashtool and still run 'make flash'. --- nrf5/Makefile | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nrf5/Makefile b/nrf5/Makefile index c5dc610d9b..2b961b4b31 100644 --- a/nrf5/Makefile +++ b/nrf5/Makefile @@ -175,6 +175,10 @@ $(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os all: $(BUILD)/firmware.elf binary hex +FLASHER ?= + +ifeq ($(FLASHER),) + flash: $(BUILD)/firmware.elf nrfjprog --program $(BUILD)/firmware.hex --sectorerase -f $(MCU_VARIANT) nrfjprog --pinreset -f $(MCU_VARIANT) @@ -185,6 +189,13 @@ sd: nrfjprog --program $(BUILD)/firmware.hex --sectorerase -f $(MCU_VARIANT) nrfjprog --pinreset -f $(MCU_VARIANT) +else ifeq ($(FLASHER), pyocd) + +flash: $(BUILD)/firmware.elf + pyocd-flashtool -t $(MCU_VARIANT) $(BUILD)/firmware.hex + +endif + $(BUILD)/firmware.elf: $(OBJ) $(ECHO) "LINK $@" $(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)