From c10899d13f0d25d00bacd015e1afc3d33243a9b0 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 8 Jun 2018 15:11:17 +0700 Subject: [PATCH] allow to flash feather52 and feather52840 with jlink add crc bypass magic to bootloader settting --- ports/nrf/Makefile | 13 +++++++++++++ ports/nrf/boards/feather52/mpconfigboard.mk | 1 + ports/nrf/boards/feather52840/mpconfigboard_s140.mk | 1 + 3 files changed, 15 insertions(+) diff --git a/ports/nrf/Makefile b/ports/nrf/Makefile index 1515ea39cc..8ffc5217b1 100644 --- a/ports/nrf/Makefile +++ b/ports/nrf/Makefile @@ -291,9 +291,22 @@ FLASHER ?= ifeq ($(FLASHER),) +# Adafruit use bootloader that requires writing to its settting ( app valid = 0x0001, crc = 0x0000 ) +ifneq (,$(filter $(BOARD),feather52 feather52840)) + +flash: $(BUILD)/$(OUTPUT_FILENAME).hex + nrfjprog --program $< --sectorerase -f $(MCU_VARIANT) + nrfjprog --erasepage $(BOOT_SETTING_ADDR) -f $(MCU_VARIANT) + nrfjprog --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f $(MCU_VARIANT) + nrfjprog --reset -f $(MCU_VARIANT) + +else + flash: $(BUILD)/$(OUTPUT_FILENAME).hex nrfjprog --program $< --sectorerase -f $(MCU_VARIANT) nrfjprog --reset -f $(MCU_VARIANT) + +endif sd: $(BUILD)/$(OUTPUT_FILENAME).hex nrfjprog --eraseall -f $(MCU_VARIANT) diff --git a/ports/nrf/boards/feather52/mpconfigboard.mk b/ports/nrf/boards/feather52/mpconfigboard.mk index 7ff8684d22..eb5d421834 100644 --- a/ports/nrf/boards/feather52/mpconfigboard.mk +++ b/ports/nrf/boards/feather52/mpconfigboard.mk @@ -6,6 +6,7 @@ SOFTDEV_VERSION ?= 2.0.1 LD_FILE = boards/feather52/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld BOOTLOADER_PKG = boards/feather52/bootloader/feather52_bootloader_$(SOFTDEV_VERSION)_s132_single.zip +BOOT_SETTING_ADDR = 0x7F000 NRF_DEFINES += -DNRF52832_XXAA ifeq ($(OS),Windows_NT) diff --git a/ports/nrf/boards/feather52840/mpconfigboard_s140.mk b/ports/nrf/boards/feather52840/mpconfigboard_s140.mk index c49e3222eb..e695aa4aee 100644 --- a/ports/nrf/boards/feather52840/mpconfigboard_s140.mk +++ b/ports/nrf/boards/feather52840/mpconfigboard_s140.mk @@ -7,6 +7,7 @@ LD_FILE = boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld BOOT_UART_FILE = boards/feather52840/bootloader/uart/feather52840_bootloader_6.0.0_s140_single BOOT_USB_FILE = boards/feather52840/bootloader/usb/feather52840_bootloader_6.0.0_s140_single +BOOT_SETTING_ADDR = 0xFF000 NRF_DEFINES += -DNRF52840_XXAA ifeq ($(OS),Windows_NT)