summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorarturo182 <arturo182@tlen.pl>2018-07-13 15:17:30 +0200
committerarturo182 <arturo182@tlen.pl>2018-07-13 15:22:46 +0200
commit883ca21321aa5938dfb46349454057ce481c0885 (patch)
tree75b703a406f44a15cf3949509336c1284163e77f
parent75f48a5bc7a4695bddd16cce0e2176bd809aaf5c (diff)
nrf: Fix flashing with pyocd
-rwxr-xr-xports/nrf/Makefile20
1 files changed, 14 insertions, 6 deletions
diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile
index 5bbeb17e3..586b0cbbd 100755
--- a/ports/nrf/Makefile
+++ b/ports/nrf/Makefile
@@ -132,7 +132,7 @@ SRC_C += \
lib/tinyusb/src/class/msc/msc_device.c \
lib/tinyusb/src/class/cdc/cdc_device.c \
lib/tinyusb/src/tusb.c \
-
+
endif
DRIVERS_SRC_C += $(addprefix modules/,\
@@ -275,16 +275,24 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).hex
bootloader:
nrfjprog --program $(BOOT_FILE).hex -f nrf52 --chiperase --reset
-
+
else ifeq ($(FLASHER), pyocd)
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
- pyocd-flashtool -t $(MCU_VARIANT) $<
+ pyocd-flashtool -t $(MCU_SUB_VARIANT) $< --sector_erase
+ pyocd-tool -t $(MCU_SUB_VARIANT) erase $(BOOT_SETTING_ADDR)
+ pyocd-tool -t $(MCU_SUB_VARIANT) write32 $(BOOT_SETTING_ADDR) 0x00000001
+ pyocd-tool -t $(MCU_SUB_VARIANT) reset
sd: $(BUILD)/$(OUTPUT_FILENAME).hex
- pyocd-flashtool -t $(MCU_VARIANT) --chip_erase
- pyocd-flashtool -t $(MCU_VARIANT) $(SOFTDEV_HEX)
- pyocd-flashtool -t $(MCU_VARIANT) $<
+ pyocd-flashtool -t $(MCU_SUB_VARIANT) --chip_erase
+ pyocd-flashtool -t $(MCU_SUB_VARIANT) $(SOFTDEV_HEX)
+ pyocd-flashtool -t $(MCU_SUB_VARIANT) $< --sector_erase
+ pyocd-tool -t $(MCU_SUB_VARIANT) reset $(BOOT_SETTING_ADDR)
+
+bootloader:
+ pyocd-flashtool -t $(MCU_SUB_VARIANT) $(BOOT_FILE).hex --chip_erase
+ pyocd-tool -t $(MCU_SUB_VARIANT) reset
endif