Skip to content
Snippets Groups Projects
Commit a72129c2 authored by Hauke Petersen's avatar Hauke Petersen
Browse files

boards/pca10005: use global JLink script

parent 2ba31676
No related branches found
No related tags found
No related merge requests found
......@@ -6,18 +6,10 @@ export CPU_MODEL = nrf51x22xxaa
PORT_LINUX ?= /dev/ttyUSB0
PORT_DARWIN ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
# define flash and debugging environment
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh
export DEBUGSERVER = JLinkGDBServer -device nrf51822 -if SWD
export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh
export OFLAGS = -O binary
export HEXFILE = $(ELFFILE:.elf=.bin)
export TERMFLAGS += -p "$(PORT)"
export FFLAGS = $(BINDIR) $(HEXFILE)
export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE)
export RESET_FLAGS = $(BINDIR)
# setup JLink for flashing
export JLINK_DEVICE := nrf51822
export JLINK_PRE_FLASH := w4 4001e504 1
include $(RIOTBOARD)/Makefile.include.jlink
# setup serial terminal
include $(RIOTBOARD)/Makefile.include.serial
#!/bin/sh
# Start in-circuit debugging on this board: this script starts up the GDB
# client and connects to a GDB server.
#
# Start the GDB server first using the 'make debugserver' target
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
BINDIR=$1
ELFFILE=$2
# write GDB config file
echo "target extended-remote 127.0.0.1:2331" > $BINDIR/gdb.cfg
# run GDB
arm-none-eabi-gdb -tui -command=$BINDIR/gdb.cfg $ELFFILE
#!/bin/sh
# This flash script dynamically generates a file with a set of commands which
# have to be handed to the flashing script of SEGGER (JLinkExe >4.84).
# After that, JLinkExe will be executed with that set of commands to flash the
# latest .bin file to the board.
# @author Timo Ziegler <timo.ziegler@fu-berlin.de>
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
BINDIR=$1
HEXFILE=$2
# setup JLink command file
echo "device nrf51822" > $BINDIR/burn.seg
echo "speed 1000" >> $BINDIR/burn.seg
echo "w4 4001e504 1" >> $BINDIR/burn.seg
echo "loadbin $HEXFILE 0" >> $BINDIR/burn.seg
echo "r" >> $BINDIR/burn.seg
echo "g" >> $BINDIR/burn.seg
echo "exit" >> $BINDIR/burn.seg
echo "" >> $BINDIR/burn.seg
# flash new binary to the board
JLinkExe < $BINDIR/burn.seg
#!/bin/sh
# This script resets a nrf51822 target using JLink called
# with a pre-defined reset sequence.
# @author Hauke Petersen <hauke.petersen@fu-berlin.de>
BINDIR=$1
# create JLink command file for resetting the board
echo "device nrf51822" > $BINDIR/reset.seg
echo "r" >> $BINDIR/reset.seg
echo "g" >> $BINDIR/reset.seg
echo "exit" >> $BINDIR/reset.seg
echo " " >> $BINDIR/reset.seg
# reset the board
JLinkExe < $BINDIR/reset.seg
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment