Skip to content

Commit

Permalink
boards/nrf52xxxdk: add openocd as programmer
Browse files Browse the repository at this point in the history
For the moment openocd doesn't work when softdevice blob module is loaded
  • Loading branch information
aabadie committed Aug 6, 2018
1 parent d1df12e commit 88b7c1f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
29 changes: 20 additions & 9 deletions boards/common/nrf52xxxdk/Makefile.include
Expand Up @@ -15,18 +15,29 @@ PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
include $(RIOTMAKE)/tools/serial.inc.mk

# setup JLink for flashing
export JLINK_DEVICE := nrf52

# 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

# special options when using SoftDevice
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
export JLINK_PRE_FLASH := erase\nloadfile $(BINDIR)/softdevice.hex
export FLASH_ADDR := 0x1f000
export LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
PROGRAMMER ?= jlink
ifeq (jlink,$(PROGRAMMER))
# setup JLink for flashing
export JLINK_DEVICE := nrf52

# special options when using SoftDevice
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
export JLINK_PRE_FLASH := erase\nloadfile $(BINDIR)/softdevice.hex
export FLASH_ADDR := 0x1f000
export LINKER_SCRIPT ?= $(RIOTCPU)/$(CPU)/ldscripts/$(CPU_MODEL)_sd.ld
endif
include $(RIOTMAKE)/tools/jlink.inc.mk
else ifeq (openocd,$(PROGRAMMER))
# openocd doesn't work (yet) with softdevice
ifneq (,$(filter nordic_softdevice_ble,$(USEPKG)))
$(error Cannot use OpenOCD with nordic_softdevice module)
endif
export DEBUG_ADAPTER ?= jlink
export OPENOCD_CONFIG := $(RIOTBOARD)/common/nrf52xxxdk/dist/openocd.cfg
include $(RIOTMAKE)/tools/openocd.inc.mk
endif
include $(RIOTMAKE)/tools/jlink.inc.mk
3 changes: 3 additions & 0 deletions boards/common/nrf52xxxdk/dist/openocd.cfg
@@ -0,0 +1,3 @@
transport select swd

source [find target/nrf52.cfg]

0 comments on commit 88b7c1f

Please sign in to comment.