diff --git a/boards/nrf6310/Makefile.dep b/boards/nrf6310/Makefile.dep index 7de44689f6..babcd96228 100644 --- a/boards/nrf6310/Makefile.dep +++ b/boards/nrf6310/Makefile.dep @@ -1,3 +1 @@ -ifneq (,$(filter gnrc_netdev_default netdev_default,$(USEMODULE))) - USEMODULE += nrfmin -endif +include $(RIOTBOARD)/common/nrf51/Makefile.dep diff --git a/boards/nrf6310/Makefile.features b/boards/nrf6310/Makefile.features index 6cec355f5f..d2712cafab 100644 --- a/boards/nrf6310/Makefile.features +++ b/boards/nrf6310/Makefile.features @@ -1,13 +1,8 @@ # Put defined MCU peripherals here (in alphabetical order) -FEATURES_PROVIDED += periph_gpio periph_gpio_irq -FEATURES_PROVIDED += periph_rtt FEATURES_PROVIDED += periph_spi -FEATURES_PROVIDED += periph_timer FEATURES_PROVIDED += periph_uart -# Various other features (if any) - -# The board MPU family (used for grouping by the CI system) -FEATURES_MCU_GROUP = cortex_m0_2 +# include common nrf51 based boards features +include $(RIOTBOARD)/common/nrf51/Makefile.features include $(RIOTCPU)/nrf51/Makefile.features diff --git a/boards/nrf6310/Makefile.include b/boards/nrf6310/Makefile.include index 7cb45a324f..a70b6acf73 100644 --- a/boards/nrf6310/Makefile.include +++ b/boards/nrf6310/Makefile.include @@ -1,21 +1,17 @@ # define the used CPU -export CPU = nrf51 export CPU_MODEL = nrf51x22xxaa # set default port depending on operating system PORT_LINUX ?= /dev/ttyUSB0 PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.SLAB_USBtoUART*))) -# 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 +# use jlink to program this board +PROGRAMMER ?= jlink -HEXFILE = $(BINFILE) -export FFLAGS = $(BINDIR) $(HEXFILE) -export DEBUGGER_FLAGS = $(BINDIR) $(ELFFILE) -export RESET_FLAGS = $(BINDIR) +# set required debug adapter for openocd if it's used +ifeq (openocd,$(PROGRAMMER)) + DEBUG_ADAPTER = jlink +endif -# setup serial terminal -include $(RIOTMAKE)/tools/serial.inc.mk +# include nrf51 boards common configuration +include $(RIOTBOARD)/common/nrf51/Makefile.include diff --git a/boards/nrf6310/dist/debug.sh b/boards/nrf6310/dist/debug.sh deleted file mode 100755 index 24bdbae0f6..0000000000 --- a/boards/nrf6310/dist/debug.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/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 - -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 diff --git a/boards/nrf6310/dist/flash.sh b/boards/nrf6310/dist/flash.sh deleted file mode 100755 index 0f4bbb33c7..0000000000 --- a/boards/nrf6310/dist/flash.sh +++ /dev/null @@ -1,25 +0,0 @@ -#!/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 -# @author Hauke Petersen - -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 diff --git a/boards/nrf6310/dist/reset.sh b/boards/nrf6310/dist/reset.sh deleted file mode 100755 index 509f127ea4..0000000000 --- a/boards/nrf6310/dist/reset.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh - -# This script resets a nrf51822 target using JLink called -# with a pre-defined reset sequence. - -# @author Hauke Petersen - -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 diff --git a/boards/nrf6310/include/periph_conf.h b/boards/nrf6310/include/periph_conf.h index d1afa91ae3..7f00dffbb4 100644 --- a/boards/nrf6310/include/periph_conf.h +++ b/boards/nrf6310/include/periph_conf.h @@ -23,6 +23,7 @@ #define PERIPH_CONF_H #include "periph_cpu.h" +#include "periph_conf_common.h" #ifdef __cplusplus extern "C" { @@ -43,30 +44,6 @@ extern "C" { * 2: derived from HFCLK */ /** @} */ -/** - * @name Timer configuration - * @{ - */ -static const timer_conf_t timer_config[] = { - /* dev, channels, width */ - { NRF_TIMER0, 3, TIMER_BITMODE_BITMODE_24Bit, TIMER0_IRQn } -}; - -#define TIMER_0_ISR isr_timer0 - -#define TIMER_NUMOF (sizeof(timer_config) / sizeof(timer_config[0])) -/** @} */ - -/** - * @name Real time counter configuration - * @{ - */ -#define RTT_NUMOF (1U) -#define RTT_DEV (1) /* NRF_RTC1 */ -#define RTT_MAX_VALUE (0x00ffffff) -#define RTT_FREQUENCY (1024) -/** @} */ - /** * @name UART configuration * @{