2018-10-28 19:42:48 +01:00
|
|
|
# include this module into the build
|
|
|
|
INCLUDES += -I$(RIOTBOARD)/common/nrf52/include
|
|
|
|
|
|
|
|
# set default port depending on operating system
|
|
|
|
PORT_LINUX ?= /dev/ttyACM0
|
|
|
|
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
|
|
|
include $(RIOTMAKE)/tools/serial.inc.mk
|
|
|
|
|
2018-06-20 10:42:38 +02:00
|
|
|
# The following configuration is dependencies specific
|
|
|
|
# but they are resolved later
|
|
|
|
# Hack to know now if 'nordic_softdevice_ble' is used
|
|
|
|
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
|
2018-10-28 19:42:48 +01:00
|
|
|
|
2018-06-20 10:42:38 +02:00
|
|
|
PROGRAMMER ?= jlink
|
2018-10-28 19:42:48 +01:00
|
|
|
ifeq (jlink,$(PROGRAMMER))
|
|
|
|
# setup JLink for flashing
|
2020-03-03 11:56:38 +01:00
|
|
|
JLINK_DEVICE = nrf52
|
2018-10-28 19:42:48 +01:00
|
|
|
|
|
|
|
# special options when using SoftDevice
|
|
|
|
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
|
2020-03-03 16:43:45 +01:00
|
|
|
JLINK_PRE_FLASH = loadfile $(BINDIR)/softdevice.hex
|
2020-03-03 16:22:30 +01:00
|
|
|
FLASH_ADDR = 0x1f000
|
2020-01-02 20:49:21 +01:00
|
|
|
LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
|
2019-08-12 11:08:35 +02:00
|
|
|
# murdock: softdevice.hex file is used for flashing
|
|
|
|
# It must be taken into account for the test input hash and
|
|
|
|
# be sent to the separated testing boards
|
|
|
|
TEST_EXTRA_FILES += $(BINDIR)/softdevice.hex
|
|
|
|
# Files in TEST_EXTRA_FILES need to have an explicit target
|
|
|
|
$(BINDIR)/softdevice.hex: | $(ELFFILE)
|
2018-10-28 19:42:48 +01:00
|
|
|
endif
|
|
|
|
include $(RIOTMAKE)/tools/jlink.inc.mk
|
2018-06-20 10:42:38 +02:00
|
|
|
else ifeq (openocd,$(PROGRAMMER))
|
2019-02-26 11:15:36 +01:00
|
|
|
ifneq (,$(filter $(BOARD),ruuvitag thingy52))
|
|
|
|
# openocd doesn't fully work with ruuvitag and thingy52
|
|
|
|
$(error Cannot use OpenOCD with $(BOARD) board)
|
|
|
|
endif
|
2018-06-20 10:42:38 +02:00
|
|
|
# setup OpenOCD for flashing. Version 0.10 of OpenOCD doesn't contain support
|
|
|
|
# for nrf52dk and nrf52840dk boards. To use OpenOCD with these a version
|
|
|
|
# build from source (master > 2018, August the 13rd) is required.
|
|
|
|
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
|
2019-04-30 11:51:35 +02:00
|
|
|
LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
|
|
|
|
|
|
|
|
export OPENOCD_PRE_FLASH_CMDS += -c 'flash write_image erase "$(BINDIR)/softdevice.hex"'
|
2020-03-26 09:20:51 +01:00
|
|
|
OPENOCD_PRE_VERIFY_CMDS += -c 'verify_image "$(BINDIR)/softdevice.hex"'
|
2019-04-30 11:51:35 +02:00
|
|
|
|
|
|
|
# Cannot use the 'ELFFILE' here
|
|
|
|
# The segments are 0x10000 aligned so padding bytes are copied and verified
|
|
|
|
#
|
|
|
|
# Using 'LINKFLAGS += -Wl,--nmagic' prevents it but would require
|
|
|
|
# dedicated testing/review
|
|
|
|
FLASHFILE ?= $(HEXFILE)
|
|
|
|
|
|
|
|
# murdock: softdevice.hex file is used for flashing
|
|
|
|
# It must be taken into account for the test input hash and
|
|
|
|
# be sent to the separated testing boards
|
|
|
|
TEST_EXTRA_FILES += $(BINDIR)/softdevice.hex
|
|
|
|
# Files in TEST_EXTRA_FILES need to have an explicit target
|
|
|
|
$(BINDIR)/softdevice.hex: | $(ELFFILE)
|
2018-06-20 10:42:38 +02:00
|
|
|
endif
|
2019-05-31 11:43:47 +02:00
|
|
|
DEBUG_ADAPTER ?= jlink
|
2020-02-22 11:33:19 +01:00
|
|
|
OPENOCD_CONFIG = $(RIOTBOARD)/common/nrf52/dist/openocd.cfg
|
2018-06-20 10:42:38 +02:00
|
|
|
include $(RIOTMAKE)/tools/openocd.inc.mk
|
2018-10-28 19:42:48 +01:00
|
|
|
endif
|