378
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										378
									
								
								Makefile
									
									
									
									
									
								
							@@ -1,95 +1,70 @@
 | 
				
			|||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
# CONFIGURE
 | 
					# CONFIGURE
 | 
				
			||||||
# - SDK_PATH   : path to SDK directory
 | 
					# - SDK_PATH   : path to SDK directory
 | 
				
			||||||
# - SRC_PATH    : path to src folder
 | 
					 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# - SD_NAME    : e.g s132, s140
 | 
					# - SD_NAME    : e.g s132, s140
 | 
				
			||||||
# - SD_VERSION : SoftDevice version e.g 6.0.0
 | 
					# - SD_VERSION : SoftDevice version e.g 6.0.0
 | 
				
			||||||
# - SD_HEX     : to bootloader hex binary
 | 
					# - SD_HEX     : to bootloader hex binary
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
SRC_PATH     = src
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
SDK_PATH     = lib/sdk/components
 | 
					SDK_PATH     = lib/sdk/components
 | 
				
			||||||
SDK11_PATH   = lib/sdk11/components
 | 
					SDK11_PATH   = lib/sdk11/components
 | 
				
			||||||
SD_PATH      = lib/softdevice/$(SD_FILENAME)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
TUSB_PATH    = lib/tinyusb/src
 | 
					TUSB_PATH    = lib/tinyusb/src
 | 
				
			||||||
NRFX_PATH    = lib/nrfx
 | 
					NRFX_PATH    = lib/nrfx
 | 
				
			||||||
 | 
					SD_PATH      = lib/softdevice/$(SD_FILENAME)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SD_VERSION   = 6.1.1
 | 
					SD_VERSION   = 6.1.1
 | 
				
			||||||
SD_FILENAME  = $(SD_NAME)_nrf52_$(SD_VERSION)
 | 
					SD_FILENAME  = $(SD_NAME)_nrf52_$(SD_VERSION)
 | 
				
			||||||
SD_API_PATH  = $(SD_PATH)/$(SD_FILENAME)_API
 | 
					 | 
				
			||||||
SD_HEX       = $(SD_PATH)/$(SD_FILENAME)_softdevice.hex
 | 
					SD_HEX       = $(SD_PATH)/$(SD_FILENAME)_softdevice.hex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
LD_FILE      = $(SRC_PATH)/linker/$(MCU_SUB_VARIANT)_$(SD_NAME)_v$(word 1, $(subst ., ,$(SD_VERSION))).ld
 | 
					# linker by MCU and SoftDevice eg. nrf52840_s140_v6.ld
 | 
				
			||||||
 | 
					LD_FILE      = linker/$(MCU_SUB_VARIANT)_$(SD_NAME)_v$(word 1, $(subst ., ,$(SD_VERSION))).ld
 | 
				
			||||||
MERGED_FNAME = $(OUTPUT_FILENAME)_$(SD_NAME)_$(SD_VERSION)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
GIT_VERSION = $(shell git describe --dirty --always --tags)
 | 
					GIT_VERSION = $(shell git describe --dirty --always --tags)
 | 
				
			||||||
GIT_SUBMODULE_VERSIONS = $(shell git submodule status | cut -d' ' -f3,4 | paste -s -d" " -)
 | 
					GIT_SUBMODULE_VERSIONS = $(shell git submodule status | cut -d' ' -f3,4 | paste -s -d" " -)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
OUTPUT_FILENAME = $(BOARD)_bootloader-$(GIT_VERSION)
 | 
					# compiled file name
 | 
				
			||||||
 | 
					OUT_FILE = $(BOARD)_bootloader-$(GIT_VERSION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************************************************************************
 | 
					# merged file = compiled + sd
 | 
				
			||||||
 | 
					MERGED_FILE = $(OUT_FILE)_$(SD_NAME)_$(SD_VERSION)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
# Tool configure
 | 
					# Tool configure
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
NRFUTIL = adafruit-nrfutil
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifneq ($(JLINK),)
 | 
					# Toolchain commands
 | 
				
			||||||
NRFJPROG = nrfjprog -s $(JLINK)
 | 
					# Should be added to your PATH
 | 
				
			||||||
else
 | 
					CROSS_COMPILE ?= arm-none-eabi-
 | 
				
			||||||
 | 
					CC      = $(CROSS_COMPILE)gcc
 | 
				
			||||||
 | 
					AS      = $(CROSS_COMPILE)as
 | 
				
			||||||
 | 
					OBJCOPY = $(CROSS_COMPILE)objcopy
 | 
				
			||||||
 | 
					SIZE    = $(CROSS_COMPILE)size
 | 
				
			||||||
 | 
					GDB     = $(CROSS_COMPILE)gdb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NRFUTIL = adafruit-nrfutil
 | 
				
			||||||
NRFJPROG = nrfjprog
 | 
					NRFJPROG = nrfjprog
 | 
				
			||||||
endif
 | 
					
 | 
				
			||||||
 | 
					MK = mkdir -p
 | 
				
			||||||
 | 
					RM = rm -rf
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# auto-detect BMP on macOS, otherwise have to specify
 | 
					# auto-detect BMP on macOS, otherwise have to specify
 | 
				
			||||||
BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
 | 
					BMP_PORT ?= $(shell ls -1 /dev/cu.usbmodem????????1 | head -1)
 | 
				
			||||||
 | 
					GDB_BMP = $(GDB) -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(OS),Windows_NT)
 | 
					#---------------------------------
 | 
				
			||||||
PROGFILES = C:/Program Files (x86)
 | 
					 | 
				
			||||||
GNU_INSTALL_ROOT = $(PROGFILES)/GNU Tools ARM Embedded/7 2018-q2-update/bin/
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
MK := mkdir
 | 
					 | 
				
			||||||
RM := rm -rf
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Verbose mode (V=). 0: default, 1: print out CFLAG, LDFLAG 2: print all compile command
 | 
					 | 
				
			||||||
ifeq ("$(V)","2")
 | 
					 | 
				
			||||||
QUIET =
 | 
					 | 
				
			||||||
else
 | 
					 | 
				
			||||||
QUIET = @
 | 
					 | 
				
			||||||
endif
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
GNU_PREFIX = arm-none-eabi
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# Toolchain commands
 | 
					 | 
				
			||||||
CC      := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-gcc'
 | 
					 | 
				
			||||||
AS      := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-as'
 | 
					 | 
				
			||||||
AR      := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-ar' -r
 | 
					 | 
				
			||||||
LD      := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-ld'
 | 
					 | 
				
			||||||
NM      := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-nm'
 | 
					 | 
				
			||||||
OBJDUMP := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-objdump'
 | 
					 | 
				
			||||||
OBJCOPY := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-objcopy'
 | 
					 | 
				
			||||||
SIZE    := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-size'
 | 
					 | 
				
			||||||
GDB     := '$(GNU_INSTALL_ROOT)$(GNU_PREFIX)-gdb'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
GDB_BMP = arm-none-eabi-gdb -ex 'target extended-remote $(BMP_PORT)' -ex 'monitor swdp_scan' -ex 'attach 1'
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#function for removing duplicates in a list
 | 
					 | 
				
			||||||
remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#*********************************
 | 
					 | 
				
			||||||
# Select the board to build
 | 
					# Select the board to build
 | 
				
			||||||
#*********************************
 | 
					#---------------------------------
 | 
				
			||||||
