flash target update bootloader setting to skip crc checksum

This commit is contained in:
hathach 2018-06-27 15:22:44 +07:00
parent 8fbe1d73e9
commit c4f11dfd32
3 changed files with 10 additions and 16 deletions

View File

@ -226,7 +226,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_SHARED_MODULE_EXPANDED:.c=.o))
$(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os $(BUILD)/$(FATFS_DIR)/ff.o: COPT += -Os
$(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os $(filter $(PY_BUILD)/../extmod/vfs_fat_%.o, $(PY_O)): COPT += -Os
.phony: all flash sd binary hex .phony: all flash sd binary hex bootloader
all: binary hex all: binary hex
@ -252,29 +252,22 @@ FLASHER ?=
ifeq ($(FLASHER),) ifeq ($(FLASHER),)
# Adafruit use bootloader that requires writing to its settting ( app valid = 0x0001, crc = 0x0000 ) # Also update to bootloader settting to validate application and skip checksum ( app valid = 0x0001, crc = 0x0000 )
ifneq (,$(filter $(BOARD),feather52832 feather52840))
flash: $(BUILD)/$(OUTPUT_FILENAME).hex flash: $(BUILD)/$(OUTPUT_FILENAME).hex
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT) nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
nrfjprog --erasepage $(BOOT_SETTING_ADDR) -f $(MCU_VARIANT) nrfjprog --erasepage $(BOOT_SETTING_ADDR) -f $(MCU_VARIANT)
nrfjprog --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f $(MCU_VARIANT) nrfjprog --memwr $(BOOT_SETTING_ADDR) --val 0x00000001 -f $(MCU_VARIANT)
nrfjprog --reset -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 sd: $(BUILD)/$(OUTPUT_FILENAME).hex
nrfjprog --eraseall -f $(MCU_VARIANT) nrfjprog --eraseall -f $(MCU_VARIANT)
nrfjprog --program $(SOFTDEV_HEX) -f $(MCU_VARIANT) nrfjprog --program $(SOFTDEV_HEX) -f $(MCU_VARIANT)
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT) nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
nrfjprog --reset -f $(MCU_VARIANT) nrfjprog --reset -f $(MCU_VARIANT)
bootloader:
nrfjprog --program $(BOOT_FILE).hex -f nrf52 --chiperase --reset
else ifeq ($(FLASHER), pyocd) else ifeq ($(FLASHER), pyocd)
flash: $(BUILD)/$(OUTPUT_FILENAME).hex flash: $(BUILD)/$(OUTPUT_FILENAME).hex
@ -291,7 +284,7 @@ endif
##################### #####################
# Flash with DFU # Flash with DFU
##################### #####################
.phony: bootloader dfu-gen dfu-flash dfu-bootloader uf2 .phony: dfu-gen dfu-flash dfu-bootloader uf2
ifeq ($(OS),Windows_NT) ifeq ($(OS),Windows_NT)
NRFUTIL = ../../lib/nrfutil/binaries/win32/nrfutil.exe NRFUTIL = ../../lib/nrfutil/binaries/win32/nrfutil.exe
@ -322,9 +315,6 @@ uf2: $(BUILD)/$(OUTPUT_FILENAME).hex
$(ECHO) "Create $(OUTPUT_FILENAME).uf2" $(ECHO) "Create $(OUTPUT_FILENAME).uf2"
$(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" $^ $(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" $^
# Flash bootloader with Jlink
bootloader:
nrfjprog --program $(BOOT_FILE).hex -f nrf52 --chiperase --reset
$(BUILD)/dfu-package.zip: dfu-gen $(BUILD)/dfu-package.zip: dfu-gen

View File

@ -3,6 +3,8 @@ MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840 MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION ?= 6.0.0 SOFTDEV_VERSION ?= 6.0.0
BOOT_SETTING_ADDR = 0xFF000
LD_FILE = boards/bluefruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_$(SOFTDEV_VERSION).ld LD_FILE = boards/bluefruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_$(SOFTDEV_VERSION).ld
BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140 BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140

View File

@ -3,6 +3,8 @@ MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840 MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION ?= 6.0.0 SOFTDEV_VERSION ?= 6.0.0
BOOT_SETTING_ADDR = 0xFF000
LD_FILE = boards/bluefruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_$(SOFTDEV_VERSION).ld LD_FILE = boards/bluefruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_$(SOFTDEV_VERSION).ld
BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140 BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140