Merge branch 'nrf52_remove_boot_target' into nrf52_dfu_touch1200

This commit is contained in:
hathach 2018-08-21 15:17:03 +07:00
commit 1c4accfa39
4 changed files with 12 additions and 24 deletions

View File

@ -248,7 +248,7 @@ OBJ += $(addprefix $(BUILD)/, $(SRC_S:.s=.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 bootloader
.phony: all flash sd binary hex
all: binary hex uf2
@ -266,6 +266,11 @@ hex: $(BUILD)/$(OUTPUT_FILENAME).hex
$(BUILD)/$(OUTPUT_FILENAME).hex: $(BUILD)/$(OUTPUT_FILENAME).elf
$(OBJCOPY) -O ihex $< $@
## Create uf2 file
uf2: $(BUILD)/$(OUTPUT_FILENAME).hex
$(ECHO) "Create $(OUTPUT_FILENAME).uf2"
$(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" $^
#####################
# Flash with debugger
#####################
@ -286,9 +291,6 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).hex
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)
nrfjprog --reset -f $(MCU_VARIANT)
bootloader:
nrfjprog --program $(BOOT_FILE).hex -f nrf52 --chiperase --reset
else ifeq ($(FLASHER), pyocd)
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
@ -303,16 +305,12 @@ sd: $(BUILD)/$(OUTPUT_FILENAME).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
#####################
# Flash with DFU
#####################
.phony: dfu-gen dfu-flash dfu-bootloader
.phony: dfu-gen dfu-flash
NRFUTIL = adafruit-nrfutil
@ -329,22 +327,16 @@ __check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
dfu-gen: $(BUILD)/$(OUTPUT_FILENAME).hex
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
## Flash with DFU serial
dfu-flash: $(BUILD)/dfu-package.zip
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
$(NRFUTIL) --verbose dfu serial --package $^ -p $(SERIAL) -b 115200 --singlebank $(DFU_TOUCH)
dfu-bootloader:
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0)
$(NRFUTIL) --verbose dfu serial --package $(BOOT_FILE).zip -p $(SERIAL) -b 115200
## Create DFU package file
dfu-gen: $(BUILD)/dfu-package.zip
uf2: $(BUILD)/$(OUTPUT_FILENAME).hex
$(ECHO) "Create $(OUTPUT_FILENAME).uf2"
$(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -f 0xADA52840 -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" $^
$(BUILD)/dfu-package.zip: dfu-gen
$(BUILD)/dfu-package.zip: $(BUILD)/$(OUTPUT_FILENAME).hex
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $^ $(BUILD)/dfu-package.zip
$(BUILD)/$(OUTPUT_FILENAME).elf: $(OBJ)
$(ECHO) "LINK $@"

View File

@ -5,7 +5,6 @@ SD ?= s132
SOFTDEV_VERSION ?= 2.0.1
LD_FILE = boards/feather52832/custom_nrf52832_dfu_app_$(SOFTDEV_VERSION).ld
BOOT_FILE = boards/feather52832/bootloader/feather52_bootloader_$(SOFTDEV_VERSION)_s132_single
BOOT_SETTING_ADDR = 0x7F000
NRF_DEFINES += -DNRF52832_XXAA

View File

@ -5,7 +5,6 @@ SD ?= s140
SOFTDEV_VERSION ?= 6.0.0
BOOT_SETTING_ADDR = 0xFF000
BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140
ifeq ($(SD),)
LD_FILE = boards/nrf52840_1M_256k.ld

View File

@ -5,7 +5,6 @@ SD ?= s140
SOFTDEV_VERSION ?= 6.0.0
BOOT_SETTING_ADDR = 0xFF000
BOOT_FILE = boards/$(BOARD)/bootloader/$(SOFTDEV_VERSION)/$(BOARD)_bootloader_$(SOFTDEV_VERSION)_s140
ifeq ($(SD),)
LD_FILE = boards/nrf52840_1M_256k.ld
@ -13,5 +12,4 @@ else
LD_FILE = boards/bluefruit_$(MCU_SUB_VARIANT)_$(SD_LOWER)_$(SOFTDEV_VERSION).ld
endif
NRF_DEFINES += -DNRF52840_XXAA