mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #3211 from haukepetersen/add_board_nrf51dongle
boards: added support for the Nordic nRF51 Dongle
This commit is contained in:
commit
c0706da1e5
4
boards/nrf51dongle/Makefile
Normal file
4
boards/nrf51dongle/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
# tell the Makefile.base which module to build
|
||||
MODULE = $(BOARD)_base
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
8
boards/nrf51dongle/Makefile.features
Normal file
8
boards/nrf51dongle/Makefile.features
Normal file
@ -0,0 +1,8 @@
|
||||
FEATURES_PROVIDED += cpp
|
||||
FEATURES_PROVIDED += radio_nrfmin
|
||||
FEATURES_PROVIDED += periph_uart
|
||||
FEATURES_PROVIDED += periph_gpio
|
||||
FEATURES_PROVIDED += periph_random
|
||||
FEATURES_PROVIDED += periph_rtt
|
||||
FEATURES_PROVIDED += periph_cpuid
|
||||
FEATURES_MCU_GROUP = cortex_m0
|
26
boards/nrf51dongle/Makefile.include
Normal file
26
boards/nrf51dongle/Makefile.include
Normal file
@ -0,0 +1,26 @@
|
||||
# define the used CPU
|
||||
export CPU = nrf51
|
||||
export CPU_MODEL = nrf51x22xxab
|
||||
|
||||
# define the default port depending on the host OS
|
||||
PORT_LINUX ?= /dev/ttyACM0
|
||||
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 serial terminal
|
||||
include $(RIOTBOARD)/Makefile.include.serial
|
||||
|
||||
# include cortex defaults
|
||||
include $(RIOTBOARD)/Makefile.include.cortexm_common
|
31
boards/nrf51dongle/board.c
Normal file
31
boards/nrf51dongle/board.c
Normal file
@ -0,0 +1,31 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup boards_nrf51dongle
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board initialization code for the nRF51 Dongle
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "cpu.h"
|
||||
#include "board.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs, set pins as output and turn LEDs off */
|
||||
NRF_GPIO->DIRSET = (LED_RED_PIN | LED_GREEN_PIN | LED_BLUE_PIN);
|
||||
NRF_GPIO->OUTSET = (LED_RED_PIN | LED_GREEN_PIN | LED_BLUE_PIN);
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
17
boards/nrf51dongle/dist/debug.sh
vendored
Executable file
17
boards/nrf51dongle/dist/debug.sh
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
#!/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
|
25
boards/nrf51dongle/dist/flash.sh
vendored
Executable file
25
boards/nrf51dongle/dist/flash.sh
vendored
Executable file
@ -0,0 +1,25 @@
|
||||
#!/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
|
18
boards/nrf51dongle/dist/reset.sh
vendored
Executable file
18
boards/nrf51dongle/dist/reset.sh
vendored
Executable file
@ -0,0 +1,18 @@
|
||||
#!/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
|
84
boards/nrf51dongle/include/board.h
Normal file
84
boards/nrf51dongle/include/board.h
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup boards_nrf51dongle nRF51 Dongle
|
||||
* @ingroup boards
|
||||
* @brief Board specific files for the Nordic nRF51 Dongle
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration for the nRF51 Dongle
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph_conf.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Define the nominal CPU core clock in this board
|
||||
*/
|
||||
#define F_CPU (CLOCK_CORECLOCK)
|
||||
|
||||
/**
|
||||
* @brief Assign the hardware timer
|
||||
*/
|
||||
#define HW_TIMER TIMER_0
|
||||
|
||||
/**
|
||||
* @name Define the boards STDIO
|
||||
* @{
|
||||
*/
|
||||
#define STDIO UART_0
|
||||
#define STDIO_BAUDRATE (115200U)
|
||||
#define STDIO_RX_BUFSIZE (64U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_PIN (1 << 21)
|
||||
#define LED_GREEN_PIN (1 << 22)
|
||||
#define LED_BLUE_PIN (1 << 23)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_ON (NRF_GPIO->OUTCLR = LED_RED_PIN)
|
||||
#define LED_RED_OFF (NRF_GPIO->OUTSET = LED_RED_PIN)
|
||||
#define LED_RED_TOGGLE (NRF_GPIO->OUT ^= LED_RED_PIN)
|
||||
#define LED_GREEN_ON (NRF_GPIO->OUTCLR = LED_GREEN_PIN)
|
||||
#define LED_GREEN_OFF (NRF_GPIO->OUTSET = LED_GREEN_PIN)
|
||||
#define LED_GREEN_TOGGLE (NRF_GPIO->OUT ^= LED_GREEN_PIN)
|
||||
#define LED_BLUE_ON (NRF_GPIO->OUTCLR = LED_BLUE_PIN)
|
||||
#define LED_BLUE_OFF (NRF_GPIO->OUTSET = LED_BLUE_PIN)
|
||||
#define LED_BLUE_TOGGLE (NRF_GPIO->OUT ^= LED_BLUE_PIN)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize the board, also triggers the CPU initialization
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /** BOARD_H */
|
||||
/** @} */
|
126
boards/nrf51dongle/include/periph_conf.h
Normal file
126
boards/nrf51dongle/include/periph_conf.h
Normal file
@ -0,0 +1,126 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin
|
||||
*
|
||||
* This file is subject to the terms and conditions of the GNU Lesser
|
||||
* General Public License v2.1. See the file LICENSE in the top level
|
||||
* directory for more details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup boards_nrf51dongle
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral configuration for the Nordic nRF51 Dongle
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __PERIPH_CONF_H
|
||||
#define __PERIPH_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Clock configuration
|
||||
*
|
||||
* @note: the radio will not work with the internal RC oscillator!
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_CORECLOCK (16000000U) /* fixed for all NRF51822 */
|
||||
#define CLOCK_CRYSTAL (16U) /* set to 0: internal RC oscillator
|
||||
16: 16MHz crystal
|
||||
32: 32MHz crystal */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Timer configuration
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (1U)
|
||||
#define TIMER_0_EN 1
|
||||
#define TIMER_1_EN 0
|
||||
#define TIMER_2_EN 0
|
||||
#define TIMER_IRQ_PRIO 1
|
||||
|
||||
/* Timer 0 configuration */
|
||||
#define TIMER_0_DEV NRF_TIMER0
|
||||
#define TIMER_0_CHANNELS 3
|
||||
#define TIMER_0_MAX_VALUE (0xffffff)
|
||||
#define TIMER_0_BITMODE TIMER_BITMODE_BITMODE_24Bit
|
||||
#define TIMER_0_ISR isr_timer0
|
||||
#define TIMER_0_IRQ TIMER0_IRQn
|
||||
|
||||
/* Timer 1 configuration */
|
||||
#define TIMER_1_DEV NRF_TIMER1
|
||||
#define TIMER_1_CHANNELS 3
|
||||
#define TIMER_1_MAX_VALUE (0xffff)
|
||||
#define TIEMR_1_BITMODE TIMER_BITMODE_BITMODE_16Bit
|
||||
#define TIMER_1_ISR isr_timer1
|
||||
#define TIMER_1_IRQ TIMER1_IRQn
|
||||
|
||||
/* Timer 2 configuration */
|
||||
#define TIMER_2_DEV NRF_TIMER2
|
||||
#define TIMER_2_CHANNELS 3
|
||||
#define TIMER_2_MAX_VALUE (0xffff)
|
||||
#define TIMER_2_BITMODE TIMER_BITMODE_BITMODE_16Bit
|
||||
#define TIMER_2_ISR isr_timer2
|
||||
#define TIMER_2_IRQ TIMER2_IRQn
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Real time counter configuration
|
||||
* @{
|
||||
*/
|
||||
#define RTT_NUMOF (1U)
|
||||
#define RTT_IRQ_PRIO 1
|
||||
|
||||
#define RTT_DEV NRF_RTC1
|
||||
#define RTT_IRQ RTC1_IRQn
|
||||
#define RTT_ISR isr_rtc1
|
||||
#define RTT_MAX_VALUE (0xffffff)
|
||||
#define RTT_FREQUENCY (10) /* in Hz */
|
||||
#define RTT_PRESCALER (3275U) /* run with 10 Hz */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name UART configuration
|
||||
* @{
|
||||
*/
|
||||
#define UART_NUMOF (1U)
|
||||
#define UART_0_EN 1
|
||||
#define UART_IRQ_PRIO 1
|
||||
|
||||
/* UART pin configuration */
|
||||
#define UART_HWFLOWCTRL 1
|
||||
#define UART_PIN_RX 11
|
||||
#define UART_PIN_TX 9
|
||||
#define UART_PIN_RTS 8
|
||||
#define UART_PIN_CTS 10
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Random Number Generator configuration
|
||||
* @{
|
||||
*/
|
||||
#define RANDOM_NUMOF (1U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Radio device configuration
|
||||
*
|
||||
* The radio is not guarded by a NUMOF define, as the radio is selected by its
|
||||
* own module in the build system.
|
||||
* @{
|
||||
*/
|
||||
#define RADIO_IRQ_PRIO 1
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __PERIPH_CONF_H */
|
@ -7,9 +7,10 @@ BOARD ?= native
|
||||
# This has to be the absolute path to the RIOT base directory:
|
||||
RIOTBASE ?= $(CURDIR)/../..
|
||||
|
||||
BOARD_INSUFFICIENT_RAM := airfy-beacon chronos msb-430 msb-430h nucleo-f334 \
|
||||
pca10000 pca10005 redbee-econotag stm32f0discovery \
|
||||
telosb wsn430-v1_3b wsn430-v1_4 yunjia-nrf51822 z1
|
||||
BOARD_INSUFFICIENT_RAM := airfy-beacon chronos msb-430 msb-430h nrf51dongle \
|
||||
nucleo-f334 pca10000 pca10005 redbee-econotag \
|
||||
stm32f0discovery telosb wsn430-v1_3b wsn430-v1_4 \
|
||||
yunjia-nrf51822 z1
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560
|
||||
# arduino-mega2560: unknown error types (e.g. -EBADMSG)
|
||||
|
@ -14,6 +14,6 @@ CFLAGS += -DNATIVE_AUTO_EXIT
|
||||
|
||||
BOARD_INSUFFICIENT_RAM += chronos mbed_lpc1768 msb-430 msb-430h stm32f0discovery \
|
||||
pca10000 pca10005 yunjia-nrf51822 spark-core nucleo-f334 \
|
||||
airfy-beacon
|
||||
airfy-beacon nrf51dongle
|
||||
|
||||
include $(RIOTBASE)/Makefile.include
|
||||
|
@ -1,8 +1,10 @@
|
||||
APPLICATION = thread_cooperation
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_INSUFFICIENT_RAM := chronos msb-430 msb-430h mbed_lpc1768 redbee-econotag stm32f0discovery \
|
||||
pca10000 pca10005 yunjia-nrf51822 spark-core airfy-beacon nucleo-f334
|
||||
BOARD_INSUFFICIENT_RAM := chronos msb-430 msb-430h mbed_lpc1768 \
|
||||
redbee-econotag stm32f0discovery pca10000 pca10005 \
|
||||
yunjia-nrf51822 spark-core airfy-beacon nucleo-f334 \
|
||||
nrf51dongle
|
||||
|
||||
DISABLE_MODULE += auto_init
|
||||
|
||||
|
@ -5,7 +5,7 @@ BOARD_INSUFFICIENT_RAM := airfy-beacon chronos msb-430 msb-430h pca10000 \
|
||||
pca10005 redbee-econotag spark-core stm32f0discovery \
|
||||
telosb wsn430-v1_3b wsn430-v1_4 z1 nucleo-f334 \
|
||||
yunjia-nrf51822 samr21-xpro arduino-mega2560 \
|
||||
airfy-beacon
|
||||
airfy-beacon nrf51dongle
|
||||
|
||||
USEMODULE += embunit
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user