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'.

This commit is contained in:
Glenn Ruben Bakke 2017-01-03 17:00:06 +01:00
parent 4b6a12a251
commit 31569dc952
1 changed files with 11 additions and 0 deletions

View File

@ -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)