add 52840 serial bootloader

This commit is contained in:
hathach 2018-02-13 13:25:37 +07:00
parent 3bb45511fa
commit 3a54a67f3d
5 changed files with 10558 additions and 14 deletions

1
.gitignore vendored
View File

@ -7,6 +7,7 @@
*.bin
*.map
*.hex
!ports/nrf/**/bootloader/*.hex
*.dis
*.exe

View File

@ -1,13 +1,4 @@
MCU_SERIES = m4
MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION ?= 6.0.0-6.alpha
LD_FILE = boards/nrf52840_1M_256k.ld
NRF_DEFINES += -DNRF52840_XXAA
ifeq ($(SD), )
INC += -Idrivers/bluetooth/s140_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s140_$(MCU_SUB_VARIANT)_$(SOFTDEV_VERSION)_API/include
INC += -Idrivers/bluetooth/s140_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s140_$(MCU_SUB_VARIANT)_$(SOFTDEV_VERSION)_API/include/$(MCU_VARIANT)
endif
# This file is a placeholder to enable building with 'SD=s132' flag
# The actual config data is stored in the file referenced below, regardless
# of whether S132 is actively used or not.
include boards/$(BOARD)/mpconfigboard.mk

View File

@ -3,6 +3,37 @@ MCU_VARIANT = nrf52
MCU_SUB_VARIANT = nrf52840
SOFTDEV_VERSION ?= 6.0.0-6.alpha
LD_FILE = boards/nrf52840_1M_256k_s140_$(SOFTDEV_VERSION).ld
LD_FILE = boards/feather52840/bluefruit_nrf52840_s140_6.0.0.ld
BOOTLOADER_FILENAME = boards/feather52840/bootloader/feather52840_bootloader_6.0.0_s140_single
NRF_DEFINES += -DNRF52840_XXAA
CFLAGS += -DADAFRUIT_FEATHER52
ifeq ($(SD), )
INC += -Idrivers/bluetooth/s140_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s140_$(MCU_SUB_VARIANT)_$(SOFTDEV_VERSION)_API/include
INC += -Idrivers/bluetooth/s140_$(MCU_VARIANT)_$(SOFTDEV_VERSION)/s140_$(MCU_SUB_VARIANT)_$(SOFTDEV_VERSION)_API/include/$(MCU_VARIANT)
endif
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
.PHONY: dfu-gen dfu-flash boot-flash
dfu-gen:
nrfutil dfu genpkg --sd-req 0xFFFE --dev-type 0x0052 --application $(BUILD)/$(OUTPUT_FILENAME).hex $(BUILD)/dfu-package.zip
dfu-flash:
@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
nrfutil --verbose dfu serial --package $(BUILD)/dfu-package.zip -p $(SERIAL) -b 115200
#boot-flash:
# @:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyUSB0)
# nrfutil dfu serial --package $(BOOTLOADER_PKG) -p $(SERIAL) -b 115200
boot-flash:
nrfjprog --program $(BOOTLOADER_FILENAME).hex -f nrf52 --chiperase --reset