BOARD_LIST = $(sort $(subst .h,,$(subst src/boards/,,$(wildcard src/boards/*))))
 | 
					BOARD_LIST = $(sort $(subst src/boards/,,$(wildcard src/boards/*)))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
 | 
					ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
 | 
				
			||||||
  $(info You must provide a BOARD parameter with 'BOARD='. Supported boards are:)
 | 
					  $(info You must provide a BOARD parameter with 'BOARD='. Supported boards are:)
 | 
				
			||||||
  $(info $(BOARD_LIST))
 | 
					  $(foreach b,$(BOARD_LIST),$(info - $(b)))
 | 
				
			||||||
  $(error Invalid BOARD specified)
 | 
					  $(error Invalid BOARD specified)
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build directory
 | 
					# Build directory
 | 
				
			||||||
BUILD = _build-$(BOARD)
 | 
					BUILD = _build/build-$(BOARD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Board specific
 | 
					# Board specific
 | 
				
			||||||
-include src/boards/$(BOARD)/board.mk
 | 
					-include src/boards/$(BOARD)/board.mk
 | 
				
			||||||
@@ -98,107 +73,100 @@ BUILD = _build-$(BOARD)
 | 
				
			|||||||
ifeq ($(MCU_SUB_VARIANT),nrf52)
 | 
					ifeq ($(MCU_SUB_VARIANT),nrf52)
 | 
				
			||||||
  SD_NAME = s132
 | 
					  SD_NAME = s132
 | 
				
			||||||
  DFU_DEV_REV = 0xADAF
 | 
					  DFU_DEV_REV = 0xADAF
 | 
				
			||||||
  MCU_FLAGS = -DNRF52 -DNRF52832_XXAA -DS132
 | 
					  CFLAGS += -DNRF52 -DNRF52832_XXAA -DS132
 | 
				
			||||||
else ifeq ($(MCU_SUB_VARIANT),nrf52833)
 | 
					else ifeq ($(MCU_SUB_VARIANT),nrf52833)
 | 
				
			||||||
  SD_NAME = s140
 | 
					  SD_NAME = s140
 | 
				
			||||||
  DFU_DEV_REV = 52840
 | 
					  DFU_DEV_REV = 52840
 | 
				
			||||||
  MCU_FLAGS = -DNRF52833_XXAA -DS140
 | 
					  CFLAGS += -DNRF52833_XXAA -DS140
 | 
				
			||||||
else ifeq ($(MCU_SUB_VARIANT),nrf52840)
 | 
					else ifeq ($(MCU_SUB_VARIANT),nrf52840)
 | 
				
			||||||
  SD_NAME = s140
 | 
					  SD_NAME = s140
 | 
				
			||||||
  DFU_DEV_REV = 52840
 | 
					  DFU_DEV_REV = 52840
 | 
				
			||||||
  MCU_FLAGS = -DNRF52840_XXAA -DS140
 | 
					  CFLAGS += -DNRF52840_XXAA -DS140
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  $(error Sub Variant $(MCU_SUB_VARIANT) is unknown)
 | 
					  $(error Sub Variant $(MCU_SUB_VARIANT) is unknown)
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
# SOURCE FILES
 | 
					# SOURCE FILES
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# src
 | 
					# all files in src
 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/main.c
 | 
					C_SRC += $(wildcard src/*.c)
 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/boards.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/flash_nrf5x.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/dfu_ble_svc.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/dfu_init.c
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# all sources files in specific board
 | 
					# all sources files in specific board
 | 
				
			||||||
C_SOURCE_FILES += $(wildcard $(SRC_PATH)/boards/$(BOARD)/*.c)
 | 
					C_SRC += $(wildcard src/boards/$(BOARD)/*.c)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# nrfx
 | 
					# nrfx
 | 
				
			||||||
C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_power.c
 | 
					C_SRC += $(NRFX_PATH)/drivers/src/nrfx_power.c
 | 
				
			||||||
C_SOURCE_FILES += $(NRFX_PATH)/drivers/src/nrfx_nvmc.c
 | 
					C_SRC += $(NRFX_PATH)/drivers/src/nrfx_nvmc.c
 | 
				
			||||||
C_SOURCE_FILES += $(NRFX_PATH)/mdk/system_$(MCU_SUB_VARIANT).c
 | 
					C_SRC += $(NRFX_PATH)/mdk/system_$(MCU_SUB_VARIANT).c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# SDK 11 files
 | 
					# SDK 11 files: serial + OTA DFU
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader.c
 | 
					C_SRC += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader_settings.c
 | 
					C_SRC += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader_settings.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader_util.c
 | 
					C_SRC += $(SDK11_PATH)/libraries/bootloader_dfu/bootloader_util.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/dfu_transport_serial.c
 | 
					C_SRC += $(SDK11_PATH)/libraries/bootloader_dfu/dfu_transport_serial.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/dfu_transport_ble.c
 | 
					C_SRC += $(SDK11_PATH)/libraries/bootloader_dfu/dfu_transport_ble.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/libraries/bootloader_dfu/dfu_single_bank.c
 | 
					C_SRC += $(SDK11_PATH)/libraries/bootloader_dfu/dfu_single_bank.c
 | 
				
			||||||
 | 
					C_SRC += $(SDK11_PATH)/ble/ble_services/ble_dfu/ble_dfu.c
 | 
				
			||||||
 | 
					C_SRC += $(SDK11_PATH)/ble/ble_services/ble_dis/ble_dis.c
 | 
				
			||||||
 | 
					C_SRC += $(SDK11_PATH)/drivers_nrf/pstorage/pstorage_raw.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/drivers_nrf/pstorage/pstorage_raw.c
 | 
					# Latest SDK files: peripheral drivers
 | 
				
			||||||
 | 
					C_SRC += $(SDK_PATH)/libraries/timer/app_timer.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/ble/ble_services/ble_dfu/ble_dfu.c
 | 
					C_SRC += $(SDK_PATH)/libraries/scheduler/app_scheduler.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK11_PATH)/ble/ble_services/ble_dis/ble_dis.c
 | 
					C_SRC += $(SDK_PATH)/libraries/util/app_error.c
 | 
				
			||||||
 | 
					C_SRC += $(SDK_PATH)/libraries/util/app_util_platform.c
 | 
				
			||||||
# Latest SDK files
 | 
					C_SRC += $(SDK_PATH)/libraries/crc16/crc16.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/timer/app_timer.c
 | 
					C_SRC += $(SDK_PATH)/libraries/hci/hci_mem_pool.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/scheduler/app_scheduler.c
 | 
					C_SRC += $(SDK_PATH)/libraries/hci/hci_slip.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/util/app_error.c
 | 
					C_SRC += $(SDK_PATH)/libraries/hci/hci_transport.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/util/app_util_platform.c
 | 
					C_SRC += $(SDK_PATH)/libraries/util/nrf_assert.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/crc16/crc16.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_mem_pool.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_slip.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/hci/hci_transport.c
 | 
					 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/util/nrf_assert.c
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# UART or USB Serial
 | 
					# UART or USB Serial
 | 
				
			||||||
ifeq ($(MCU_SUB_VARIANT),nrf52)
 | 
					ifeq ($(MCU_SUB_VARIANT),nrf52)
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/libraries/uart/app_uart.c
 | 
					
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/uart/nrf_drv_uart.c
 | 
					C_SRC += $(SDK_PATH)/libraries/uart/app_uart.c
 | 
				
			||||||
C_SOURCE_FILES += $(SDK_PATH)/drivers_nrf/common/nrf_drv_common.c
 | 
					C_SRC += $(SDK_PATH)/drivers_nrf/uart/nrf_drv_uart.c
 | 
				
			||||||
 | 
					C_SRC += $(SDK_PATH)/drivers_nrf/common/nrf_drv_common.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
IPATH += $(SDK11_PATH)/libraries/util
 | 
					IPATH += $(SDK11_PATH)/libraries/util
 | 
				
			||||||
IPATH += $(SDK_PATH)/drivers_nrf/common
 | 
					IPATH += $(SDK_PATH)/drivers_nrf/common
 | 
				
			||||||
IPATH += $(SDK_PATH)/drivers_nrf/uart
 | 
					IPATH += $(SDK_PATH)/drivers_nrf/uart
 | 
				
			||||||
 | 
					
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
# src
 | 
					
 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/usb/usb_desc.c
 | 
					# USB Application ( MSC + UF2 )
 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/usb/usb.c
 | 
					C_SRC += $(wildcard src/usb/*.c)
 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/usb/msc_uf2.c
 | 
					C_SRC += $(wildcard src/usb/uf2/*.c)
 | 
				
			||||||
C_SOURCE_FILES += $(SRC_PATH)/usb/uf2/ghostfat.c
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# TinyUSB stack
 | 
					# TinyUSB stack
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/portable/nordic/nrf5x/dcd_nrf5x.c
 | 
					C_SRC += $(TUSB_PATH)/portable/nordic/nrf5x/dcd_nrf5x.c
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/common/tusb_fifo.c
 | 
					C_SRC += $(TUSB_PATH)/common/tusb_fifo.c
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/device/usbd.c
 | 
					C_SRC += $(TUSB_PATH)/device/usbd.c
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/device/usbd_control.c
 | 
					C_SRC += $(TUSB_PATH)/device/usbd_control.c
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/class/cdc/cdc_device.c
 | 
					C_SRC += $(TUSB_PATH)/class/cdc/cdc_device.c
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/class/msc/msc_device.c
 | 
					C_SRC += $(TUSB_PATH)/class/msc/msc_device.c
 | 
				
			||||||
C_SOURCE_FILES += $(TUSB_PATH)/tusb.c
 | 
					C_SRC += $(TUSB_PATH)/tusb.c
 | 
				
			||||||
 | 
					
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
#******************************************************************************
 | 
					 | 
				
			||||||
# Assembly Files
 | 
					# Assembly Files
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
ASM_SOURCE_FILES  = $(NRFX_PATH)/mdk/gcc_startup_$(MCU_SUB_VARIANT).S
 | 
					ASM_SRC = $(NRFX_PATH)/mdk/gcc_startup_$(MCU_SUB_VARIANT).S
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
# INCLUDE PATH
 | 
					# INCLUDE PATH
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# src
 | 
					# src
 | 
				
			||||||
IPATH += $(SRC_PATH)
 | 
					IPATH += src
 | 
				
			||||||
IPATH += $(SRC_PATH)/boards/$(BOARD)
 | 
					IPATH += src/boards/$(BOARD)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
IPATH += $(SRC_PATH)/cmsis/include
 | 
					IPATH += src/cmsis/include
 | 
				
			||||||
IPATH += $(SRC_PATH)/usb
 | 
					IPATH += src/usb
 | 
				
			||||||
IPATH += $(SRC_PATH)/boards
 | 
					IPATH += src/boards
 | 
				
			||||||
IPATH += $(TUSB_PATH)
 | 
					IPATH += $(TUSB_PATH)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# nrfx
 | 
					# nrfx
 | 
				
			||||||
@@ -225,36 +193,61 @@ IPATH += $(SDK_PATH)/libraries/hci
 | 
				
			|||||||
IPATH += $(SDK_PATH)/drivers_nrf/delay
 | 
					IPATH += $(SDK_PATH)/drivers_nrf/delay
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Softdevice
 | 
					# Softdevice
 | 
				
			||||||
IPATH += $(SD_API_PATH)/include
 | 
					IPATH += $(SD_PATH)/$(SD_FILENAME)_API/include
 | 
				
			||||||
IPATH += $(SD_API_PATH)/include/nrf52
 | 
					IPATH += $(SD_PATH)/$(SD_FILENAME)_API/include/nrf52
 | 
				
			||||||
 | 
					
 | 
				
			||||||
INC_PATHS = $(addprefix -I,$(IPATH))
 | 
					INC_PATHS = $(addprefix -I,$(IPATH))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
# Compiler Flags
 | 
					# Compiler Flags
 | 
				
			||||||
# - Additional compiler flags
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
#******************************************************************************
 | 
					
 | 
				
			||||||
 | 
					# Debugging/Optimization
 | 
				
			||||||
 | 
					ifeq ($(DEBUG), 1)
 | 
				
			||||||
 | 
						CFLAGS += -Og -ggdb
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
						CFLAGS += -Os
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#flags common to all targets
 | 
					#flags common to all targets
 | 
				
			||||||
CFLAGS += -mcpu=cortex-m4
 | 
					CFLAGS += \
 | 
				
			||||||
CFLAGS += -mthumb -mabi=aapcs --std=gnu99
 | 
						-mthumb \
 | 
				
			||||||
CFLAGS += -Wall -Werror -Os -g3
 | 
						-mabi=aapcs \
 | 
				
			||||||
CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
 | 
						-mcpu=cortex-m4 \
 | 
				
			||||||
 | 
						-mfloat-abi=hard \
 | 
				
			||||||
 | 
						-mfpu=fpv4-sp-d16 \
 | 
				
			||||||
 | 
						-ffunction-sections \
 | 
				
			||||||
 | 
						-fdata-sections \
 | 
				
			||||||
 | 
						-fno-builtin \
 | 
				
			||||||
 | 
						-fshort-enums \
 | 
				
			||||||
 | 
						-fstack-usage \
 | 
				
			||||||
 | 
						-fno-strict-aliasing \
 | 
				
			||||||
 | 
						-Wall \
 | 
				
			||||||
 | 
						-Wextra \
 | 
				
			||||||
 | 
						-Werror \
 | 
				
			||||||
 | 
						-Wfatal-errors \
 | 
				
			||||||
 | 
						-Werror-implicit-function-declaration \
 | 
				
			||||||
 | 
						-Wfloat-equal \
 | 
				
			||||||
 | 
						-Wundef \
 | 
				
			||||||
 | 
						-Wshadow \
 | 
				
			||||||
 | 
						-Wwrite-strings \
 | 
				
			||||||
 | 
						-Wsign-compare \
 | 
				
			||||||
 | 
						-Wmissing-format-attribute \
 | 
				
			||||||
 | 
						-Wno-endif-labels \
 | 
				
			||||||
 | 
						-Wunreachable-code	
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# keep every function in separate section. This will allow linker to dump unused functions
 | 
					# Suppress warning caused by SDK
 | 
				
			||||||
CFLAGS += -ffunction-sections -fdata-sections -fno-strict-aliasing
 | 
					CFLAGS += -Wno-unused-parameter -Wno-expansion-to-defined
 | 
				
			||||||
CFLAGS += -fno-builtin --short-enums -fstack-usage
 | 
					
 | 
				
			||||||
 | 
					# TinyUSB tusb_hal_nrf_power_event
 | 
				
			||||||
 | 
					CFLAGS += -Wno-cast-function-type
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Defined Symbol (MACROS)
 | 
					# Defined Symbol (MACROS)
 | 
				
			||||||
CFLAGS += -D__HEAP_SIZE=0
 | 
					CFLAGS += -D__HEAP_SIZE=0
 | 
				
			||||||
CFLAGS += -DCONFIG_GPIO_AS_PINRESET
 | 
					CFLAGS += -DCONFIG_GPIO_AS_PINRESET
 | 
				
			||||||
CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
 | 
					CFLAGS += -DCONFIG_NFCT_PINS_AS_GPIOS
 | 
				
			||||||
CFLAGS += -DBLE_STACK_SUPPORT_REQD
 | 
					 | 
				
			||||||
CFLAGS += -DSWI_DISABLE0
 | 
					 | 
				
			||||||
CFLAGS += -DSOFTDEVICE_PRESENT
 | 
					CFLAGS += -DSOFTDEVICE_PRESENT
 | 
				
			||||||
CFLAGS += -DFLOAT_ABI_HARD
 | 
					 | 
				
			||||||
CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
 | 
					CFLAGS += -DDFU_APP_DATA_RESERVED=7*4096
 | 
				
			||||||
CFLAGS += $(MCU_FLAGS)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION)"'
 | 
					CFLAGS += -DUF2_VERSION='"$(GIT_VERSION) $(GIT_SUBMODULE_VERSIONS) $(SD_NAME) $(SD_VERSION)"'
 | 
				
			||||||
CFLAGS += -DBLEDIS_FW_VERSION='"$(GIT_VERSION) $(SD_NAME) $(SD_VERSION)"'
 | 
					CFLAGS += -DBLEDIS_FW_VERSION='"$(GIT_VERSION) $(SD_NAME) $(SD_VERSION)"'
 | 
				
			||||||
@@ -262,42 +255,33 @@ CFLAGS += -DBLEDIS_FW_VERSION='"$(GIT_VERSION) $(SD_NAME) $(SD_VERSION)"'
 | 
				
			|||||||
_VER = $(subst ., ,$(word 1, $(subst -, ,$(GIT_VERSION))))
 | 
					_VER = $(subst ., ,$(word 1, $(subst -, ,$(GIT_VERSION))))
 | 
				
			||||||
CFLAGS += -DMK_BOOTLOADER_VERSION='($(word 1,$(_VER)) << 16) + ($(word 2,$(_VER)) << 8) + $(word 3,$(_VER))'
 | 
					CFLAGS += -DMK_BOOTLOADER_VERSION='($(word 1,$(_VER)) << 16) + ($(word 2,$(_VER)) << 8) + $(word 3,$(_VER))'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
#******************************************************************************
 | 
					 | 
				
			||||||
# Linker Flags
 | 
					# Linker Flags
 | 
				
			||||||
#
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
#******************************************************************************
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# keep every function in separate section. This will allow linker to dump unused functions
 | 
					LDFLAGS += \
 | 
				
			||||||
LDFLAGS += -Xlinker -Map=$(BUILD)/$(OUTPUT_FILENAME).map
 | 
						$(CFLAGS) \
 | 
				
			||||||
LDFLAGS += -mthumb -mabi=aapcs -L$(SRC_PATH)/linker -T$(LD_FILE)
 | 
						-Wl,-L,linker -Wl,-T,$(LD_FILE) \
 | 
				
			||||||
LDFLAGS += -mcpu=cortex-m4
 | 
						-Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections \
 | 
				
			||||||
LDFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16
 | 
						-specs=nosys.specs -specs=nano.specs
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# let linker to dump unused sections
 | 
					LIBS += -lm -lc
 | 
				
			||||||
LDFLAGS += -Wl,--gc-sections
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# use newlib in nano version
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
LDFLAGS += --specs=nano.specs -lc -lnosys
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#******************************************************************************
 | 
					 | 
				
			||||||
# Assembler flags
 | 
					# Assembler flags
 | 
				
			||||||
#
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
#******************************************************************************
 | 
					ASFLAGS += $(CFLAGS)
 | 
				
			||||||
ASMFLAGS += -x assembler-with-cpp
 | 
					 | 
				
			||||||
ASMFLAGS += -D__HEAP_SIZE=0
 | 
					 | 
				
			||||||
ASMFLAGS += -DBLE_STACK_SUPPORT_REQD
 | 
					 | 
				
			||||||
ASMFLAGS += -DSWI_DISABLE0
 | 
					 | 
				
			||||||
ASMFLAGS += -DSOFTDEVICE_PRESENT
 | 
					 | 
				
			||||||
ASMFLAGS += -DFLOAT_ABI_HARD
 | 
					 | 
				
			||||||
ASMFLAGS += $(MCU_FLAGS)
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
C_SOURCE_FILE_NAMES = $(notdir $(C_SOURCE_FILES))
 | 
					
 | 
				
			||||||
C_PATHS = $(call remduplicates, $(dir $(C_SOURCE_FILES) ) )
 | 
					#function for removing duplicates in a list
 | 
				
			||||||
 | 
					remduplicates = $(strip $(if $1,$(firstword $1) $(call remduplicates,$(filter-out $(firstword $1),$1))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					C_SOURCE_FILE_NAMES = $(notdir $(C_SRC))
 | 
				
			||||||
 | 
					C_PATHS = $(call remduplicates, $(dir $(C_SRC) ) )
 | 
				
			||||||
C_OBJECTS = $(addprefix $(BUILD)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
 | 
					C_OBJECTS = $(addprefix $(BUILD)/, $(C_SOURCE_FILE_NAMES:.c=.o) )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SOURCE_FILES))
 | 
					ASM_SOURCE_FILE_NAMES = $(notdir $(ASM_SRC))
 | 
				
			||||||
ASM_PATHS = $(call remduplicates, $(dir $(ASM_SOURCE_FILES) ))
 | 
					ASM_PATHS = $(call remduplicates, $(dir $(ASM_SRC) ))
 | 
				
			||||||
ASM_OBJECTS = $(addprefix $(BUILD)/, $(ASM_SOURCE_FILE_NAMES:.S=.o) )
 | 
					ASM_OBJECTS = $(addprefix $(BUILD)/, $(ASM_SOURCE_FILE_NAMES:.S=.o) )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
vpath %.c $(C_PATHS)
 | 
					vpath %.c $(C_PATHS)
 | 
				
			||||||
@@ -305,25 +289,26 @@ vpath %.S $(ASM_PATHS)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS)
 | 
					OBJECTS = $(C_OBJECTS) $(ASM_OBJECTS)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
# BUILD TARGETS
 | 
					# BUILD TARGETS
 | 
				
			||||||
#******************************************************************************
 | 
					#------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Verbose mode (V=). 0: default, 1: print out CFLAG, LDFLAG 2: print all compile command
 | 
				
			||||||
ifeq ("$(V)","1")
 | 
					ifeq ("$(V)","1")
 | 
				
			||||||
$(info CFLAGS   $(CFLAGS))
 | 
					$(info CFLAGS   $(CFLAGS))
 | 
				
			||||||
$(info )
 | 
					$(info )
 | 
				
			||||||
$(info LDFLAGS  $(LDFLAGS))
 | 
					$(info LDFLAGS  $(LDFLAGS))
 | 
				
			||||||
$(info )
 | 
					$(info )
 | 
				
			||||||
$(info ASMFLAGS $(ASMFLAGS))
 | 
					$(info ASFLAGS $(ASFLAGS))
 | 
				
			||||||
$(info )
 | 
					$(info )
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
.phony: all clean size flash sd erase
 | 
					.PHONY: all clean flash dfu-flash sd gdbflash gdb
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# default target to build
 | 
					# default target to build
 | 
				
			||||||
all: $(BUILD)/$(OUTPUT_FILENAME)-nosd.out size
 | 
					all: $(BUILD)/$(OUT_FILE)-nosd.out $(BUILD)/$(MERGED_FILE).hex
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************* Flash target *******************
 | 
					#------------------- Flash target -------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
check_defined = \
 | 
					check_defined = \
 | 
				
			||||||
    $(strip $(foreach 1,$1, \
 | 
					    $(strip $(foreach 1,$1, \
 | 
				
			||||||
@@ -333,11 +318,11 @@ __check_defined = \
 | 
				
			|||||||
    $(error Undefined make flag: $1$(if $2, ($2))))
 | 
					    $(error Undefined make flag: $1$(if $2, ($2))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Flash the compiled
 | 
					# Flash the compiled
 | 
				
			||||||
flash: $(BUILD)/$(OUTPUT_FILENAME)-nosd.hex
 | 
					flash: $(BUILD)/$(OUT_FILE)-nosd.hex
 | 
				
			||||||
	@echo Flashing: $<
 | 
						@echo Flashing: $<
 | 
				
			||||||
	$(NRFJPROG) --program $< --sectoranduicrerase -f nrf52 --reset
 | 
						$(NRFJPROG) --program $< --sectoranduicrerase -f nrf52 --reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
dfu-flash: $(BUILD)/$(MERGED_FNAME).zip
 | 
					dfu-flash: $(BUILD)/$(MERGED_FILE).zip
 | 
				
			||||||
	@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0)
 | 
						@:$(call check_defined, SERIAL, example: SERIAL=/dev/ttyACM0)
 | 
				
			||||||
	$(NRFUTIL) --verbose dfu serial --package $< -p $(SERIAL) -b 115200 --singlebank --touch 1200
 | 
						$(NRFUTIL) --verbose dfu serial --package $< -p $(SERIAL) -b 115200 --singlebank --touch 1200
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -345,18 +330,14 @@ sd:
 | 
				
			|||||||
	@echo Flashing: $(SD_HEX)
 | 
						@echo Flashing: $(SD_HEX)
 | 
				
			||||||
	$(NRFJPROG) --program $(SD_HEX) -f nrf52 --chiperase  --reset
 | 
						$(NRFJPROG) --program $(SD_HEX) -f nrf52 --chiperase  --reset
 | 
				
			||||||
 | 
					
 | 
				
			||||||
erase:
 | 
					gdbflash: $(BUILD)/$(MERGED_FILE).hex
 | 
				
			||||||
	@echo Erasing chip
 | 
					 | 
				
			||||||
	$(NRFJPROG) --eraseall -f nrf52
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
gdbflash: $(BUILD)/$(MERGED_FNAME).hex
 | 
					 | 
				
			||||||
	@echo Flashing: $<
 | 
						@echo Flashing: $<
 | 
				
			||||||
	@$(GDB_BMP) -nx --batch -ex 'load $<' -ex 'compare-sections' -ex 'kill'
 | 
						@$(GDB_BMP) -nx --batch -ex 'load $<' -ex 'compare-sections' -ex 'kill'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
gdb: $(BUILD)/$(OUTPUT_FILENAME)-nosd.out
 | 
					gdb: $(BUILD)/$(OUT_FILE)-nosd.out
 | 
				
			||||||
	$(GDB_BMP) $<
 | 
						$(GDB_BMP) $<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#******************* Compile rules *******************
 | 
					#------------------- Compile rules -------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Create build directories
 | 
					## Create build directories
 | 
				
			||||||
$(BUILD):
 | 
					$(BUILD):
 | 
				
			||||||
@@ -368,43 +349,34 @@ clean:
 | 
				
			|||||||
# Create objects from C SRC files
 | 
					# Create objects from C SRC files
 | 
				
			||||||
$(BUILD)/%.o: %.c
 | 
					$(BUILD)/%.o: %.c
 | 
				
			||||||
	@echo CC $(notdir $<)
 | 
						@echo CC $(notdir $<)
 | 
				
			||||||
	$(QUIET)$(CC) $(CFLAGS) $(INC_PATHS) -c -o $@ $<
 | 
						@$(CC) $(CFLAGS) $(INC_PATHS) -c -o $@ $<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Assemble files
 | 
					# Assemble files
 | 
				
			||||||
$(BUILD)/%.o: %.S
 | 
					$(BUILD)/%.o: %.S
 | 
				
			||||||
	@echo AS $(notdir $<)
 | 
						@echo AS $(notdir $<)
 | 
				
			||||||
	$(QUIET)$(CC) $(ASMFLAGS) $(INC_PATHS) -c -o $@ $<
 | 
						@$(CC) -x assembler-with-cpp $(ASFLAGS) $(INC_PATHS) -c -o $@ $<
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Link
 | 
					# Link
 | 
				
			||||||
$(BUILD)/$(OUTPUT_FILENAME)-nosd.out: $(BUILD) $(OBJECTS)
 | 
					$(BUILD)/$(OUT_FILE)-nosd.out: $(BUILD) $(OBJECTS)
 | 
				
			||||||
	@echo LD $(OUTPUT_FILENAME)-nosd.out
 | 
						@echo LD $(OUT_FILE)-nosd.out
 | 
				
			||||||
	$(QUIET)$(CC) $(LDFLAGS) $(OBJECTS) $(LIBS) -lm -o $@
 | 
						@$(CC) -o $@ $(LDFLAGS) $(OBJECTS) -Wl,--start-group $(LIBS) -Wl,--end-group
 | 
				
			||||||
 | 
						@$(SIZE) $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
size: $(BUILD)/$(OUTPUT_FILENAME)-nosd.out
 | 
					#------------------- Binary generator -------------------
 | 
				
			||||||
	-@echo ''
 | 
					 | 
				
			||||||
	$(QUIET)$(SIZE) $<
 | 
					 | 
				
			||||||
	-@echo ''
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#******************* Binary generator *******************
 | 
					 | 
				
			||||||
.phony: genhex genpkg
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Create binary .hex file from the .out file
 | 
					## Create binary .hex file from the .out file
 | 
				
			||||||
genhex: $(BUILD)/$(OUTPUT_FILENAME)-nosd.hex
 | 
					$(BUILD)/$(OUT_FILE)-nosd.hex: $(BUILD)/$(OUT_FILE)-nosd.out
 | 
				
			||||||
 | 
						@echo CR $(OUT_FILE)-nosd.hex
 | 
				
			||||||
$(BUILD)/$(OUTPUT_FILENAME)-nosd.hex: $(BUILD)/$(OUTPUT_FILENAME)-nosd.out
 | 
						@$(OBJCOPY) -O ihex $< $@
 | 
				
			||||||
	@echo CR $(OUTPUT_FILENAME)-nosd.hex
 | 
					 | 
				
			||||||
	$(QUIET)$(OBJCOPY) -O ihex $< $@
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# merge bootloader and sd hex together
 | 
					# merge bootloader and sd hex together
 | 
				
			||||||
combinehex: $(BUILD)/$(MERGED_FNAME).hex
 | 
					$(BUILD)/$(MERGED_FILE).hex: $(BUILD)/$(OUT_FILE)-nosd.hex
 | 
				
			||||||
 | 
						@echo CR $(MERGED_FILE).hex
 | 
				
			||||||
$(BUILD)/$(MERGED_FNAME).hex: $(BUILD)/$(OUTPUT_FILENAME)-nosd.hex
 | 
					 | 
				
			||||||
	@echo CR $(MERGED_FNAME).hex
 | 
					 | 
				
			||||||
	@mergehex -q -m $< $(SD_HEX) -o $@
 | 
						@mergehex -q -m $< $(SD_HEX) -o $@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Create pkg file for bootloader+SD combo to use with DFU
 | 
					## Create pkg zip file for bootloader+SD combo to use with DFU Serial
 | 
				
			||||||
genpkg: $(BUILD)/$(MERGED_FNAME).zip
 | 
					.PHONY: genpkg
 | 
				
			||||||
 | 
					genpkg: $(BUILD)/$(MERGED_FILE).zip
 | 
				
			||||||
 | 
					
 | 
				
			||||||
$(BUILD)/$(MERGED_FNAME).zip: $(BUILD)/$(OUTPUT_FILENAME)-nosd.hex
 | 
					$(BUILD)/$(MERGED_FILE).zip: $(BUILD)/$(OUT_FILE)-nosd.hex
 | 
				
			||||||
	@$(NRFUTIL) dfu genpkg --dev-type 0x0052 --dev-revision $(DFU_DEV_REV) --bootloader $< --softdevice $(SD_HEX) $@
 | 
						@$(NRFUTIL) dfu genpkg --dev-type 0x0052 --dev-revision $(DFU_DEV_REV) --bootloader $< --softdevice $(SD_HEX) $@
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										35
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										35
									
								
								README.md
									
									
									
									
									
								
							@@ -107,8 +107,6 @@ both bootloader and the Nordic SoftDevice, you can freely upgrade/downgrade to a
 | 
				
			|||||||
You should only continue if you are looking to develop bootloader for your own.
 | 
					You should only continue if you are looking to develop bootloader for your own.
 | 
				
			||||||
You must have have a J-Link available to "unbrick" your device.
 | 
					You must have have a J-Link available to "unbrick" your device.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Option 1: Build with Makefile
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
Prerequisites
 | 
					Prerequisites
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- ARM GCC
 | 
					- ARM GCC
 | 
				
			||||||
@@ -117,7 +115,7 @@ Prerequisites
 | 
				
			|||||||
To build:
 | 
					To build:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
make BOARD=feather_nrf52840_express all combinehex
 | 
					make BOARD=feather_nrf52840_express all
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To flash the bootloader with JLink:
 | 
					To flash the bootloader with JLink:
 | 
				
			||||||
@@ -138,12 +136,6 @@ To flash SoftDevice (and chip erase):
 | 
				
			|||||||
make BOARD=feather_nrf52840_express sd
 | 
					make BOARD=feather_nrf52840_express sd
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To erase all of flash:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
make BOARD=feather_nrf52840_express erase
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
For the list of supported boards, run `make` without `BOARD=` :
 | 
					For the list of supported boards, run `make` without `BOARD=` :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
@@ -167,13 +159,11 @@ make: *** [_build/main.o] Error 127
 | 
				
			|||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
... you may need to pass the location of the GCC ARM toolchain binaries to `make` using
 | 
					... you may need to pass the location of the GCC ARM toolchain binaries to `make` using
 | 
				
			||||||
the variable `GNU_INSTALL_ROOT` as below:
 | 
					the variable `CROSS_COMPILE` as below:
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
$ make GNU_INSTALL_ROOT=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/ BOARD=feather_nrf52832 all
 | 
					$ make CROSS_COMPILE=/opt/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi- BOARD=feather_nrf52832 all
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_Please note that the path needs a trailing path separator (a `/`)_
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#### 2. `mergehex: No such file or directory`
 | 
					#### 2. `mergehex: No such file or directory`
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Make sure that `mergehex` is available from the command-line. This binary is
 | 
					Make sure that `mergehex` is available from the command-line. This binary is
 | 
				
			||||||
@@ -184,22 +174,3 @@ part of Nordic's nRF5x Command Line Tools.
 | 
				
			|||||||
Make sure that `nrfjprog` is available from the command-line. This binary is
 | 
					Make sure that `nrfjprog` is available from the command-line. This binary is
 | 
				
			||||||
part of Nordic's nRF5x Command Line Tools.
 | 
					part of Nordic's nRF5x Command Line Tools.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
On POSIX-type systems you can temporarily add the path to `nrfjprog` via a
 | 
					 | 
				
			||||||
variation on the following command:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
$ export PATH=$PATH:/location/of/nRF5x-Command-Line-Tools_9_7_2_OSX/nrfjprog
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
### Option 2: Build using Segger Embedded Studio
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
For easier debugging you can also use [SES](https://www.segger.com/products/development-tools/embedded-studio/).
 | 
					 | 
				
			||||||
The project file is located at `src/segger/Adafruit_nRF52_Bootloader.emProject`.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
> **Note**: SES only flashes the bootloader when you click download, not the SoftDevice.
 | 
					 | 
				
			||||||
You need to flash the SoftDevice beforehand if you haven't already done so.
 | 
					 | 
				
			||||||
As mentioned above do something like:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
make BOARD=feather_nrf52840_express sd
 | 
					 | 
				
			||||||
```
 | 
					 | 
				
			||||||
 
 | 
				
			|||||||
@@ -442,7 +442,8 @@ uint32_t bootloader_dfu_sd_update_continue(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
uint32_t bootloader_dfu_sd_update_finalize(void)
 | 
					uint32_t bootloader_dfu_sd_update_finalize(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dfu_update_status_t update_status = {DFU_UPDATE_SD_SWAPPED, };
 | 
					    dfu_update_status_t update_status = { 0 };
 | 
				
			||||||
 | 
					    update_status.status_code = DFU_UPDATE_SD_SWAPPED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					    bootloader_dfu_update_process(update_status);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,843 +0,0 @@
 | 
				
			|||||||
/* Copyright (c) 2013 Nordic Semiconductor. All Rights Reserved.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * The information contained herein is property of Nordic Semiconductor ASA.
 | 
					 | 
				
			||||||
 * Terms and conditions of usage are described in detail in NORDIC
 | 
					 | 
				
			||||||
 * SEMICONDUCTOR STANDARD SOFTWARE LICENSE AGREEMENT.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * Licensees are granted free, non-transferable use of the information. NO
 | 
					 | 
				
			||||||
 * WARRANTY of ANY KIND is provided. This heading must NOT be removed from
 | 
					 | 
				
			||||||
 * the file.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
#include <stddef.h>
 | 
					 | 
				
			||||||
#include "dfu.h"
 | 
					 | 
				
			||||||
#include <dfu_types.h>
 | 
					 | 
				
			||||||
#include "dfu_bank_internal.h"
 | 
					 | 
				
			||||||
#include "nrf.h"
 | 
					 | 
				
			||||||
#include "nrf_sdm.h"
 | 
					 | 
				
			||||||
#include "app_error.h"
 | 
					 | 
				
			||||||
#include "app_timer.h"
 | 
					 | 
				
			||||||
#include "bootloader.h"
 | 
					 | 
				
			||||||
#include "bootloader_types.h"
 | 
					 | 
				
			||||||
#include "pstorage.h"
 | 
					 | 
				
			||||||
#include "nrf_mbr.h"
 | 
					 | 
				
			||||||
#include "dfu_init.h"
 | 
					 | 
				
			||||||
#include "sdk_common.h"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static dfu_state_t                  m_dfu_state;                /**< Current DFU state. */
 | 
					 | 
				
			||||||
static uint32_t                     m_image_size;               /**< Size of the image that will be transmitted. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static dfu_start_packet_t           m_start_packet;             /**< Start packet received for this update procedure. Contains update mode and image sizes information to be used for image transfer. */
 | 
					 | 
				
			||||||
static uint8_t                      m_init_packet[128];         /**< Init packet, can hold CRC, Hash, Signed Hash and similar, for image validation, integrety check and authorization checking. */ 
 | 
					 | 
				
			||||||
static uint8_t                      m_init_packet_length;       /**< Length of init packet received. */
 | 
					 | 
				
			||||||
static uint16_t                     m_image_crc;                /**< Calculated CRC of the image received. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
APP_TIMER_DEF(m_dfu_timer_id);                                  /**< Application timer id. */
 | 
					 | 
				
			||||||
static bool                         m_dfu_timed_out = false;    /**< Boolean flag value for tracking DFU timer timeout state. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static pstorage_handle_t            m_storage_handle_swap;      /**< Pstorage handle for the swap area (bank 1). Bank used when updating an application or bootloader without SoftDevice. */
 | 
					 | 
				
			||||||
static pstorage_handle_t            m_storage_handle_app;       /**< Pstorage handle for the application area (bank 0). Bank used when updating a SoftDevice w/wo bootloader. Handle also used when swapping received application from bank 1 to bank 0. */
 | 
					 | 
				
			||||||
static pstorage_handle_t          * mp_storage_handle_active;   /**< Pointer to the pstorage handle for the active bank for receiving of data packets. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static dfu_callback_t               m_data_pkt_cb;              /**< Callback from DFU Bank module for notification of asynchronous operation such as flash prepare. */
 | 
					 | 
				
			||||||
static dfu_bank_func_t              m_functions;                /**< Structure holding operations for the selected update process. */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief Function for handling callbacks from pstorage module.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @details Handles pstorage results for clear and storage operation. For detailed description of
 | 
					 | 
				
			||||||
 *          the parameters provided with the callback, please refer to \ref pstorage_ntf_cb_t.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void pstorage_callback_handler(pstorage_handle_t * p_handle,
 | 
					 | 
				
			||||||
                                      uint8_t             op_code,
 | 
					 | 
				
			||||||
                                      uint32_t            result,
 | 
					 | 
				
			||||||
                                      uint8_t           * p_data,
 | 
					 | 
				
			||||||
                                      uint32_t            data_len)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    switch (op_code)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        case PSTORAGE_STORE_OP_CODE:
 | 
					 | 
				
			||||||
            if ((m_dfu_state == DFU_STATE_RX_DATA_PKT) && (m_data_pkt_cb != NULL))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                m_data_pkt_cb(DATA_PACKET, result, p_data);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        case PSTORAGE_CLEAR_OP_CODE:
 | 
					 | 
				
			||||||
            if (m_dfu_state == DFU_STATE_PREPARING)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                m_functions.cleared();
 | 
					 | 
				
			||||||
                m_dfu_state = DFU_STATE_RDY;
 | 
					 | 
				
			||||||
                if (m_data_pkt_cb != NULL)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    m_data_pkt_cb(START_PACKET, result, p_data);
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        default:
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(result);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief Function for handling the DFU timeout.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @param[in] p_context The timeout context.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void dfu_timeout_handler(void * p_context)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    UNUSED_PARAMETER(p_context);
 | 
					 | 
				
			||||||
    dfu_update_status_t update_status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_dfu_timed_out           = true;
 | 
					 | 
				
			||||||
    update_status.status_code = DFU_TIMEOUT;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief   Function for restarting the DFU Timer.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @details This function will stop and restart the DFU timer. This function will be called by the
 | 
					 | 
				
			||||||
 *          functions handling any DFU packet received from the peer that is transferring a firmware
 | 
					 | 
				
			||||||
 *          image.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static uint32_t dfu_timer_restart(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    if (m_dfu_timed_out)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        // The DFU timer had already timed out.
 | 
					 | 
				
			||||||
        return NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    uint32_t err_code = app_timer_stop(m_dfu_timer_id);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief   Function for preparing of flash before receiving SoftDevice image.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @details This function will erase current application area to ensure sufficient amount of
 | 
					 | 
				
			||||||
 *          storage for the SoftDevice image. Upon erase complete a callback will be done.
 | 
					 | 
				
			||||||
 *          See \ref dfu_bank_prepare_t for further details.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void dfu_prepare_func_app_erase(uint32_t image_size)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mp_storage_handle_active = &m_storage_handle_app;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Doing a SoftDevice update thus current application must be cleared to ensure enough space
 | 
					 | 
				
			||||||
    // for new SoftDevice.
 | 
					 | 
				
			||||||
    m_dfu_state = DFU_STATE_PREPARING;
 | 
					 | 
				
			||||||
    err_code    = pstorage_clear(&m_storage_handle_app, m_image_size);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief   Function for preparing swap before receiving application or bootloader image.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @details This function will erase current swap area to ensure flash is ready for storage of the
 | 
					 | 
				
			||||||
 *          Application or Bootloader image. Upon erase complete a callback will be done.
 | 
					 | 
				
			||||||
 *          See \ref dfu_bank_prepare_t for further details.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void dfu_prepare_func_swap_erase(uint32_t image_size)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    mp_storage_handle_active = &m_storage_handle_swap;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_dfu_state = DFU_STATE_PREPARING;
 | 
					 | 
				
			||||||
//    err_code    = pstorage_clear(&m_storage_handle_swap, DFU_IMAGE_MAX_SIZE_BANKED);
 | 
					 | 
				
			||||||
    err_code    = pstorage_clear(&m_storage_handle_swap, image_size);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief   Function for handling behaviour when clear operation has completed.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void dfu_cleared_func_swap(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    // Do nothing.
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief   Function for handling behaviour when clear operation has completed.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static void dfu_cleared_func_app(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    dfu_update_status_t update_status = {DFU_BANK_0_ERASED, };
 | 
					 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief   Function for calculating storage offset for receiving SoftDevice image.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @details When a new SoftDevice is received it will be temporary stored in flash before moved to
 | 
					 | 
				
			||||||
 *          address 0x0. In order to succesfully validate transfer and relocation it is important
 | 
					 | 
				
			||||||
 *          that temporary image and final installed image does not ovwerlap hence an offset must
 | 
					 | 
				
			||||||
 *          be calculated in case new image is larger than currently installed SoftDevice.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
uint32_t offset_calculate(uint32_t sd_image_size)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t offset = 0;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if (m_start_packet.sd_image_size > DFU_BANK_0_REGION_START)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        uint32_t page_mask = (CODE_PAGE_SIZE - 1);
 | 
					 | 
				
			||||||
        uint32_t diff = m_start_packet.sd_image_size - DFU_BANK_0_REGION_START;
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        offset = diff & ~page_mask;
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        // Align offset to next page if image size is not page sized.
 | 
					 | 
				
			||||||
        if ((diff & page_mask) > 0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            offset += CODE_PAGE_SIZE;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return offset;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief Function for activating received SoftDevice image.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  @note This function will not move the SoftDevice image.
 | 
					 | 
				
			||||||
 *        The bootloader settings will be marked as SoftDevice update complete and the swapping of
 | 
					 | 
				
			||||||
 *        current SoftDevice will occur after system reset.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return NRF_SUCCESS on success.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static uint32_t dfu_activate_sd(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    dfu_update_status_t update_status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    update_status.status_code    = DFU_UPDATE_SD_COMPLETE;
 | 
					 | 
				
			||||||
    update_status.app_crc        = m_image_crc;
 | 
					 | 
				
			||||||
    update_status.sd_image_start = DFU_BANK_0_REGION_START;
 | 
					 | 
				
			||||||
    update_status.sd_size        = m_start_packet.sd_image_size;
 | 
					 | 
				
			||||||
    update_status.bl_size        = m_start_packet.bl_image_size;
 | 
					 | 
				
			||||||
    update_status.app_size       = m_start_packet.app_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return NRF_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief Function for activating received Application image.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  @details This function will move the received application image fram swap (bank 1) to
 | 
					 | 
				
			||||||
 *           application area (bank 0).
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return NRF_SUCCESS on success. Error code otherwise.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static uint32_t dfu_activate_app(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Erase BANK 0.
 | 
					 | 
				
			||||||
    err_code = pstorage_clear(&m_storage_handle_app, m_start_packet.app_image_size);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    err_code = pstorage_store(&m_storage_handle_app,
 | 
					 | 
				
			||||||
                                  (uint8_t *)m_storage_handle_swap.block_id,
 | 
					 | 
				
			||||||
                                  m_start_packet.app_image_size,
 | 
					 | 
				
			||||||
                                  0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (err_code == NRF_SUCCESS)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        dfu_update_status_t update_status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        memset(&update_status, 0, sizeof(dfu_update_status_t ));
 | 
					 | 
				
			||||||
        update_status.status_code = DFU_UPDATE_APP_COMPLETE;
 | 
					 | 
				
			||||||
        update_status.app_crc     = m_image_crc;
 | 
					 | 
				
			||||||
        update_status.app_size    = m_start_packet.app_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        bootloader_dfu_update_process(update_status);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
/**@brief Function for activating received Bootloader image.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 *  @note This function will not move the bootloader image.
 | 
					 | 
				
			||||||
 *        The bootloader settings will be marked as Bootloader update complete and the swapping of
 | 
					 | 
				
			||||||
 *        current bootloader will occur after system reset.
 | 
					 | 
				
			||||||
 *
 | 
					 | 
				
			||||||
 * @return NRF_SUCCESS on success.
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
static uint32_t dfu_activate_bl(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    dfu_update_status_t update_status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    update_status.status_code = DFU_UPDATE_BOOT_COMPLETE;
 | 
					 | 
				
			||||||
    update_status.app_crc     = m_image_crc;
 | 
					 | 
				
			||||||
    update_status.sd_size     = m_start_packet.sd_image_size;
 | 
					 | 
				
			||||||
    update_status.bl_size     = m_start_packet.bl_image_size;
 | 
					 | 
				
			||||||
    update_status.app_size    = m_start_packet.app_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return NRF_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_init(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t                err_code;
 | 
					 | 
				
			||||||
    pstorage_module_param_t storage_module_param = {.cb = pstorage_callback_handler};
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_init_packet_length = 0;
 | 
					 | 
				
			||||||
    m_image_crc          = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    err_code = pstorage_register(&storage_module_param, &m_storage_handle_app);
 | 
					 | 
				
			||||||
    if (err_code != NRF_SUCCESS)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        m_dfu_state = DFU_STATE_INIT_ERROR;
 | 
					 | 
				
			||||||
        return err_code;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_storage_handle_app.block_id  = DFU_BANK_0_REGION_START;
 | 
					 | 
				
			||||||
    m_storage_handle_swap          = m_storage_handle_app;
 | 
					 | 
				
			||||||
    m_storage_handle_swap.block_id = DFU_BANK_1_REGION_START;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Create the timer to monitor the activity by the peer doing the firmware update.
 | 
					 | 
				
			||||||
    err_code = app_timer_create(&m_dfu_timer_id,
 | 
					 | 
				
			||||||
                                APP_TIMER_MODE_SINGLE_SHOT,
 | 
					 | 
				
			||||||
                                dfu_timeout_handler);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Start the DFU timer.
 | 
					 | 
				
			||||||
    err_code = app_timer_start(m_dfu_timer_id, DFU_TIMEOUT_INTERVAL, NULL);
 | 
					 | 
				
			||||||
    APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_data_received = 0;
 | 
					 | 
				
			||||||
    m_dfu_state     = DFU_STATE_IDLE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return NRF_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void dfu_register_callback(dfu_callback_t callback_handler)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    m_data_pkt_cb = callback_handler;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_start_pkt_handle(dfu_update_packet_t * p_packet)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_start_packet = *(p_packet->params.start_packet);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check that the requested update procedure is supported.
 | 
					 | 
				
			||||||
    // Currently the following combinations are allowed:
 | 
					 | 
				
			||||||
    // - Application
 | 
					 | 
				
			||||||
    // - SoftDevice
 | 
					 | 
				
			||||||
    // - Bootloader
 | 
					 | 
				
			||||||
    // - SoftDevice with Bootloader
 | 
					 | 
				
			||||||
    if (IS_UPDATING_APP(m_start_packet) && 
 | 
					 | 
				
			||||||
        (IS_UPDATING_SD(m_start_packet) || IS_UPDATING_BL(m_start_packet)))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        // App update is only supported independently.
 | 
					 | 
				
			||||||
        return NRF_ERROR_NOT_SUPPORTED;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (!(IS_WORD_SIZED(m_start_packet.sd_image_size) &&
 | 
					 | 
				
			||||||
          IS_WORD_SIZED(m_start_packet.bl_image_size) &&
 | 
					 | 
				
			||||||
          IS_WORD_SIZED(m_start_packet.app_image_size)))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        // Image_sizes are not a multiple of 4 (word size).
 | 
					 | 
				
			||||||
        return NRF_ERROR_NOT_SUPPORTED;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    m_image_size = m_start_packet.sd_image_size + m_start_packet.bl_image_size +
 | 
					 | 
				
			||||||
                   m_start_packet.app_image_size;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if (m_start_packet.bl_image_size > DFU_BL_IMAGE_MAX_SIZE)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return NRF_ERROR_DATA_SIZE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (IS_UPDATING_SD(m_start_packet))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (m_image_size > (DFU_IMAGE_MAX_SIZE_FULL))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            return NRF_ERROR_DATA_SIZE;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        m_functions.prepare  = dfu_prepare_func_app_erase;
 | 
					 | 
				
			||||||
        m_functions.cleared  = dfu_cleared_func_app;
 | 
					 | 
				
			||||||
        m_functions.activate = dfu_activate_sd;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (m_image_size > DFU_IMAGE_MAX_SIZE_BANKED)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            return NRF_ERROR_DATA_SIZE;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        m_functions.prepare = dfu_prepare_func_swap_erase;
 | 
					 | 
				
			||||||
        m_functions.cleared = dfu_cleared_func_swap;
 | 
					 | 
				
			||||||
        if (IS_UPDATING_BL(m_start_packet))
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            m_functions.activate = dfu_activate_bl;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            m_functions.activate = dfu_activate_app;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (m_dfu_state)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        case DFU_STATE_IDLE:
 | 
					 | 
				
			||||||
            // Valid peer activity detected. Hence restart the DFU timer.
 | 
					 | 
				
			||||||
            err_code = dfu_timer_restart();
 | 
					 | 
				
			||||||
            VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
            m_functions.prepare(m_image_size);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        default:
 | 
					 | 
				
			||||||
            err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_data_pkt_handle(dfu_update_packet_t * p_packet)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t   data_length;
 | 
					 | 
				
			||||||
    uint32_t   err_code;
 | 
					 | 
				
			||||||
    uint32_t * p_data;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    VERIFY_PARAM_NOT_NULL(p_packet);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    // Check pointer alignment.
 | 
					 | 
				
			||||||
    if (!is_word_aligned(p_packet->params.data_packet.p_data_packet))
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        // The p_data_packet is not word aligned address.
 | 
					 | 
				
			||||||
        return NRF_ERROR_INVALID_ADDR;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (m_dfu_state)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        case DFU_STATE_RDY:
 | 
					 | 
				
			||||||
        case DFU_STATE_RX_INIT_PKT:
 | 
					 | 
				
			||||||
            return NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        case DFU_STATE_RX_DATA_PKT:
 | 
					 | 
				
			||||||
            data_length = p_packet->params.data_packet.packet_length * sizeof(uint32_t);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if ((m_data_received + data_length) > m_image_size)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                // The caller is trying to write more bytes into the flash than the size provided to
 | 
					 | 
				
			||||||
                // the dfu_image_size_set function. This is treated as a serious error condition and
 | 
					 | 
				
			||||||
                // an unrecoverable one. Hence point the variable mp_app_write_address to the top of
 | 
					 | 
				
			||||||
                // the flash area. This will ensure that all future application data packet writes
 | 
					 | 
				
			||||||
                // will be blocked because of the above check.
 | 
					 | 
				
			||||||
                m_data_received = 0xFFFFFFFF;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                return NRF_ERROR_DATA_SIZE;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Valid peer activity detected. Hence restart the DFU timer.
 | 
					 | 
				
			||||||
            err_code = dfu_timer_restart();
 | 
					 | 
				
			||||||
            VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            p_data = (uint32_t *)p_packet->params.data_packet.p_data_packet;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            err_code = pstorage_store(mp_storage_handle_active,
 | 
					 | 
				
			||||||
                                          (uint8_t *)p_data,
 | 
					 | 
				
			||||||
                                          data_length,
 | 
					 | 
				
			||||||
                                          m_data_received);
 | 
					 | 
				
			||||||
            VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            m_data_received += data_length;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            if (m_data_received != m_image_size)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                // The entire image is not received yet. More data is expected.
 | 
					 | 
				
			||||||
                err_code = NRF_ERROR_INVALID_LENGTH;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                // The entire image has been received. Return NRF_SUCCESS.
 | 
					 | 
				
			||||||
                err_code = NRF_SUCCESS;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        default:
 | 
					 | 
				
			||||||
            err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_init_pkt_complete(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    // DFU initialization has been done and a start packet has been received.
 | 
					 | 
				
			||||||
    if (IMAGE_WRITE_IN_PROGRESS())
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        // Image write is already in progress. Cannot handle an init packet now.
 | 
					 | 
				
			||||||
        return NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if (m_dfu_state == DFU_STATE_RX_INIT_PKT)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        err_code = dfu_init_prevalidate(m_init_packet, m_init_packet_length, m_start_packet.dfu_update_mode);
 | 
					 | 
				
			||||||
        if (err_code == NRF_SUCCESS)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            m_dfu_state = DFU_STATE_RX_DATA_PKT;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            m_init_packet_length = 0;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code = NRF_SUCCESS;
 | 
					 | 
				
			||||||
    uint32_t length;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (m_dfu_state)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        case DFU_STATE_RDY:
 | 
					 | 
				
			||||||
            m_dfu_state = DFU_STATE_RX_INIT_PKT;
 | 
					 | 
				
			||||||
            // When receiving init packet in state ready just update and fall through this case.         
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        case DFU_STATE_RX_INIT_PKT:
 | 
					 | 
				
			||||||
            // DFU initialization has been done and a start packet has been received.
 | 
					 | 
				
			||||||
            if (IMAGE_WRITE_IN_PROGRESS())
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                // Image write is already in progress. Cannot handle an init packet now.
 | 
					 | 
				
			||||||
                return NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Valid peer activity detected. Hence restart the DFU timer.
 | 
					 | 
				
			||||||
            err_code = dfu_timer_restart();
 | 
					 | 
				
			||||||
            VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            length = p_packet->params.data_packet.packet_length * sizeof(uint32_t);
 | 
					 | 
				
			||||||
            if ((m_init_packet_length + length) > sizeof(m_init_packet))
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                return NRF_ERROR_INVALID_LENGTH;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            
 | 
					 | 
				
			||||||
            memcpy(&m_init_packet[m_init_packet_length],
 | 
					 | 
				
			||||||
                   &p_packet->params.data_packet.p_data_packet[0],
 | 
					 | 
				
			||||||
                   length);
 | 
					 | 
				
			||||||
            m_init_packet_length += length;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        default:
 | 
					 | 
				
			||||||
            // Either the start packet was not received or dfu_init function was not called before.
 | 
					 | 
				
			||||||
            err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_image_validate()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (m_dfu_state)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        case DFU_STATE_RX_DATA_PKT:
 | 
					 | 
				
			||||||
            // Check if the application image write has finished.
 | 
					 | 
				
			||||||
            if (m_data_received != m_image_size)
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                // Image not yet fully transfered by the peer or the peer has attempted to write
 | 
					 | 
				
			||||||
                // too much data. Hence the validation should fail.
 | 
					 | 
				
			||||||
                err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                m_dfu_state = DFU_STATE_VALIDATE;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // Valid peer activity detected. Hence restart the DFU timer.
 | 
					 | 
				
			||||||
                err_code = dfu_timer_restart();
 | 
					 | 
				
			||||||
                if (err_code == NRF_SUCCESS)
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    err_code = dfu_init_postvalidate((uint8_t *)mp_storage_handle_active->block_id,
 | 
					 | 
				
			||||||
                                                     m_image_size);
 | 
					 | 
				
			||||||
                    VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    m_dfu_state = DFU_STATE_WAIT_4_ACTIVATE;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        default:
 | 
					 | 
				
			||||||
            err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_image_activate()
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    uint32_t err_code;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    switch (m_dfu_state)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        case DFU_STATE_WAIT_4_ACTIVATE:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            // Stop the DFU Timer because the peer activity need not be monitored any longer.
 | 
					 | 
				
			||||||
            err_code = app_timer_stop(m_dfu_timer_id);
 | 
					 | 
				
			||||||
            APP_ERROR_CHECK(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            err_code = m_functions.activate();
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        default:
 | 
					 | 
				
			||||||
            err_code = NRF_ERROR_INVALID_STATE;
 | 
					 | 
				
			||||||
            break;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return err_code;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
void dfu_reset(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    dfu_update_status_t update_status;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    update_status.status_code = DFU_RESET;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static uint32_t dfu_compare_block(uint32_t * ptr1, uint32_t * ptr2, uint32_t len)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    sd_mbr_command_t sd_mbr_cmd;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.compare.ptr1 = ptr1;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.compare.ptr2 = ptr2;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.compare.len  = len / sizeof(uint32_t);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return sd_mbr_command(&sd_mbr_cmd);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static uint32_t dfu_copy_sd(uint32_t * src, uint32_t * dst, uint32_t len)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    sd_mbr_command_t sd_mbr_cmd;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    sd_mbr_cmd.command            = SD_MBR_COMMAND_COPY_SD;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.copy_sd.src = src;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.copy_sd.dst = dst;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.copy_sd.len = len / sizeof(uint32_t);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return sd_mbr_command(&sd_mbr_cmd);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static uint32_t dfu_sd_img_block_swap(uint32_t * src, 
 | 
					 | 
				
			||||||
                                      uint32_t * dst, 
 | 
					 | 
				
			||||||
                                      uint32_t len, 
 | 
					 | 
				
			||||||
                                      uint32_t block_size)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    // It is neccesarry to swap the new SoftDevice in 3 rounds to ensure correct copy of data
 | 
					 | 
				
			||||||
    // and verifucation of data in case power reset occurs during write to flash. 
 | 
					 | 
				
			||||||
    // To ensure the robustness of swapping the images are compared backwards till start of
 | 
					 | 
				
			||||||
    // image swap. If the back is identical everything is swapped.
 | 
					 | 
				
			||||||
    uint32_t err_code = dfu_compare_block(src, dst, len);
 | 
					 | 
				
			||||||
    if (err_code == NRF_SUCCESS)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return err_code;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if ((uint32_t)dst > SOFTDEVICE_REGION_START)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        err_code = dfu_sd_img_block_swap((uint32_t *)((uint32_t)src - block_size), 
 | 
					 | 
				
			||||||
                                         (uint32_t *)((uint32_t)dst - block_size), 
 | 
					 | 
				
			||||||
                                         block_size, 
 | 
					 | 
				
			||||||
                                         block_size);
 | 
					 | 
				
			||||||
        VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    err_code = dfu_copy_sd(src, dst, len);
 | 
					 | 
				
			||||||
    VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return dfu_compare_block(src, dst, len);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_sd_image_swap(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    bootloader_settings_t boot_settings;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_settings_get(&boot_settings);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (boot_settings.sd_image_size == 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return NRF_SUCCESS;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if ((SOFTDEVICE_REGION_START + boot_settings.sd_image_size) > boot_settings.sd_image_start)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        uint32_t err_code;
 | 
					 | 
				
			||||||
        uint32_t sd_start        = SOFTDEVICE_REGION_START;
 | 
					 | 
				
			||||||
        uint32_t block_size      = (boot_settings.sd_image_start - sd_start) / 2;
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        /* ##### FIX START ##### */
 | 
					 | 
				
			||||||
        block_size &= ~(uint32_t)(CODE_PAGE_SIZE - 1); 
 | 
					 | 
				
			||||||
        /* ##### FIX END ##### */       
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        uint32_t image_end       = boot_settings.sd_image_start + boot_settings.sd_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        uint32_t img_block_start = boot_settings.sd_image_start + 2 * block_size;
 | 
					 | 
				
			||||||
        uint32_t sd_block_start  = sd_start + 2 * block_size;
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        if (SD_SIZE_GET(MBR_SIZE) < boot_settings.sd_image_size)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            // This will clear a page thus ensuring the old image is invalidated before swapping.
 | 
					 | 
				
			||||||
            err_code = dfu_copy_sd((uint32_t *)(sd_start + block_size), 
 | 
					 | 
				
			||||||
                                   (uint32_t *)(sd_start + block_size), 
 | 
					 | 
				
			||||||
                                   sizeof(uint32_t));
 | 
					 | 
				
			||||||
            VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            err_code = dfu_copy_sd((uint32_t *)sd_start, (uint32_t *)sd_start, sizeof(uint32_t));
 | 
					 | 
				
			||||||
            VERIFY_SUCCESS(err_code);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
        
 | 
					 | 
				
			||||||
        return dfu_sd_img_block_swap((uint32_t *)img_block_start, 
 | 
					 | 
				
			||||||
                                     (uint32_t *)sd_block_start, 
 | 
					 | 
				
			||||||
                                     image_end - img_block_start, 
 | 
					 | 
				
			||||||
                                     block_size);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if (boot_settings.sd_image_size != 0)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            return dfu_copy_sd((uint32_t *)boot_settings.sd_image_start,
 | 
					 | 
				
			||||||
                               (uint32_t *)SOFTDEVICE_REGION_START, 
 | 
					 | 
				
			||||||
                               boot_settings.sd_image_size);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return NRF_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_bl_image_swap(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    bootloader_settings_t bootloader_settings;
 | 
					 | 
				
			||||||
    sd_mbr_command_t      sd_mbr_cmd;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_settings_get(&bootloader_settings);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (bootloader_settings.bl_image_size != 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ?
 | 
					 | 
				
			||||||
                                  DFU_BANK_1_REGION_START :
 | 
					 | 
				
			||||||
                                  bootloader_settings.sd_image_start + 
 | 
					 | 
				
			||||||
                                  bootloader_settings.sd_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        sd_mbr_cmd.command               = SD_MBR_COMMAND_COPY_BL;
 | 
					 | 
				
			||||||
        sd_mbr_cmd.params.copy_bl.bl_src = (uint32_t *)(bl_image_start);
 | 
					 | 
				
			||||||
        sd_mbr_cmd.params.copy_bl.bl_len = bootloader_settings.bl_image_size / sizeof(uint32_t);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return sd_mbr_command(&sd_mbr_cmd);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return NRF_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_bl_image_validate(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    bootloader_settings_t bootloader_settings;
 | 
					 | 
				
			||||||
    sd_mbr_command_t      sd_mbr_cmd;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_settings_get(&bootloader_settings);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (bootloader_settings.bl_image_size != 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        uint32_t bl_image_start = (bootloader_settings.sd_image_size == 0) ?
 | 
					 | 
				
			||||||
                                  DFU_BANK_1_REGION_START :
 | 
					 | 
				
			||||||
                                  bootloader_settings.sd_image_start +
 | 
					 | 
				
			||||||
                                  bootloader_settings.sd_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
 | 
					 | 
				
			||||||
        sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)BOOTLOADER_REGION_START;
 | 
					 | 
				
			||||||
        sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)(bl_image_start);
 | 
					 | 
				
			||||||
        sd_mbr_cmd.params.compare.len  = bootloader_settings.bl_image_size / sizeof(uint32_t);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return sd_mbr_command(&sd_mbr_cmd);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    return NRF_SUCCESS;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
uint32_t dfu_sd_image_validate(void)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    bootloader_settings_t bootloader_settings;
 | 
					 | 
				
			||||||
    sd_mbr_command_t      sd_mbr_cmd;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    bootloader_settings_get(&bootloader_settings);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (bootloader_settings.sd_image_size == 0)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return NRF_SUCCESS;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    if ((SOFTDEVICE_REGION_START + bootloader_settings.sd_image_size) > bootloader_settings.sd_image_start)
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        uint32_t sd_start        = SOFTDEVICE_REGION_START;
 | 
					 | 
				
			||||||
        uint32_t block_size      = (bootloader_settings.sd_image_start - sd_start) / 2;
 | 
					 | 
				
			||||||
        uint32_t image_end       = bootloader_settings.sd_image_start + 
 | 
					 | 
				
			||||||
                                   bootloader_settings.sd_image_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        /* ##### FIX START ##### */
 | 
					 | 
				
			||||||
        block_size &= ~(uint32_t)(CODE_PAGE_SIZE - 1); 
 | 
					 | 
				
			||||||
        /* ##### FIX END ##### */       
 | 
					 | 
				
			||||||
        uint32_t img_block_start = bootloader_settings.sd_image_start + 2 * block_size;
 | 
					 | 
				
			||||||
        uint32_t sd_block_start  = sd_start + 2 * block_size;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (SD_SIZE_GET(MBR_SIZE) < bootloader_settings.sd_image_size)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
            return NRF_ERROR_NULL;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        return dfu_sd_img_block_swap((uint32_t *)img_block_start, 
 | 
					 | 
				
			||||||
                                     (uint32_t *)sd_block_start, 
 | 
					 | 
				
			||||||
                                     image_end - img_block_start, 
 | 
					 | 
				
			||||||
                                     block_size);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    
 | 
					 | 
				
			||||||
    sd_mbr_cmd.command             = SD_MBR_COMMAND_COMPARE;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.compare.ptr1 = (uint32_t *)SOFTDEVICE_REGION_START;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.compare.ptr2 = (uint32_t *)bootloader_settings.sd_image_start;
 | 
					 | 
				
			||||||
    sd_mbr_cmd.params.compare.len  = bootloader_settings.sd_image_size / sizeof(uint32_t);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    return sd_mbr_command(&sd_mbr_cmd);
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@@ -164,7 +164,8 @@ static void dfu_prepare_func_app_erase(uint32_t image_size)
 | 
				
			|||||||
 */
 | 
					 */
 | 
				
			||||||
static void dfu_cleared_func_app(void)
 | 
					static void dfu_cleared_func_app(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    dfu_update_status_t update_status = {DFU_BANK_0_ERASED, };
 | 
					    dfu_update_status_t update_status = { 0 };
 | 
				
			||||||
 | 
					    update_status.status_code = DFU_BANK_0_ERASED;
 | 
				
			||||||
    bootloader_dfu_update_process(update_status);
 | 
					    bootloader_dfu_update_process(update_status);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -499,6 +500,7 @@ uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet)
 | 
				
			|||||||
        case DFU_STATE_RDY:
 | 
					        case DFU_STATE_RDY:
 | 
				
			||||||
            m_dfu_state = DFU_STATE_RX_INIT_PKT;
 | 
					            m_dfu_state = DFU_STATE_RX_INIT_PKT;
 | 
				
			||||||
            // When receiving init packet in state ready just update and fall through this case.
 | 
					            // When receiving init packet in state ready just update and fall through this case.
 | 
				
			||||||
 | 
					            /* FALLTHRU */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        case DFU_STATE_RX_INIT_PKT:
 | 
					        case DFU_STATE_RX_INIT_PKT:
 | 
				
			||||||
            // DFU initialization has been done and a start packet has been received.
 | 
					            // DFU initialization has been done and a start packet has been received.
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -967,7 +967,7 @@ static void service_error_handler(uint32_t nrf_error)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, char * p_ascii)
 | 
					static void ascii_to_utf8(ble_srv_utf8_str_t * p_utf8, const char * p_ascii)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    p_utf8->length = (uint16_t)strlen(p_ascii);
 | 
					    p_utf8->length = (uint16_t)strlen(p_ascii);
 | 
				
			||||||
    p_utf8->p_str  = (uint8_t *)p_ascii;
 | 
					    p_utf8->p_str  = (uint8_t *)p_ascii;
 | 
				
			||||||
 
 | 
				
			|||||||
 Submodule lib/tinyusb updated: 23df777b30...f2b761fee9
									
								
							
							
								
								
									
										390
									
								
								segger/Adafruit_nRF52_Bootloader.emProject
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										390
									
								
								segger/Adafruit_nRF52_Bootloader.emProject
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,390 @@
 | 
				
			|||||||
 | 
					<!DOCTYPE CrossStudio_Project_File>
 | 
				
			||||||
 | 
					<solution Name="Adafruit_nRF52_Bootloader" target="8" version="2">
 | 
				
			||||||
 | 
					  <project Name="Adafruit_nRF52_Bootloader">
 | 
				
			||||||
 | 
					    <configuration
 | 
				
			||||||
 | 
					      Name="Common"
 | 
				
			||||||
 | 
					      Placement="Flash"
 | 
				
			||||||
 | 
					      Target="nRF52840_xxAA"
 | 
				
			||||||
 | 
					      arm_architecture="v7EM"
 | 
				
			||||||
 | 
					      arm_core_type="Cortex-M4"
 | 
				
			||||||
 | 
					      arm_endian="Little"
 | 
				
			||||||
 | 
					      arm_fp_abi="Hard"
 | 
				
			||||||
 | 
					      arm_fpu_type="FPv4-SP-D16"
 | 
				
			||||||
 | 
					      arm_interwork="No"
 | 
				
			||||||
 | 
					      arm_linker_heap_size="1024"
 | 
				
			||||||
 | 
					      arm_linker_process_stack_size="0"
 | 
				
			||||||
 | 
					      arm_linker_stack_size="1024"
 | 
				
			||||||
 | 
					      arm_simulator_memory_simulation_parameter="ROM;0x00000000;0x00100000;RAM;0x20000000;0x00040000"
 | 
				
			||||||
 | 
					      arm_target_debug_interface_type="ADIv5"
 | 
				
			||||||
 | 
					      arm_target_device_name="nRF52840_xxAA"
 | 
				
			||||||
 | 
					      arm_target_interface_type="SWD"
 | 
				
			||||||
 | 
					      build_treat_warnings_as_errors="Yes"
 | 
				
			||||||
 | 
					      c_preprocessor_definitions="__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;NO_VTOR_CONFIG;MK_BOOTLOADER_VERSION=0x00020A;CONFIG_GPIO_AS_PINRESET;CONFIG_NFCT_PINS_AS_GPIOS;SOFTDEVICE_PRESENT;CFG_TUSB_DEBUG=2;UF2_VERSION="Segger";BLEDIS_FW_VERSION="Segger""
 | 
				
			||||||
 | 
					      c_user_include_directories=".;../src/;../src/usb;../src/boards;../src/cmsis/include;$(tusbDir);$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include;$(nrfxDir)/drivers/src;$(sdDir)/include;$(sdDir)/include/nrf52;$(sdk11Dir)/drivers_nrf/pstorage;$(sdk11Dir)/ble/common/;$(sdk11Dir)/ble/ble_services/ble_dfu;$(sdk11Dir)/ble/ble_services/ble_dis;$(sdk11Dir)/libraries/bootloader_dfu;$(sdk11Dir)/libraries/bootloader_dfu/hci_transport;$(sdk11Dir)/libraries/util;$(sdkDir)/toolchain/cmsis/include;$(sdkDir)/device;$(sdkDir)/toolchain;$(sdkDir)/drivers_nrf/hal;$(sdkDir)/drivers_nrf/systick;$(sdkDir)/drivers_nrf/uart;$(sdkDir)/drivers_nrf/usbd;$(sdkDir)/drivers_nrf/common;$(sdkDir)/drivers_nrf/delay;$(sdkDir)/drivers_nrf/power;$(sdkDir)/drivers_nrf/clock;$(sdkDir)/libraries/util;$(sdkDir)/libraries/timer;$(sdkDir)/libraries/scheduler;$(sdkDir)/libraries/crc16;$(sdkDir)/libraries/util;$(sdkDir)/libraries/hci/config;$(sdkDir)/libraries/uart;$(sdkDir)/libraries/hci;$(sdkDir)/external/fprintf;$(sdkDir)/libraries/strerror;$(sdkDir)/libraries/atomic;$(sdkDir)/libraries/balloc;$(sdkDir)/libraries/experimental_log/src;$(sdkDir)/libraries/experimental_log;$(sdkDir)/libraries/experimental_section_vars;$(sdkDir)/libraries/experimental_memobj"
 | 
				
			||||||
 | 
					      debug_register_definition_file="$(ProjectDir)/nrf52840_Registers.xml"
 | 
				
			||||||
 | 
					      debug_target_connection="J-Link"
 | 
				
			||||||
 | 
					      gcc_enable_all_warnings="No"
 | 
				
			||||||
 | 
					      gcc_entry_point="Reset_Handler"
 | 
				
			||||||
 | 
					      linker_memory_map_file="$(ProjectDir)/nRF52840_xxAA_MemoryMap.xml"
 | 
				
			||||||
 | 
					      linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
 | 
				
			||||||
 | 
					      macros="DeviceHeaderFile=$(PackagesDir)/nRF/CMSIS/Device/Include/nrf.h;DeviceLibraryIdentifier=M4lf;DeviceSystemFile=$(PackagesDir)/nRF/CMSIS/Device/Source/system_nrf52840.c;DeviceVectorsFile=$(PackagesDir)/nRF/Source/ses_nrf52840_Vectors.s;DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;sdkDir=../lib/sdk/components;sdk11Dir=../lib/sdk11/components;sdDir=../lib/softdevice/s140_nrf52_6.1.1/s140_nrf52_6.1.1_API;tusbDir=../lib/tinyusb/src;nrfxDir=../lib/nrfx"
 | 
				
			||||||
 | 
					      project_directory=""
 | 
				
			||||||
 | 
					      project_type="Executable"
 | 
				
			||||||
 | 
					      target_reset_script="Reset();"
 | 
				
			||||||
 | 
					      target_script_file="$(ProjectDir)/nRF_Target.js"
 | 
				
			||||||
 | 
					      target_trace_initialize_script="EnableTrace("$(TraceInterfaceType)")" />
 | 
				
			||||||
 | 
					    <folder Name="RTT Files">
 | 
				
			||||||
 | 
					      <file file_name="SEGGER_RTT.c" />
 | 
				
			||||||
 | 
					      <file file_name="SEGGER_RTT.h" />
 | 
				
			||||||
 | 
					      <file file_name="SEGGER_RTT_Conf.h" />
 | 
				
			||||||
 | 
					      <file file_name="SEGGER_RTT_SES.c" />
 | 
				
			||||||
 | 
					    </folder>
 | 
				
			||||||
 | 
					    <folder Name="Script Files">
 | 
				
			||||||
 | 
					      <file file_name="nRF_Target.js">
 | 
				
			||||||
 | 
					        <configuration Name="Common" file_type="Reset Script" />
 | 
				
			||||||
 | 
					      </file>
 | 
				
			||||||
 | 
					    </folder>
 | 
				
			||||||
 | 
					    <folder Name="System Files">
 | 
				
			||||||
 | 
					      <file file_name="thumb_crt0.s" />
 | 
				
			||||||
 | 
					      <file file_name="flash_placement.xml" />
 | 
				
			||||||
 | 
					      <file file_name="nRF52840_xxAA_MemoryMap.xml" />
 | 
				
			||||||
 | 
					      <file file_name="nRF52832_xxAA_MemoryMap.xml" />
 | 
				
			||||||
 | 
					    </folder>
 | 
				
			||||||
 | 
					    <folder Name="src">
 | 
				
			||||||
 | 
					      <file file_name="../src/boards.h" />
 | 
				
			||||||
 | 
					      <file file_name="../src/dfu_ble_svc.c" />
 | 
				
			||||||
 | 
					      <file file_name="../src/main.c" />
 | 
				
			||||||
 | 
					      <file file_name="../src/metro52.h" />
 | 
				
			||||||
 | 
					      <file file_name="../src/pstorage_platform.h" />
 | 
				
			||||||
 | 
					      <file file_name="../src/sdk_config.h" />
 | 
				
			||||||
 | 
					      <folder Name="usb">
 | 
				
			||||||
 | 
					        <file file_name="../src/usb/tusb_config.h" />
 | 
				
			||||||
 | 
					        <folder Name="uf2">
 | 
				
			||||||
 | 
					          <file file_name="../src/usb/uf2/uf2cfg.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/usb/uf2/uf2.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/usb/uf2/ghostfat.c" />
 | 
				
			||||||
 | 
					          <file file_name="../src/usb/uf2/macros.h" />
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					        <file file_name="../src/usb/msc_uf2.c" />
 | 
				
			||||||
 | 
					        <file file_name="../src/usb/usb.c" />
 | 
				
			||||||
 | 
					        <file file_name="../src/usb/usb_desc.c" />
 | 
				
			||||||
 | 
					        <file file_name="../src/usb/usb_desc.h" />
 | 
				
			||||||
 | 
					        <configuration Name="Feather52832" build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					      </folder>
 | 
				
			||||||
 | 
					      <folder Name="cmsis">
 | 
				
			||||||
 | 
					        <folder Name="include">
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/arm_common_tables.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/arm_const_structs.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/arm_math.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/cmsis_armcc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/cmsis_armcc_V6.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/cmsis_gcc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cm0.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cm0plus.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cm3.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cm4.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cm7.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cmFunc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cmInstr.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_cmSimd.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_sc000.h" />
 | 
				
			||||||
 | 
					          <file file_name="../src/cmsis/include/core_sc300.h" />
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					      </folder>
 | 
				
			||||||
 | 
					      <folder Name="boards">
 | 
				
			||||||
 | 
					        <file file_name="../src/boards/pca10056.h" />
 | 
				
			||||||
 | 
					        <file file_name="../src/boards/feather_nrf52832.h" />
 | 
				
			||||||
 | 
					        <file file_name="../src/boards/feather_nrf52840_express.h" />
 | 
				
			||||||
 | 
					        <file file_name="../src/boards/pca10059.h" />
 | 
				
			||||||
 | 
					      </folder>
 | 
				
			||||||
 | 
					      <file file_name="../src/dfu_init.c" />
 | 
				
			||||||
 | 
					      <file file_name="../src/boards.c" />
 | 
				
			||||||
 | 
					      <file file_name="../src/flash_nrf5x.h" />
 | 
				
			||||||
 | 
					      <file file_name="../src/flash_nrf5x.c" />
 | 
				
			||||||
 | 
					    </folder>
 | 
				
			||||||
 | 
					    <configuration Name="Debug Single" gcc_optimization_level="Debug" />
 | 
				
			||||||
 | 
					    <configuration
 | 
				
			||||||
 | 
					      Name="Release Single"
 | 
				
			||||||
 | 
					      gcc_optimization_level="Optimize For Size" />
 | 
				
			||||||
 | 
					    <folder Name="lib">
 | 
				
			||||||
 | 
					      <folder
 | 
				
			||||||
 | 
					        Name="sdk"
 | 
				
			||||||
 | 
					        exclude=""
 | 
				
			||||||
 | 
					        filter="*.h;*.c"
 | 
				
			||||||
 | 
					        path="../lib/sdk"
 | 
				
			||||||
 | 
					        recurse="Yes" />
 | 
				
			||||||
 | 
					      <folder Name="sdk11">
 | 
				
			||||||
 | 
					        <folder Name="components">
 | 
				
			||||||
 | 
					          <folder Name="ble">
 | 
				
			||||||
 | 
					            <folder Name="ble_services">
 | 
				
			||||||
 | 
					              <folder Name="ble_dfu">
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/ble/ble_services/ble_dfu/ble_dfu.c" />
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/ble/ble_services/ble_dfu/ble_dfu.h" />
 | 
				
			||||||
 | 
					              </folder>
 | 
				
			||||||
 | 
					              <folder Name="ble_dis">
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/ble/ble_services/ble_dis/ble_dis.c" />
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/ble/ble_services/ble_dis/ble_dis.h" />
 | 
				
			||||||
 | 
					              </folder>
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					            <folder Name="common">
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/ble/common/ble_srv_common.h" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="drivers_nrf">
 | 
				
			||||||
 | 
					            <folder Name="pstorage">
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/drivers_nrf/pstorage/pstorage.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/drivers_nrf/pstorage/pstorage_raw.c" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="libraries">
 | 
				
			||||||
 | 
					            <folder Name="bootloader_dfu">
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader_types.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader_util.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/bootloader_util.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_bank_internal.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_ble_svc.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_init.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_transport.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_types.h" />
 | 
				
			||||||
 | 
					              <folder Name="ble_transport">
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h" />
 | 
				
			||||||
 | 
					              </folder>
 | 
				
			||||||
 | 
					              <folder Name="hci_transport">
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h" />
 | 
				
			||||||
 | 
					                <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h" />
 | 
				
			||||||
 | 
					              </folder>
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					            <folder Name="util">
 | 
				
			||||||
 | 
					              <file file_name="../lib/sdk11/components/libraries/util/nrf_log.h" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					      </folder>
 | 
				
			||||||
 | 
					      <folder Name="tinyusb">
 | 
				
			||||||
 | 
					        <folder Name="src">
 | 
				
			||||||
 | 
					          <file file_name="../lib/tinyusb/src/tusb.c" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/tinyusb/src/tusb.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/tinyusb/src/tusb_hal.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/tinyusb/src/tusb_option.h" />
 | 
				
			||||||
 | 
					          <folder Name="class">
 | 
				
			||||||
 | 
					            <folder Name="cdc">
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/cdc/cdc.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/cdc/cdc_device.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/cdc/cdc_device.h" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					            <folder Name="hid">
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/hid/hid.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/hid/hid_device.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/hid/hid_device.h" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					            <folder Name="msc">
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/msc/msc.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/msc/msc_device.c" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/class/msc/msc_device.h" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="common">
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/binary.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/timeout_timer.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_common.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_compiler.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_error.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_fifo.c" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_fifo.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_types.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/common/tusb_verify.h" />
 | 
				
			||||||
 | 
					            <folder Name="compiler">
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/common/compiler/tusb_compiler_gcc.h" />
 | 
				
			||||||
 | 
					              <file file_name="../lib/tinyusb/src/common/compiler/tusb_compiler_iar.h" />
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="device">
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/device/dcd.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/device/usbd.c" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/device/usbd.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/device/usbd_pvt.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/device/usbd_control.c" />
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="osal">
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/osal/osal.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/tinyusb/src/osal/osal_none.h" />
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="portable">
 | 
				
			||||||
 | 
					            <folder Name="nordic">
 | 
				
			||||||
 | 
					              <folder Name="nrf5x">
 | 
				
			||||||
 | 
					                <file file_name="../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c" />
 | 
				
			||||||
 | 
					              </folder>
 | 
				
			||||||
 | 
					            </folder>
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					        <configuration Name="Feather52832" build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					      </folder>
 | 
				
			||||||
 | 
					      <folder Name="nrfx">
 | 
				
			||||||
 | 
					        <file file_name="../lib/nrfx/nrfx.h" />
 | 
				
			||||||
 | 
					        <folder Name="drivers">
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/drivers/nrfx_common.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/drivers/nrfx_errors.h" />
 | 
				
			||||||
 | 
					          <folder Name="include">
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrf_bitmask.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_adc.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_clock.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_comp.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_gpiote.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_i2s.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_lpcomp.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_pdm.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_power.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_power_clock.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_ppi.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_pwm.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_qdec.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_qspi.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_rng.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_rtc.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_saadc.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_spi.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_spim.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_spis.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_swi.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_systick.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_timer.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_twi.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_twim.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_twis.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_uart.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_uarte.h" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/include/nrfx_wdt.h" />
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					          <folder Name="src">
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/src/nrfx_power.c" />
 | 
				
			||||||
 | 
					            <file file_name="../lib/nrfx/drivers/src/nrfx_nvmc.c" />
 | 
				
			||||||
 | 
					          </folder>
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					        <folder Name="hal">
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_adc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_ccm.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_clock.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_comp.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_ecb.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_egu.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_gpio.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_gpiote.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_i2s.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_lpcomp.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_nvmc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_pdm.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_power.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_ppi.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_pwm.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_qdec.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_qspi.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_radio.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_rng.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_rtc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_saadc.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_spi.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_spim.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_spis.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_systick.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_temp.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_timer.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_twi.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_twim.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_twis.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_uart.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_uarte.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_usbd.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/hal/nrf_wdt.h" />
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					        <folder Name="mdk">
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/compiler_abstraction.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf52.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf52832_peripherals.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf52840.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf52840_bitfields.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf52840_peripherals.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf52_bitfields.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/nrf_peripherals.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/ses_startup_nrf52.s">
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52840 Size++"
 | 
				
			||||||
 | 
					              build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52840"
 | 
				
			||||||
 | 
					              build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					            <configuration Name="PCA10056" build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					          </file>
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/ses_startup_nrf52840.s">
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52840 Size++"
 | 
				
			||||||
 | 
					              build_exclude_from_build="No" />
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52832"
 | 
				
			||||||
 | 
					              build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					          </file>
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/ses_startup_nrf_common.s">
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52840 Size++"
 | 
				
			||||||
 | 
					              build_exclude_from_build="No" />
 | 
				
			||||||
 | 
					          </file>
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/startup_config.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/system_nrf52.c">
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52840 Size++"
 | 
				
			||||||
 | 
					              build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52840"
 | 
				
			||||||
 | 
					              build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					            <configuration Name="PCA10056" build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					          </file>
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/system_nrf52.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/system_nrf52840.c">
 | 
				
			||||||
 | 
					            <configuration
 | 
				
			||||||
 | 
					              Name="Feather52832"
 | 
				
			||||||
 | 
					              build_exclude_from_build="Yes" />
 | 
				
			||||||
 | 
					          </file>
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/mdk/system_nrf52840.h" />
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					        <folder Name="soc">
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/soc/nrfx_coredep.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/soc/nrfx_irqs.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/soc/nrfx_irqs_nrf51.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/soc/nrfx_irqs_nrf52810.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/soc/nrfx_irqs_nrf52832.h" />
 | 
				
			||||||
 | 
					          <file file_name="../lib/nrfx/soc/nrfx_irqs_nrf52840.h" />
 | 
				
			||||||
 | 
					        </folder>
 | 
				
			||||||
 | 
					      </folder>
 | 
				
			||||||
 | 
					    </folder>
 | 
				
			||||||
 | 
					    <configuration
 | 
				
			||||||
 | 
					      Name="Feather52840"
 | 
				
			||||||
 | 
					      c_preprocessor_definitions="NRF52840_XXAA;S140"
 | 
				
			||||||
 | 
					      c_user_include_directories="../src/boards/feather_nrf52840_express"
 | 
				
			||||||
 | 
					      gcc_optimization_level="Debug"
 | 
				
			||||||
 | 
					      linker_memory_map_file="nRF52840_xxAA_MemoryMap.xml" />
 | 
				
			||||||
 | 
					    <configuration
 | 
				
			||||||
 | 
					      Name="Feather52832"
 | 
				
			||||||
 | 
					      c_preprocessor_definitions="NRF52832_XXAA;S132"
 | 
				
			||||||
 | 
					      c_user_include_directories="../src/boards/feather_nrf52832"
 | 
				
			||||||
 | 
					      gcc_optimization_level="Debug"
 | 
				
			||||||
 | 
					      linker_memory_map_file="nRF52832_xxAA_MemoryMap.xml" />
 | 
				
			||||||
 | 
					    <configuration
 | 
				
			||||||
 | 
					      Name="PCA10056"
 | 
				
			||||||
 | 
					      c_preprocessor_definitions="NRF52840_XXAA;S140"
 | 
				
			||||||
 | 
					      c_user_include_directories="../src/boards/pca10056"
 | 
				
			||||||
 | 
					      gcc_optimization_level="Debug"
 | 
				
			||||||
 | 
					      linker_memory_map_file="nRF52840_xxAA_MemoryMap.xml" />
 | 
				
			||||||
 | 
					  </project>
 | 
				
			||||||
 | 
					  <configuration Name="Feather52840" />
 | 
				
			||||||
 | 
					  <configuration Name="Feather52832" />
 | 
				
			||||||
 | 
					  <configuration Name="PCA10056" />
 | 
				
			||||||
 | 
					</solution>
 | 
				
			||||||
@@ -295,7 +295,7 @@ void led_state(uint32_t state)
 | 
				
			|||||||
    } else if (temp_color_active) {
 | 
					    } else if (temp_color_active) {
 | 
				
			||||||
        final_color = (uint8_t*)&rgb_color;
 | 
					        final_color = (uint8_t*)&rgb_color;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    #if LED_NEOPIXEL || defined(LED_RGB_RED_PIN)
 | 
					    #if defined(LED_NEOPIXEL) || defined(LED_RGB_RED_PIN)
 | 
				
			||||||
    if (final_color != NULL) {
 | 
					    if (final_color != NULL) {
 | 
				
			||||||
        neopixel_write(final_color);
 | 
					        neopixel_write(final_color);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,16 +46,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(0, 29) // middle button
 | 
					#define BUTTON_2              _PINNUM(0, 29) // middle button
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         _PINNUM(0, 28) // SDA
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         _PINNUM(0, 3) // SCL
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "ARAMCON Badge Team"
 | 
					#define BLEDIS_MANUFACTURER   "ARAMCON Badge Team"
 | 
				
			||||||
#define BLEDIS_MODEL          "ARAMCON Badge 2019"
 | 
					#define BLEDIS_MODEL          "ARAMCON Badge 2019"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,15 +47,6 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(0, 10)
 | 
					#define BUTTON_2              _PINNUM(0, 10)
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
#define RX_PIN_NUMBER         8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
// BLE OTA
 | 
					// BLE OTA
 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,16 +42,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(1, 12)  // D3 switch
 | 
					#define BUTTON_2              _PINNUM(1, 12)  // D3 switch
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         _PINNUM(1, 10)
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         _PINNUM(1, 3)
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Arduino"
 | 
					#define BLEDIS_MANUFACTURER   "Arduino"
 | 
				
			||||||
#define BLEDIS_MODEL          "Nano 33 BLE"
 | 
					#define BLEDIS_MODEL          "Nano 33 BLE"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,16 +46,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(1, 15)     // right button
 | 
					#define BUTTON_2              _PINNUM(1, 15)     // right button
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLDOWN
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLDOWN
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         _PINNUM(0, 30)
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         _PINNUM(0, 14)
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "Circuit Playground nRF52840"
 | 
					#define BLEDIS_MODEL          "Circuit Playground nRF52840"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,16 +46,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(1, 10)     // right button
 | 
					#define BUTTON_2              _PINNUM(1, 10)     // right button
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         _PINNUM(0, 09)
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         _PINNUM(0, 10)
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "CLUE nRF52840"
 | 
					#define BLEDIS_MODEL          "CLUE nRF52840"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,19 +47,15 @@
 | 
				
			|||||||
#define BUTTON_2            1  // P0.1 not exposed anywhere, FRST n/a
 | 
					#define BUTTON_2            1  // P0.1 not exposed anywhere, FRST n/a
 | 
				
			||||||
#define BUTTON_PULL         NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL         NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER       7
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER       8
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER      0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER      0
 | 
					 | 
				
			||||||
#define HWFC                false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER    "Electronut Labs"
 | 
					#define BLEDIS_MANUFACTURER    "Electronut Labs"
 | 
				
			||||||
#define BLEDIS_MODEL           "Papyr"
 | 
					#define BLEDIS_MODEL           "Papyr"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME    "Electronut Labs Papyr"
 | 
					#define UF2_PRODUCT_NAME    "Electronut Labs Papyr"
 | 
				
			||||||
#define UF2_BOARD_ID        "nRF52840-Papyr-v1"
 | 
					#define UF2_BOARD_ID        "nRF52840-Papyr-v1"
 | 
				
			||||||
#define UF2_INDEX_URL       "https://docs.electronut.in/papyr"
 | 
					#define UF2_INDEX_URL       "https://docs.electronut.in/papyr"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,9 @@
 | 
				
			|||||||
#define RTS_PIN_NUMBER     0
 | 
					#define RTS_PIN_NUMBER     0
 | 
				
			||||||
#define HWFC               false
 | 
					#define HWFC               false
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Used as model string in OTA mode
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// BLE OTA
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define BLEDIS_MANUFACTURER "Adafruit Industries"
 | 
					#define BLEDIS_MANUFACTURER "Adafruit Industries"
 | 
				
			||||||
#define BLEDIS_MODEL        "Feather nRF52832"
 | 
					#define BLEDIS_MODEL        "Feather nRF52832"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,15 +47,6 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(0, 10)
 | 
					#define BUTTON_2              _PINNUM(0, 10)
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
#define RX_PIN_NUMBER         8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
// BLE OTA
 | 
					// BLE OTA
 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,16 +46,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(1, 02)  // D2 breakout
 | 
					#define BUTTON_2              _PINNUM(1, 02)  // D2 breakout
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         _PINNUM(0, 25)
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         _PINNUM(0, 24)
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "ItsyBitsy nRF52840 Express"
 | 
					#define BLEDIS_MODEL          "ItsyBitsy nRF52840 Express"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -39,6 +39,7 @@
 | 
				
			|||||||
//#define LED_RGB_GREEN_PIN     _PINNUM(0, 22)
 | 
					//#define LED_RGB_GREEN_PIN     _PINNUM(0, 22)
 | 
				
			||||||
//#define LED_RGB_BLUE_PIN      _PINNUM(0, 24)
 | 
					//#define LED_RGB_BLUE_PIN      _PINNUM(0, 24)
 | 
				
			||||||
#define BOARD_RGB_BRIGHTNESS  0x404040
 | 
					#define BOARD_RGB_BRIGHTNESS  0x404040
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					/*------------------------------------------------------------------*/
 | 
				
			||||||
/* BUTTON
 | 
					/* BUTTON
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					 *------------------------------------------------------------------*/
 | 
				
			||||||
@@ -48,10 +49,15 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(0, 19)  // no connection
 | 
					#define BUTTON_2              _PINNUM(0, 19)  // no connection
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Used as model string in OTA mode
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// BLE OTA
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "MakerDiary"
 | 
					#define BLEDIS_MANUFACTURER   "MakerDiary"
 | 
				
			||||||
#define BLEDIS_MODEL          "nRF52840 Micro Dev Kit USB Dongle"
 | 
					#define BLEDIS_MODEL          "nRF52840 Micro Dev Kit USB Dongle"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME   "MDK nRF52840 USB Dongle"
 | 
					#define UF2_PRODUCT_NAME   "MDK nRF52840 USB Dongle"
 | 
				
			||||||
#define UF2_VOLUME_LABEL   "MDK840DONGL"
 | 
					#define UF2_VOLUME_LABEL   "MDK840DONGL"
 | 
				
			||||||
#define UF2_BOARD_ID       "nRF52840-Dongle-v1"
 | 
					#define UF2_BOARD_ID       "nRF52840-Dongle-v1"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,16 +47,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(2, 2)
 | 
					#define BUTTON_2              _PINNUM(2, 2)
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Adafruit Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "Metro nRF52840 Express"
 | 
					#define BLEDIS_MODEL          "Metro nRF52840 Express"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,16 +43,9 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(0, 03)     // SW1
 | 
					#define BUTTON_2              _PINNUM(0, 03)     // SW1
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER         _PINNUM(0, 09)
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         _PINNUM(0, 10)
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "OSHWA"
 | 
					#define BLEDIS_MANUFACTURER   "OSHWA"
 | 
				
			||||||
#define BLEDIS_MODEL          "OHS2020 Badge"
 | 
					#define BLEDIS_MODEL          "OHS2020 Badge"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,19 +47,15 @@
 | 
				
			|||||||
#define BUTTON_FRESET  _PINNUM(0, 03) // A0
 | 
					#define BUTTON_FRESET  _PINNUM(0, 03) // A0
 | 
				
			||||||
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER  8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER  6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER 0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER 0
 | 
					 | 
				
			||||||
#define HWFC           false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Particle Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Particle Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "Argon"
 | 
					#define BLEDIS_MODEL          "Argon"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME   "Particle Argon"
 | 
					#define UF2_PRODUCT_NAME   "Particle Argon"
 | 
				
			||||||
#define UF2_VOLUME_LABEL   "ARGONBOOT  "
 | 
					#define UF2_VOLUME_LABEL   "ARGONBOOT  "
 | 
				
			||||||
#define UF2_BOARD_ID       "nRF52840-Argon-v1"
 | 
					#define UF2_BOARD_ID       "nRF52840-Argon-v1"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,19 +47,15 @@
 | 
				
			|||||||
#define BUTTON_FRESET       _PINNUM(0, 03) // A0
 | 
					#define BUTTON_FRESET       _PINNUM(0, 03) // A0
 | 
				
			||||||
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER  8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER  6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER 0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER 0
 | 
					 | 
				
			||||||
#define HWFC           false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Particle Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Particle Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "Boron"
 | 
					#define BLEDIS_MODEL          "Boron"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME   "Particle Boron"
 | 
					#define UF2_PRODUCT_NAME   "Particle Boron"
 | 
				
			||||||
#define UF2_VOLUME_LABEL   "BORONBOOT  "
 | 
					#define UF2_VOLUME_LABEL   "BORONBOOT  "
 | 
				
			||||||
#define UF2_BOARD_ID       "nRF52840-Boron-v1"
 | 
					#define UF2_BOARD_ID       "nRF52840-Boron-v1"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,19 +47,15 @@
 | 
				
			|||||||
#define BUTTON_FRESET       _PINNUM(0, 03) // A0
 | 
					#define BUTTON_FRESET       _PINNUM(0, 03) // A0
 | 
				
			||||||
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER  8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER  6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER 0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER 0
 | 
					 | 
				
			||||||
#define HWFC           false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER   "Particle Industries"
 | 
					#define BLEDIS_MANUFACTURER   "Particle Industries"
 | 
				
			||||||
#define BLEDIS_MODEL          "Xenon"
 | 
					#define BLEDIS_MODEL          "Xenon"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME   "Particle Xenon"
 | 
					#define UF2_PRODUCT_NAME   "Particle Xenon"
 | 
				
			||||||
#define UF2_VOLUME_LABEL   "XENONBOOT  "
 | 
					#define UF2_VOLUME_LABEL   "XENONBOOT  "
 | 
				
			||||||
#define UF2_BOARD_ID       "nRF52840-Xenon-v1"
 | 
					#define UF2_BOARD_ID       "nRF52840-Xenon-v1"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,19 +41,15 @@
 | 
				
			|||||||
#define BUTTON_2            12
 | 
					#define BUTTON_2            12
 | 
				
			||||||
#define BUTTON_PULL         NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL         NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER       8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER       6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER      0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER      0
 | 
					 | 
				
			||||||
#define HWFC                false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER    "Nordic"
 | 
					#define BLEDIS_MANUFACTURER    "Nordic"
 | 
				
			||||||
#define BLEDIS_MODEL           "PCA10056"
 | 
					#define BLEDIS_MODEL           "PCA10056"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME    "Nordic nRF52840 DK"
 | 
					#define UF2_PRODUCT_NAME    "Nordic nRF52840 DK"
 | 
				
			||||||
#define UF2_BOARD_ID        "nRF52840-pca10056-v1"
 | 
					#define UF2_BOARD_ID        "nRF52840-pca10056-v1"
 | 
				
			||||||
#define UF2_INDEX_URL       "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK"
 | 
					#define UF2_INDEX_URL       "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-DK"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -44,19 +44,15 @@
 | 
				
			|||||||
#define BUTTON_2       _PINNUM(1, 10)
 | 
					#define BUTTON_2       _PINNUM(1, 10)
 | 
				
			||||||
#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL    NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER  20
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER  17
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER 15
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER 13
 | 
					 | 
				
			||||||
#define HWFC           false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER  "Nordic"
 | 
					#define BLEDIS_MANUFACTURER  "Nordic"
 | 
				
			||||||
#define BLEDIS_MODEL         "PCA10059"
 | 
					#define BLEDIS_MODEL         "PCA10059"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME  "Nordic nRF52840 Dongle"
 | 
					#define UF2_PRODUCT_NAME  "Nordic nRF52840 Dongle"
 | 
				
			||||||
#define UF2_BOARD_ID      "nRF52840-pca10059-v1"
 | 
					#define UF2_BOARD_ID      "nRF52840-pca10059-v1"
 | 
				
			||||||
#define UF2_INDEX_URL     "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle"
 | 
					#define UF2_INDEX_URL     "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52840-Dongle"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -41,19 +41,15 @@
 | 
				
			|||||||
#define BUTTON_2            12
 | 
					#define BUTTON_2            12
 | 
				
			||||||
#define BUTTON_PULL         NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL         NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					// BLE OTA
 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define RX_PIN_NUMBER       8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER       6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER      0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER      0
 | 
					 | 
				
			||||||
#define HWFC                false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
// Used as model string in OTA mode
 | 
					 | 
				
			||||||
#define BLEDIS_MANUFACTURER    "Nordic"
 | 
					#define BLEDIS_MANUFACTURER    "Nordic"
 | 
				
			||||||
#define BLEDIS_MODEL           "PCA10100"
 | 
					#define BLEDIS_MODEL           "PCA10100"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 | 
					// USB
 | 
				
			||||||
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
#define UF2_PRODUCT_NAME    "Nordic nRF52833 DK"
 | 
					#define UF2_PRODUCT_NAME    "Nordic nRF52833 DK"
 | 
				
			||||||
#define UF2_BOARD_ID        "nRF52833-pca10100-v1"
 | 
					#define UF2_BOARD_ID        "nRF52833-pca10100-v1"
 | 
				
			||||||
#define UF2_INDEX_URL       "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK"
 | 
					#define UF2_INDEX_URL       "https://www.nordicsemi.com/Software-and-Tools/Development-Kits/nRF52833-DK"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -43,15 +43,6 @@
 | 
				
			|||||||
#define BUTTON_2                _PINNUM(0, 10)
 | 
					#define BUTTON_2                _PINNUM(0, 10)
 | 
				
			||||||
#define BUTTON_PULL             NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL             NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
/* UART (only used by nRF52832) (only used by nRF52832)
 | 
					 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
#define RX_PIN_NUMBER           8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER           6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER          0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER          0
 | 
					 | 
				
			||||||
#define HWFC                    false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
// BLE OTA
 | 
					// BLE OTA
 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,15 +50,6 @@
 | 
				
			|||||||
#define BUTTON_2              _PINNUM(0, 29)
 | 
					#define BUTTON_2              _PINNUM(0, 29)
 | 
				
			||||||
#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
					#define BUTTON_PULL           NRF_GPIO_PIN_PULLUP
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/*------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
/* UART (only used by nRF52832)
 | 
					 | 
				
			||||||
 *------------------------------------------------------------------*/
 | 
					 | 
				
			||||||
#define RX_PIN_NUMBER         8
 | 
					 | 
				
			||||||
#define TX_PIN_NUMBER         6
 | 
					 | 
				
			||||||
#define CTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define RTS_PIN_NUMBER        0
 | 
					 | 
				
			||||||
#define HWFC                  false
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
// BLE OTA
 | 
					// BLE OTA
 | 
				
			||||||
//--------------------------------------------------------------------+
 | 
					//--------------------------------------------------------------------+
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,11 +6,19 @@
 | 
				
			|||||||
#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY  7
 | 
					#define NRFX_POWER_DEFAULT_CONFIG_IRQ_PRIORITY  7
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NRFX_CLOCK_ENABLED  0
 | 
					#define NRFX_CLOCK_ENABLED  0
 | 
				
			||||||
 | 
					 | 
				
			||||||
#define NRFX_NVMC_ENABLED   1
 | 
					#define NRFX_NVMC_ENABLED   1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NRFX_PRS_ENABLED    0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NRFX_PWM_ENABLED    0
 | 
				
			||||||
 | 
					#define NRFX_PWM0_ENABLED   0
 | 
				
			||||||
 | 
					#define NRFX_PWM1_ENABLED   0
 | 
				
			||||||
 | 
					#define NRFX_PWM2_ENABLED   0
 | 
				
			||||||
 | 
					#define NRFX_PWM3_ENABLED   0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// UART
 | 
					// UART
 | 
				
			||||||
#ifdef NRF52832_XXAA
 | 
					#ifdef NRF52832_XXAA
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define NRFX_UART_ENABLED   1
 | 
					#define NRFX_UART_ENABLED   1
 | 
				
			||||||
#define NRFX_UART0_ENABLED  1
 | 
					#define NRFX_UART0_ENABLED  1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,10 +78,12 @@
 | 
				
			|||||||
#define UART_DEFAULT_CONFIG_IRQ_PRIORITY   7
 | 
					#define UART_DEFAULT_CONFIG_IRQ_PRIORITY   7
 | 
				
			||||||
#define UART_EASY_DMA_SUPPORT              1
 | 
					#define UART_EASY_DMA_SUPPORT              1
 | 
				
			||||||
#define UART_LEGACY_SUPPORT                1
 | 
					#define UART_LEGACY_SUPPORT                1
 | 
				
			||||||
 | 
					#define UART_CONFIG_LOG_ENABLED            0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define UART0_ENABLED                      1
 | 
					#define UART0_ENABLED                      1
 | 
				
			||||||
#define UART0_CONFIG_USE_EASY_DMA          0
 | 
					#define UART0_CONFIG_USE_EASY_DMA          0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//==========================================================
 | 
					//==========================================================
 | 
				
			||||||
// <e> APP_UART_ENABLED - app_uart - UART driver
 | 
					// <e> APP_UART_ENABLED - app_uart - UART driver
 | 
				
			||||||
//==========================================================
 | 
					//==========================================================
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,398 +0,0 @@
 | 
				
			|||||||
<!DOCTYPE CrossStudio_Project_File>
 | 
					 | 
				
			||||||
<solution Name="Adafruit_nRF52_Bootloader" target="8" version="2">
 | 
					 | 
				
			||||||
  <project Name="Adafruit_nRF52_Bootloader">
 | 
					 | 
				
			||||||
    <configuration
 | 
					 | 
				
			||||||
      Name="Common"
 | 
					 | 
				
			||||||
      Placement="Flash"
 | 
					 | 
				
			||||||
      Target="nRF52840_xxAA"
 | 
					 | 
				
			||||||
      arm_architecture="v7EM"
 | 
					 | 
				
			||||||
      arm_core_type="Cortex-M4"
 | 
					 | 
				
			||||||
      arm_endian="Little"
 | 
					 | 
				
			||||||
      arm_fp_abi="Hard"
 | 
					 | 
				
			||||||
      arm_fpu_type="FPv4-SP-D16"
 | 
					 | 
				
			||||||
      arm_interwork="No"
 | 
					 | 
				
			||||||
      arm_linker_heap_size="1024"
 | 
					 | 
				
			||||||
      arm_linker_process_stack_size="0"
 | 
					 | 
				
			||||||
      arm_linker_stack_size="1024"
 | 
					 | 
				
			||||||
      arm_simulator_memory_simulation_parameter="ROM;0x00000000;0x00100000;RAM;0x20000000;0x00040000"
 | 
					 | 
				
			||||||
      arm_target_debug_interface_type="ADIv5"
 | 
					 | 
				
			||||||
      arm_target_device_name="nRF52840_xxAA"
 | 
					 | 
				
			||||||
      arm_target_interface_type="SWD"
 | 
					 | 
				
			||||||
      build_treat_warnings_as_errors="Yes"
 | 
					 | 
				
			||||||
      c_preprocessor_definitions="__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;NO_VTOR_CONFIG;MK_BOOTLOADER_VERSION=0x00020A;CONFIG_GPIO_AS_PINRESET;CONFIG_NFCT_PINS_AS_GPIOS;BLE_STACK_SUPPORT_REQD;SWI_DISABLE0;SOFTDEVICE_PRESENT;FLOAT_ABI_HARD;CFG_TUSB_DEBUG=2;UF2_VERSION="Segger";BLEDIS_FW_VERSION="Segger""
 | 
					 | 
				
			||||||
      c_user_include_directories="../;../usb;../boards;../cmsis/include;$(tusbDir);$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include;$(sdDir)/include;$(sdDir)/include/nrf52;$(sdk11Dir)/drivers_nrf/pstorage;$(sdk11Dir)/ble/common/;$(sdk11Dir)/ble/ble_services/ble_dfu;$(sdk11Dir)/ble/ble_services/ble_dis;$(sdk11Dir)/libraries/bootloader_dfu;$(sdk11Dir)/libraries/bootloader_dfu/hci_transport;$(sdk11Dir)/libraries/util;$(sdkDir)/toolchain/cmsis/include;$(sdkDir)/device;$(sdkDir)/toolchain;$(sdkDir)/drivers_nrf/hal;$(sdkDir)/drivers_nrf/systick;$(sdkDir)/drivers_nrf/uart;$(sdkDir)/drivers_nrf/usbd;$(sdkDir)/drivers_nrf/common;$(sdkDir)/drivers_nrf/delay;$(sdkDir)/drivers_nrf/power;$(sdkDir)/drivers_nrf/clock;$(sdkDir)/libraries/util;$(sdkDir)/libraries/timer;$(sdkDir)/libraries/scheduler;$(sdkDir)/libraries/crc16;$(sdkDir)/libraries/util;$(sdkDir)/libraries/hci/config;$(sdkDir)/libraries/uart;$(sdkDir)/libraries/hci;$(sdkDir)/external/fprintf;$(sdkDir)/libraries/strerror;$(sdkDir)/libraries/atomic;$(sdkDir)/libraries/balloc;$(sdkDir)/libraries/experimental_log/src;$(sdkDir)/libraries/experimental_log;$(sdkDir)/libraries/experimental_section_vars;$(sdkDir)/libraries/experimental_memobj"
 | 
					 | 
				
			||||||
      debug_register_definition_file="$(ProjectDir)/nrf52840_Registers.xml"
 | 
					 | 
				
			||||||
      debug_target_connection="J-Link"
 | 
					 | 
				
			||||||
      gcc_enable_all_warnings="No"
 | 
					 | 
				
			||||||
      gcc_entry_point="Reset_Handler"
 | 
					 | 
				
			||||||
      linker_memory_map_file="$(ProjectDir)/nRF52840_xxAA_MemoryMap.xml"
 | 
					 | 
				
			||||||
      linker_section_placement_file="$(ProjectDir)/flash_placement.xml"
 | 
					 | 
				
			||||||
      macros="DeviceHeaderFile=$(PackagesDir)/nRF/CMSIS/Device/Include/nrf.h;DeviceLibraryIdentifier=M4lf;DeviceSystemFile=$(PackagesDir)/nRF/CMSIS/Device/Source/system_nrf52840.c;DeviceVectorsFile=$(PackagesDir)/nRF/Source/ses_nrf52840_Vectors.s;DeviceFamily=nRF;Target=nRF52840_xxAA;Placement=Flash;sdkDir=../../lib/sdk/components;sdk11Dir=../../lib/sdk11/components;sdDir=../../lib/softdevice/s140_nrf52_6.1.1/s140_nrf52_6.1.1_API;tusbDir=../../lib/tinyusb/src;nrfxDir=../../lib/nrfx"
 | 
					 | 
				
			||||||
      project_directory=""
 | 
					 | 
				
			||||||
      project_type="Executable"
 | 
					 | 
				
			||||||
      target_reset_script="Reset();"
 | 
					 | 
				
			||||||
      target_script_file="$(ProjectDir)/nRF_Target.js"
 | 
					 | 
				
			||||||
      target_trace_initialize_script="EnableTrace("$(TraceInterfaceType)")" />
 | 
					 | 
				
			||||||
    <folder Name="RTT Files">
 | 
					 | 
				
			||||||
      <file file_name="SEGGER_RTT.c" />
 | 
					 | 
				
			||||||
      <file file_name="SEGGER_RTT.h" />
 | 
					 | 
				
			||||||
      <file file_name="SEGGER_RTT_Conf.h" />
 | 
					 | 
				
			||||||
      <file file_name="SEGGER_RTT_SES.c" />
 | 
					 | 
				
			||||||
    </folder>
 | 
					 | 
				
			||||||
    <folder Name="Script Files">
 | 
					 | 
				
			||||||
      <file file_name="nRF_Target.js">
 | 
					 | 
				
			||||||
        <configuration Name="Common" file_type="Reset Script" />
 | 
					 | 
				
			||||||
      </file>
 | 
					 | 
				
			||||||
    </folder>
 | 
					 | 
				
			||||||
    <folder Name="System Files">
 | 
					 | 
				
			||||||
      <file file_name="thumb_crt0.s" />
 | 
					 | 
				
			||||||
      <file file_name="flash_placement.xml" />
 | 
					 | 
				
			||||||
      <file file_name="nRF52840_xxAA_MemoryMap.xml" />
 | 
					 | 
				
			||||||
      <file file_name="nRF52832_xxAA_MemoryMap.xml" />
 | 
					 | 
				
			||||||
    </folder>
 | 
					 | 
				
			||||||
    <folder Name="src">
 | 
					 | 
				
			||||||
      <file file_name="../boards.h" />
 | 
					 | 
				
			||||||
      <file file_name="../dfu_ble_svc.c" />
 | 
					 | 
				
			||||||
      <file file_name="../main.c" />
 | 
					 | 
				
			||||||
      <file file_name="../metro52.h" />
 | 
					 | 
				
			||||||
      <file file_name="../pstorage_platform.h" />
 | 
					 | 
				
			||||||
      <file file_name="../sdk_config.h" />
 | 
					 | 
				
			||||||
      <folder Name="usb">
 | 
					 | 
				
			||||||
        <file file_name="../usb/tusb_config.h" />
 | 
					 | 
				
			||||||
        <folder Name="uf2">
 | 
					 | 
				
			||||||
          <file file_name="../usb/uf2/uf2cfg.h" />
 | 
					 | 
				
			||||||
          <file file_name="../usb/uf2/uf2.h" />
 | 
					 | 
				
			||||||
          <file file_name="../usb/uf2/ghostfat.c" />
 | 
					 | 
				
			||||||
          <file file_name="../usb/uf2/macros.h" />
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
        <file file_name="../usb/msc_uf2.c" />
 | 
					 | 
				
			||||||
        <file file_name="../usb/usb.c" />
 | 
					 | 
				
			||||||
        <file file_name="../usb/usb_desc.c" />
 | 
					 | 
				
			||||||
        <file file_name="../usb/usb_desc.h" />
 | 
					 | 
				
			||||||
        <configuration Name="Feather52832" build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
      </folder>
 | 
					 | 
				
			||||||
      <folder Name="cmsis">
 | 
					 | 
				
			||||||
        <folder Name="include">
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/arm_common_tables.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/arm_const_structs.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/arm_math.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/cmsis_armcc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/cmsis_armcc_V6.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/cmsis_gcc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cm0.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cm0plus.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cm3.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cm4.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cm7.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cmFunc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cmInstr.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_cmSimd.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_sc000.h" />
 | 
					 | 
				
			||||||
          <file file_name="../cmsis/include/core_sc300.h" />
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
      </folder>
 | 
					 | 
				
			||||||
      <folder Name="boards">
 | 
					 | 
				
			||||||
        <file file_name="../boards/pca10056.h" />
 | 
					 | 
				
			||||||
        <file file_name="../boards/feather_nrf52832.h" />
 | 
					 | 
				
			||||||
        <file file_name="../boards/feather_nrf52840_express.h" />
 | 
					 | 
				
			||||||
        <file file_name="../boards/pca10059.h" />
 | 
					 | 
				
			||||||
      </folder>
 | 
					 | 
				
			||||||
      <file file_name="../dfu_init.c" />
 | 
					 | 
				
			||||||
      <file file_name="../boards.c" />
 | 
					 | 
				
			||||||
      <file file_name="../flash_nrf5x.h" />
 | 
					 | 
				
			||||||
      <file file_name="../flash_nrf5x.c" />
 | 
					 | 
				
			||||||
    </folder>
 | 
					 | 
				
			||||||
    <configuration Name="Debug Single" gcc_optimization_level="Debug" />
 | 
					 | 
				
			||||||
    <configuration
 | 
					 | 
				
			||||||
      Name="Release Single"
 | 
					 | 
				
			||||||
      gcc_optimization_level="Optimize For Size" />
 | 
					 | 
				
			||||||
    <folder Name="lib">
 | 
					 | 
				
			||||||
      <folder
 | 
					 | 
				
			||||||
        Name="sdk"
 | 
					 | 
				
			||||||
        exclude=""
 | 
					 | 
				
			||||||
        filter="*.h;*.c"
 | 
					 | 
				
			||||||
        path="../../lib/sdk"
 | 
					 | 
				
			||||||
        recurse="Yes" />
 | 
					 | 
				
			||||||
      <folder Name="sdk11">
 | 
					 | 
				
			||||||
        <folder Name="components">
 | 
					 | 
				
			||||||
          <folder Name="ble">
 | 
					 | 
				
			||||||
            <folder Name="ble_services">
 | 
					 | 
				
			||||||
              <folder Name="ble_dfu">
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/ble/ble_services/ble_dfu/ble_dfu.c" />
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/ble/ble_services/ble_dfu/ble_dfu.h" />
 | 
					 | 
				
			||||||
              </folder>
 | 
					 | 
				
			||||||
              <folder Name="ble_dis">
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/ble/ble_services/ble_dis/ble_dis.c" />
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/ble/ble_services/ble_dis/ble_dis.h" />
 | 
					 | 
				
			||||||
              </folder>
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
            <folder Name="common">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/ble/common/ble_srv_common.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="drivers_nrf">
 | 
					 | 
				
			||||||
            <folder Name="pstorage">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/drivers_nrf/pstorage/pstorage.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/drivers_nrf/pstorage/pstorage_raw.c" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="libraries">
 | 
					 | 
				
			||||||
            <folder Name="bootloader_dfu">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader_settings.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader_types.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader_util.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/bootloader_util.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_bank_internal.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_ble_svc.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_ble_svc_internal.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_init.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_transport.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_ble.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_transport_serial.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_types.h" />
 | 
					 | 
				
			||||||
              <folder Name="ble_transport">
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/ble_transport/hci_mem_pool_internal.h" />
 | 
					 | 
				
			||||||
              </folder>
 | 
					 | 
				
			||||||
              <folder Name="hci_transport">
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/hci_transport/hci_mem_pool_internal.h" />
 | 
					 | 
				
			||||||
                <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/hci_transport/hci_transport_config.h" />
 | 
					 | 
				
			||||||
              </folder>
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
            <folder Name="util">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/sdk11/components/libraries/util/nrf_log.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
      </folder>
 | 
					 | 
				
			||||||
      <folder Name="tinyusb">
 | 
					 | 
				
			||||||
        <folder Name="src">
 | 
					 | 
				
			||||||
          <file file_name="../../lib/tinyusb/src/tusb.c" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/tinyusb/src/tusb.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/tinyusb/src/tusb_hal.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/tinyusb/src/tusb_option.h" />
 | 
					 | 
				
			||||||
          <folder Name="class">
 | 
					 | 
				
			||||||
            <folder Name="cdc">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/cdc/cdc.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/cdc/cdc_device.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/cdc/cdc_device.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
            <folder Name="hid">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/hid/hid.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/hid/hid_device.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/hid/hid_device.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
            <folder Name="msc">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/msc/msc.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/msc/msc_device.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/msc/msc_device.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
            <folder Name="custom">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/custom/custom_device.c" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/class/custom/custom_device.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="common">
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/binary.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/timeout_timer.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_common.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_compiler.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_error.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_fifo.c" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_fifo.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_types.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/common/tusb_verify.h" />
 | 
					 | 
				
			||||||
            <folder Name="compiler">
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/common/compiler/tusb_compiler_gcc.h" />
 | 
					 | 
				
			||||||
              <file file_name="../../lib/tinyusb/src/common/compiler/tusb_compiler_iar.h" />
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="device">
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/device/dcd.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/device/usbd.c" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/device/usbd.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/device/usbd_pvt.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/device/usbd_control.c" />
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="osal">
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/osal/osal.c" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/osal/osal.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/osal/osal_freeRTOS.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/tinyusb/src/osal/osal_none.h" />
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="portable">
 | 
					 | 
				
			||||||
            <folder Name="nordic">
 | 
					 | 
				
			||||||
              <folder Name="nrf5x">
 | 
					 | 
				
			||||||
                <file file_name="../../lib/tinyusb/src/portable/nordic/nrf5x/dcd_nrf5x.c" />
 | 
					 | 
				
			||||||
                <file file_name="../../lib/tinyusb/src/portable/nordic/nrf5x/hal_nrf5x.c" />
 | 
					 | 
				
			||||||
              </folder>
 | 
					 | 
				
			||||||
            </folder>
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
        <configuration Name="Feather52832" build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
      </folder>
 | 
					 | 
				
			||||||
      <folder Name="nrfx">
 | 
					 | 
				
			||||||
        <file file_name="../../lib/nrfx/nrfx.h" />
 | 
					 | 
				
			||||||
        <folder Name="drivers">
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/drivers/nrfx_common.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/drivers/nrfx_errors.h" />
 | 
					 | 
				
			||||||
          <folder Name="include">
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrf_bitmask.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_adc.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_clock.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_comp.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_gpiote.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_i2s.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_lpcomp.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_pdm.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_power.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_power_clock.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_ppi.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_pwm.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_qdec.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_qspi.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_rng.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_rtc.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_saadc.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_spi.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_spim.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_spis.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_swi.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_systick.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_timer.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_twi.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_twim.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_twis.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_uart.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_uarte.h" />
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/include/nrfx_wdt.h" />
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
          <folder Name="src">
 | 
					 | 
				
			||||||
            <file file_name="../../lib/nrfx/drivers/src/nrfx_power.c" />
 | 
					 | 
				
			||||||
          </folder>
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
        <folder Name="hal">
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_adc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_ccm.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_clock.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_comp.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_ecb.c" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_ecb.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_egu.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_gpio.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_gpiote.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_i2s.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_lpcomp.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_nvmc.c" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_nvmc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_pdm.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_power.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_ppi.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_pwm.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_qdec.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_qspi.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_radio.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_rng.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_rtc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_saadc.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_spi.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_spim.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_spis.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_systick.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_temp.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_timer.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_twi.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_twim.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_twis.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_uart.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_uarte.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_usbd.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/hal/nrf_wdt.h" />
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
        <folder Name="mdk">
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/compiler_abstraction.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf52.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf52832_peripherals.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf52840.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf52840_bitfields.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf52840_peripherals.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf52_bitfields.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/nrf_peripherals.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/ses_startup_nrf52.s">
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52840 Size++"
 | 
					 | 
				
			||||||
              build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52840"
 | 
					 | 
				
			||||||
              build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
            <configuration Name="PCA10056" build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
          </file>
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/ses_startup_nrf52840.s">
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52840 Size++"
 | 
					 | 
				
			||||||
              build_exclude_from_build="No" />
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52832"
 | 
					 | 
				
			||||||
              build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
          </file>
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/ses_startup_nrf_common.s">
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52840 Size++"
 | 
					 | 
				
			||||||
              build_exclude_from_build="No" />
 | 
					 | 
				
			||||||
          </file>
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/startup_config.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/system_nrf52.c">
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52840 Size++"
 | 
					 | 
				
			||||||
              build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52840"
 | 
					 | 
				
			||||||
              build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
            <configuration Name="PCA10056" build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
          </file>
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/system_nrf52.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/system_nrf52840.c">
 | 
					 | 
				
			||||||
            <configuration
 | 
					 | 
				
			||||||
              Name="Feather52832"
 | 
					 | 
				
			||||||
              build_exclude_from_build="Yes" />
 | 
					 | 
				
			||||||
          </file>
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/mdk/system_nrf52840.h" />
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
        <folder Name="soc">
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/soc/nrfx_coredep.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/soc/nrfx_irqs.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/soc/nrfx_irqs_nrf51.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/soc/nrfx_irqs_nrf52810.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/soc/nrfx_irqs_nrf52832.h" />
 | 
					 | 
				
			||||||
          <file file_name="../../lib/nrfx/soc/nrfx_irqs_nrf52840.h" />
 | 
					 | 
				
			||||||
        </folder>
 | 
					 | 
				
			||||||
      </folder>
 | 
					 | 
				
			||||||
    </folder>
 | 
					 | 
				
			||||||
    <configuration
 | 
					 | 
				
			||||||
      Name="Feather52840"
 | 
					 | 
				
			||||||
      c_preprocessor_definitions="NRF52840_XXAA;S140"
 | 
					 | 
				
			||||||
      c_user_include_directories=".;../boards/feather_nrf52840_express"
 | 
					 | 
				
			||||||
      gcc_optimization_level="Debug"
 | 
					 | 
				
			||||||
      linker_memory_map_file="nRF52840_xxAA_MemoryMap.xml" />
 | 
					 | 
				
			||||||
    <configuration
 | 
					 | 
				
			||||||
      Name="Feather52832"
 | 
					 | 
				
			||||||
      c_preprocessor_definitions="NRF52832_XXAA;S132"
 | 
					 | 
				
			||||||
      c_user_include_directories=".;../boards/feather_nrf52832"
 | 
					 | 
				
			||||||
      gcc_optimization_level="Debug"
 | 
					 | 
				
			||||||
      linker_memory_map_file="nRF52832_xxAA_MemoryMap.xml" />
 | 
					 | 
				
			||||||
    <configuration
 | 
					 | 
				
			||||||
      Name="PCA10056"
 | 
					 | 
				
			||||||
      c_preprocessor_definitions="NRF52840_XXAA;S140"
 | 
					 | 
				
			||||||
      c_user_include_directories=".;../boards/pca10056"
 | 
					 | 
				
			||||||
      gcc_optimization_level="Debug"
 | 
					 | 
				
			||||||
      linker_memory_map_file="nRF52840_xxAA_MemoryMap.xml" />
 | 
					 | 
				
			||||||
  </project>
 | 
					 | 
				
			||||||
  <configuration Name="Feather52840" />
 | 
					 | 
				
			||||||
  <configuration Name="Feather52832" />
 | 
					 | 
				
			||||||
  <configuration Name="PCA10056" />
 | 
					 | 
				
			||||||
</solution>
 | 
					 | 
				
			||||||
@@ -50,22 +50,22 @@ SOFTWARE.
 | 
				
			|||||||
:                                                  12u  /*Dec*/ )
 | 
					:                                                  12u  /*Dec*/ )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define __DAY_INT__ ( \
 | 
					#define __DAY_INT__ ( \
 | 
				
			||||||
   (__DATE__ [4u] == ' ' ? 0u : __DATE__ [4u] - '0') * 10u \
 | 
					   (__DATE__ [4u] == ' ' ? 0 : __DATE__ [4u] - '0') * 10u \
 | 
				
			||||||
 + (__DATE__ [5u] - '0')                                   )
 | 
					 + (__DATE__ [5u] - '0')                                   )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// __TIME__ expands to an eight-character string constant
 | 
					// __TIME__ expands to an eight-character string constant
 | 
				
			||||||
// "23:59:01", or (if cannot determine time) "??:??:??" 
 | 
					// "23:59:01", or (if cannot determine time) "??:??:??" 
 | 
				
			||||||
#define __HOUR_INT__ ( \
 | 
					#define __HOUR_INT__ ( \
 | 
				
			||||||
   (__TIME__ [0u] == '?' ? 0u : __TIME__ [0u] - '0') * 10u \
 | 
					   (__TIME__ [0u] == '?' ? 0 : __TIME__ [0u] - '0') * 10u \
 | 
				
			||||||
 + (__TIME__ [1u] == '?' ? 0u : __TIME__ [1u] - '0')       )
 | 
					 + (__TIME__ [1u] == '?' ? 0 : __TIME__ [1u] - '0')       )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define __MINUTE_INT__ ( \
 | 
					#define __MINUTE_INT__ ( \
 | 
				
			||||||
   (__TIME__ [3u] == '?' ? 0u : __TIME__ [3u] - '0') * 10u \
 | 
					   (__TIME__ [3u] == '?' ? 0 : __TIME__ [3u] - '0') * 10u \
 | 
				
			||||||
 + (__TIME__ [4u] == '?' ? 0u : __TIME__ [4u] - '0')       )
 | 
					 + (__TIME__ [4u] == '?' ? 0 : __TIME__ [4u] - '0')       )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define __SECONDS_INT__ ( \
 | 
					#define __SECONDS_INT__ ( \
 | 
				
			||||||
   (__TIME__ [6u] == '?' ? 0u : __TIME__ [6u] - '0') * 10u \
 | 
					   (__TIME__ [6u] == '?' ? 0 : __TIME__ [6u] - '0') * 10u \
 | 
				
			||||||
 + (__TIME__ [7u] == '?' ? 0u : __TIME__ [7u] - '0')       )
 | 
					 + (__TIME__ [7u] == '?' ? 0 : __TIME__ [7u] - '0')       )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define __DOSDATE__ ( \
 | 
					#define __DOSDATE__ ( \
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -172,6 +172,7 @@ static uint32_t current_flash_size(void)
 | 
				
			|||||||
        result = FLASH_SIZE;
 | 
					        result = FLASH_SIZE;
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    flash_sz = result; // presumes atomic 32-bit read/write and static result
 | 
					    flash_sz = result; // presumes atomic 32-bit read/write and static result
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -180,7 +181,8 @@ static uint32_t current_flash_size(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void padded_memcpy (char *dst, char const *src, int len)
 | 
					void padded_memcpy (char *dst, char const *src, int len)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    for (int i = 0; i < len; ++i) {
 | 
					  for ( int i = 0; i < len; ++i )
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
    if ( *src )
 | 
					    if ( *src )
 | 
				
			||||||
      *dst = *src++;
 | 
					      *dst = *src++;
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
@@ -212,11 +214,11 @@ void read_block(uint32_t block_no, uint8_t *data) {
 | 
				
			|||||||
            // WARNING -- code presumes only one NULL .content for .UF2 file
 | 
					            // WARNING -- code presumes only one NULL .content for .UF2 file
 | 
				
			||||||
            //            and all non-NULL .content fit in one sector
 | 
					            //            and all non-NULL .content fit in one sector
 | 
				
			||||||
            //            and requires it be the last element of the array
 | 
					            //            and requires it be the last element of the array
 | 
				
			||||||
            for (int i = 1; i < NUM_FILES * 2 + 4; ++i) {
 | 
					            for (uint32_t i = 1; i < NUM_FILES * 2 + 4; ++i) {
 | 
				
			||||||
                data[i] = 0xff;
 | 
					                data[i] = 0xff;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        for (int i = 0; i < 256; ++i) { // Generate the FAT chain for the firmware "file"
 | 
					        for (uint32_t i = 0; i < 256; ++i) { // Generate the FAT chain for the firmware "file"
 | 
				
			||||||
            uint32_t v = sectionIdx * 256 + i;
 | 
					            uint32_t v = sectionIdx * 256 + i;
 | 
				
			||||||
            if (UF2_FIRST_SECTOR <= v && v <= UF2_LAST_SECTOR)
 | 
					            if (UF2_FIRST_SECTOR <= v && v <= UF2_LAST_SECTOR)
 | 
				
			||||||
                ((uint16_t *)(void *)data)[i] = v == UF2_LAST_SECTOR ? 0xffff : v + 1;
 | 
					                ((uint16_t *)(void *)data)[i] = v == UF2_LAST_SECTOR ? 0xffff : v + 1;
 | 
				
			||||||
@@ -235,7 +237,7 @@ void read_block(uint32_t block_no, uint8_t *data) {
 | 
				
			|||||||
            remainingEntries--;
 | 
					            remainingEntries--;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (int i = DIRENTRIES_PER_SECTOR * sectionIdx;
 | 
					        for (uint32_t i = DIRENTRIES_PER_SECTOR * sectionIdx;
 | 
				
			||||||
             remainingEntries > 0 && i < NUM_FILES;
 | 
					             remainingEntries > 0 && i < NUM_FILES;
 | 
				
			||||||
             i++, d++) {
 | 
					             i++, d++) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -309,10 +311,7 @@ int write_block(uint32_t block_no, uint8_t *data, bool quiet, WriteState *state)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    if ((bl->flags & UF2_FLAG_NOFLASH) || bl->payloadSize > 256 || (bl->targetAddr & 0xff) ||
 | 
					    if ((bl->flags & UF2_FLAG_NOFLASH) || bl->payloadSize > 256 || (bl->targetAddr & 0xff) ||
 | 
				
			||||||
        bl->targetAddr < USER_FLASH_START || bl->targetAddr + bl->payloadSize > USER_FLASH_END) {
 | 
					        bl->targetAddr < USER_FLASH_START || bl->targetAddr + bl->payloadSize > USER_FLASH_END) {
 | 
				
			||||||
#if USE_DBG_MSC
 | 
					
 | 
				
			||||||
        if (!quiet)
 | 
					 | 
				
			||||||
            logval("invalid target addr", bl->targetAddr);
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
        NRF_LOG_WARNING("Skip block at %x", bl->targetAddr);
 | 
					        NRF_LOG_WARNING("Skip block at %x", bl->targetAddr);
 | 
				
			||||||
        // this happens when we're trying to re-flash CURRENT.UF2 file previously
 | 
					        // this happens when we're trying to re-flash CURRENT.UF2 file previously
 | 
				
			||||||
        // copied from a device; we still want to count these blocks to reset properly
 | 
					        // copied from a device; we still want to count these blocks to reset properly
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -150,8 +150,10 @@ static uint16_t _desc_str[64+1];
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Invoked when received GET STRING DESCRIPTOR request
 | 
					// Invoked when received GET STRING DESCRIPTOR request
 | 
				
			||||||
// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
 | 
					// Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
 | 
				
			||||||
uint16_t const* tud_descriptor_string_cb(uint8_t index)
 | 
					uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					  (void) langid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  uint8_t chr_count;
 | 
					  uint8_t chr_count;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if ( index == 0)
 | 
					  if ( index == 0)
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,33 +1,32 @@
 | 
				
			|||||||
import os
 | 
					import os
 | 
				
			||||||
import shutil
 | 
					import shutil
 | 
				
			||||||
 | 
					import glob
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
subprocess.run("rm -rf _build*", shell=True)
 | 
					subprocess.run("rm -rf _build/", shell=True)
 | 
				
			||||||
subprocess.run("rm -rf bin/*", shell=True)
 | 
					subprocess.run("rm -rf bin/", shell=True)
 | 
				
			||||||
 | 
					 | 
				
			||||||
travis = False
 | 
					 | 
				
			||||||
if "TRAVIS" in os.environ and os.environ["TRAVIS"] == "true":
 | 
					 | 
				
			||||||
    travis = True
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
success_count = 0
 | 
					success_count = 0
 | 
				
			||||||
fail_count = 0
 | 
					fail_count = 0
 | 
				
			||||||
exit_status = 0
 | 
					exit_status = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
build_format = '| {:30} | {:9} '
 | 
					build_format = '| {:32} | {:9} | {:5} | {:6} | {:6} |'
 | 
				
			||||||
build_separator = '-' * 54
 | 
					build_separator = '-' * 74
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# All supported boards
 | 
				
			||||||
all_boards = []
 | 
					all_boards = []
 | 
				
			||||||
for entry in os.scandir("src/boards"):
 | 
					for entry in os.scandir("src/boards"):
 | 
				
			||||||
    all_boards.append(entry.name)
 | 
					    all_boards.append(entry.name)
 | 
				
			||||||
 | 
					all_boards.sort()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#sha, version = build_info.get_version_info()
 | 
					#sha, version = build_info.get_version_info()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
total_time = time.monotonic()
 | 
					total_time = time.monotonic()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
print(build_separator)
 | 
					print(build_separator)
 | 
				
			||||||
print((build_format + '| {:5} |').format('Board', 'Result', 'Time'))
 | 
					print(build_format.format('Board', 'Result', 'Time', 'Flash', 'SRAM'))
 | 
				
			||||||
print(build_separator)
 | 
					print(build_separator)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for board in all_boards:
 | 
					for board in all_boards:
 | 
				
			||||||
@@ -35,31 +34,35 @@ for board in all_boards:
 | 
				
			|||||||
    os.makedirs(bin_directory, exist_ok=True)
 | 
					    os.makedirs(bin_directory, exist_ok=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    start_time = time.monotonic()
 | 
					    start_time = time.monotonic()
 | 
				
			||||||
    make_result = subprocess.run("make -j 4 BOARD={} combinehex genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 | 
					    make_result = subprocess.run("make -j 4 BOARD={} all genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
 | 
				
			||||||
    build_duration = time.monotonic() - start_time
 | 
					    build_duration = time.monotonic() - start_time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    flash_size = "-"
 | 
				
			||||||
 | 
					    sram_size = "-"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if make_result.returncode == 0:
 | 
					    if make_result.returncode == 0:
 | 
				
			||||||
        success = "\033[32msucceeded\033[0m"
 | 
					        success = "\033[32msucceeded\033[0m"
 | 
				
			||||||
        success_count += 1
 | 
					        success_count += 1
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        out_file = glob.glob('_build/build-{}/*.out'.format(board))[0]
 | 
				
			||||||
 | 
					        size_output = subprocess.run('size {}'.format(out_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
 | 
				
			||||||
 | 
					        size_list = size_output.split('\n')[1].split('\t')
 | 
				
			||||||
 | 
					        flash_size = int(size_list[0])
 | 
				
			||||||
 | 
					        sram_size = int(size_list[1]) + int(size_list[2])
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        exit_status = make_result.returncode
 | 
					        exit_status = make_result.returncode
 | 
				
			||||||
        success = "\033[31mfailed\033[0m   "
 | 
					        success = "\033[31mfailed\033[0m   "
 | 
				
			||||||
        fail_count += 1
 | 
					        fail_count += 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for entry in os.scandir("_build-{}".format(board)):
 | 
					    for entry in os.scandir("_build/build-{}".format(board)):
 | 
				
			||||||
        for extension in ["zip", "hex"]:
 | 
					        for extension in ["zip", "hex"]:
 | 
				
			||||||
            if entry.name.endswith(extension) and "nosd" not in entry.name:
 | 
					            if entry.name.endswith(extension) and "nosd" not in entry.name:
 | 
				
			||||||
                shutil.copy(entry.path, bin_directory)
 | 
					                shutil.copy(entry.path, bin_directory)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if travis:
 | 
					    print(build_format.format(board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
 | 
				
			||||||
        print('travis_fold:start:build-{}\\r'.format(board))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    print((build_format + '| {:.2f}s |').format(board, success, build_duration))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if make_result.returncode != 0:
 | 
					    if make_result.returncode != 0:
 | 
				
			||||||
        print(make_result.stdout.decode("utf-8"))
 | 
					        print(make_result.stdout.decode("utf-8"))
 | 
				
			||||||
    if travis:
 | 
					 | 
				
			||||||
        print('travis_fold:end:build-{}\\r'.format(board))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Build Summary
 | 
					# Build Summary
 | 
				
			||||||
total_time = time.monotonic() - total_time
 | 
					total_time = time.monotonic() - total_time
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,21 +4,20 @@ import os
 | 
				
			|||||||
import os.path
 | 
					import os.path
 | 
				
			||||||
import sys
 | 
					import sys
 | 
				
			||||||
import uritemplate
 | 
					import uritemplate
 | 
				
			||||||
 | 
					import glob
 | 
				
			||||||
 | 
					
 | 
				
			||||||
sys.path.append("adabot")
 | 
					sys.path.append("adabot")
 | 
				
			||||||
import github_requests as github
 | 
					import github_requests as github
 | 
				
			||||||
 | 
					
 | 
				
			||||||
exit_status = 0
 | 
					exit_status = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
for dirpath, dirnames, filenames in os.walk("../bin"):
 | 
					filepaths = list(glob.iglob('../bin/*/*', recursive=True))
 | 
				
			||||||
    if not filenames:
 | 
					filepaths.sort()
 | 
				
			||||||
        continue
 | 
					
 | 
				
			||||||
    for filename in filenames:
 | 
					for full_filename in filepaths:
 | 
				
			||||||
        full_filename = os.path.join(dirpath, filename)
 | 
					    filename = os.path.basename(full_filename)
 | 
				
			||||||
        label = filename.replace("adafruit-circuitpython-", "")
 | 
					 | 
				
			||||||
    url_vars = {}
 | 
					    url_vars = {}
 | 
				
			||||||
    url_vars["name"] = filename
 | 
					    url_vars["name"] = filename
 | 
				
			||||||
        url_vars["label"] = label
 | 
					 | 
				
			||||||
    url = uritemplate.expand(os.environ["UPLOAD_URL"], url_vars)
 | 
					    url = uritemplate.expand(os.environ["UPLOAD_URL"], url_vars)
 | 
				
			||||||
    headers = {"content-type": "application/octet-stream"}
 | 
					    headers = {"content-type": "application/octet-stream"}
 | 
				
			||||||
    print(url)
 | 
					    print(url)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user