Skip to content

Commit 5454768

Browse files
committed
add uf2, bootloader target
1 parent 4d45565 commit 5454768

2 files changed

Lines changed: 18 additions & 7 deletions

File tree

ports/nrf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ FLASHER ?=
249249
ifeq ($(FLASHER),)
250250

251251
# Adafruit use bootloader that requires writing to its settting ( app valid = 0x0001, crc = 0x0000 )
252-
ifneq (,$(filter $(BOARD),feather52 feather52840))
252+
ifneq (,$(filter $(BOARD),feather52832 feather52840))
253253

254254
flash: $(BUILD)/$(OUTPUT_FILENAME).hex
255255
nrfjprog --program $< --sectorerase -f $(MCU_VARIANT)

ports/nrf/boards/feather52840/mpconfigboard.mk

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ MCU_VARIANT = nrf52
33
MCU_SUB_VARIANT = nrf52840
44
SOFTDEV_VERSION ?= 6.0.0
55

6-
LD_FILE = boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld
7-
BOOTLOADER_FILENAME = boards/feather52840/bootloader/feather52840_bootloader_6.0.0_s140_single
6+
LD_FILE = boards/feather52840/bluefruit_nrf52840_s140_$(SOFTDEV_VERSION).ld
7+
BOOT_FILE = boards/feather52840/bootloader/feather52840_bootloader_$(SOFTDEV_VERSION)_s140_single
88

99
NRF_DEFINES += -DNRF52840_XXAA
1010

@@ -23,14 +23,25 @@ __check_defined = \
2323
$(if $(value $1),, \
2424
$(error Undefined make flag: $1$(if $2, ($2))))
2525

26-
.PHONY: dfu-gen dfu-flash boot-flash
26+
.PHONY: dfu-gen dfu-flash dfu-bootloader uf2 bootloader
2727

28+
29+
uf2:
30+
$(ECHO) "Create $(OUTPUT_FILENAME).uf2"
31+
$(PYTHON2) $(TOP)/tools/uf2/utils/uf2conv.py -c -o "$(BUILD)/$(OUTPUT_FILENAME).uf2" "$(BUILD)/$(OUTPUT_FILENAME).hex"
32+
33+
# Flash with DFU
2834
dfu-gen:
2935
$(NRFUTIL) dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $(BUILD)/$(OUTPUT_FILENAME).hex $(BUILD)/dfu-package.zip
3036

3137
dfu-flash:
3238
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
33-
$(NRFUTIL) --verbose dfu serial --package $(BUILD)/dfu-package.zip -p $(SERIAL) -b 115200
39+
$(NRFUTIL) --verbose dfu serial --package $(BUILD)/dfu-package.zip -p $(SERIAL) -b 115200 --singlebank
40+
41+
dfu-bootloader:
42+
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0)
43+
$(NRFUTIL) --verbose dfu serial --package $(BOOT_FILE).zip -p $(SERIAL) -b 115200
3444

35-
boot-flash:
36-
nrfjprog --program $(BOOTLOADER_FILENAME).hex -f nrf52 --chiperase --reset
45+
# Flash with jlink
46+
bootloader:
47+
nrfjprog --program $(BOOT_FILE).hex -f nrf52 --chiperase --reset

0 commit comments

Comments
 (0)