diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2019-08-23 22:23:11 +1000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2019-09-05 22:56:05 +1000 |
commit | d36fc4682ebd8409bbcba00948da74b55bdeb3ce (patch) | |
tree | ea569e059c2e58e0ee5ed6e64fbe09d1aaeafa71 | |
parent | 353ed7705f36e1f88b02c170cb2c578d80e2c622 (diff) |
nrf/Makefile: Add support for flashing with a Black Magic Probe.
Also rename "flash" target to "deploy" to match other ports (but provide
"flash" as an alias for backwards compatibility).
-rw-r--r-- | ports/nrf/Makefile | 43 |
1 files changed, 38 insertions, 5 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index cc7b4f126..c02109a15 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -101,7 +101,7 @@ LDFLAGS += -Wl,--gc-sections endif -CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES)) +CFLAGS += $(CFLAGS_MCU_$(MCU_SERIES)) CFLAGS += $(INC) -Wall -Werror -g -ansi -std=c11 -nostdlib $(COPT) $(NRF_DEFINES) $(CFLAGS_MOD) CFLAGS += -fno-strict-aliasing CFLAGS += -Iboards/$(BOARD) @@ -254,7 +254,7 @@ OBJ += $(BUILD)/pins_gen.o $(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os $(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os -.PHONY: all flash sd binary hex +.PHONY: all flash deploy sd binary hex all: binary hex @@ -276,7 +276,7 @@ FLASHER ?= ifeq ($(FLASHER),) -flash: $(BUILD)/$(OUTPUT_FILENAME).hex +deploy: $(BUILD)/$(OUTPUT_FILENAME).hex nrfjprog --program $< --sectorerase -f $(MCU_VARIANT) nrfjprog --reset -f $(MCU_VARIANT) @@ -288,7 +288,7 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).hex else ifeq ($(FLASHER), pyocd) -flash: $(BUILD)/$(OUTPUT_FILENAME).hex +deploy: $(BUILD)/$(OUTPUT_FILENAME).hex pyocd-flashtool -t $(MCU_VARIANT) $< sd: $(BUILD)/$(OUTPUT_FILENAME).hex @@ -298,14 +298,47 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).hex else ifeq ($(FLASHER), idap) -flash: $(BUILD)/$(OUTPUT_FILENAME).hex +deploy: $(BUILD)/$(OUTPUT_FILENAME).hex IDAPnRFPRog $< sd: $(BUILD)/$(OUTPUT_FILENAME).hex IDAPnRFPRog $(SOFTDEV_HEX) $< +else ifeq ($(FLASHER), bmp) + +BMP_PORT ?= /dev/ttyACM0 + +deploy: $(BUILD)/$(OUTPUT_FILENAME).elf + $(Q)$(GDB) \ + -ex 'target extended-remote $(BMP_PORT)' \ + -ex 'monitor tpwr enable' \ + -ex 'monitor swdp_scan' \ + -ex 'attach 1' \ + -ex 'set mem inaccessible-by-default off' \ + -ex 'load' \ + -ex 'kill' \ + -ex 'quit' \ + $< + +sd: $(BUILD)/$(OUTPUT_FILENAME).elf + $(Q)$(GDB) \ + -ex 'target extended-remote $(BMP_PORT)' \ + -ex 'monitor tpwr enable' \ + -ex 'monitor swdp_scan' \ + -ex 'attach 1' \ + -ex 'set mem inaccessible-by-default off' \ + -ex 'monitor erase_mass' \ + -ex 'load' \ + -ex 'file $(SOFTDEV_HEX)' \ + -ex 'load' \ + -ex 'kill' \ + -ex 'quit' \ + $< + endif +flash: deploy + $(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ) $(ECHO) "LINK $@" $(Q)$(CC) $(LDFLAGS) -o $@ $(OBJ) $(LIBS) |