Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding RFduino board support #2312

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions boards/rfduino/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# tell the Makefile.base which module to build
MODULE = $(BOARD)_base

include $(RIOTBASE)/Makefile.base
2 changes: 2 additions & 0 deletions boards/rfduino/Makefile.features
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_uart periph_gpio periph_random periph_rtt periph_cpuid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove periph random in case it's not working

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm i dont have any edit rights anymore. I think moved the cloned riot-os from my own account. Hm well anyone with edit right feel free to edit :) " from unknown repository"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rfswarm Where/To whom did you move it? I don't have any rights for "unknown repository" neither. 😄

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sh.. I think I removed and added the repository at my own git account. puh i am trying to fix it - maybe I can remove the 2312 pull and add a new one (with the same content and changes). I hope to google a solution today.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isaacs/github#168

yes this is my probem. i am new to this github thing. well

@thomaseichinger

thomas, I ll clone a new riot soon, copy the files and changes from this pull - and create a new pull ? - is this ok?

57 changes: 57 additions & 0 deletions boards/rfduino/Makefile.include
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# define the cpu used by the rfduino-nrf51822 board
export CPU = nrf51822
export CPU_MODEL = nrf51822qfaa

#define the default port depending on the host OS
OS := $(shell uname)
ifeq ($(OS),Linux)
PORT ?= /dev/ttyUSB0
else ifeq ($(OS),Darwin)
PORT ?= $(shell ls -1 /dev/tty.SLAB_USBtoUART* | head -n 1)
else
$(info CAUTION: No flash tool for your host system found!)
# TODO: add support for windows as host platform
endif
export PORT

# define tools used for building the project
export PREFIX = arm-none-eabi-
export CC = $(PREFIX)gcc
export CXX = $(PREFIX)g++
export AR = $(PREFIX)ar
export AS = $(PREFIX)as
export LINK = $(PREFIX)gcc
export SIZE = $(PREFIX)size
export OBJCOPY = $(PREFIX)objcopy
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh
export DEBUGSERVER = $(RIOTBOARD)/$(BOARD)/dist/debug-server.sh
export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh

# define build specific options
CPU_USAGE = -mcpu=cortex-m0
FPU_USAGE =
export CFLAGS += -ggdb -g3 -std=gnu99 -Os -Wall -Wstrict-prototypes $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -mthumb -mthumb-interwork -nostartfiles
export CFLAGS += -ffunction-sections -fdata-sections -fno-builtin
export ASFLAGS += -ggdb -g3 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian
export LINKFLAGS += -g3 -ggdb -std=gnu99 $(CPU_USAGE) $(FPU_USAGE) -mlittle-endian -static -lgcc -mthumb -mthumb-interwork -nostartfiles
# $(LINKERSCRIPT) is specified in cpu/Makefile.include
export LINKFLAGS += -T$(LINKERSCRIPT)
export OFLAGS = -O binary
export HEXFILE = $(ELFFILE:.elf=.bin)
export TERMFLAGS += -p "$(PORT)"
export FFLAGS = $(HEXFILE)
export DEBUGGER_FLAGS = $(ELFFILE)

# unwanted (CXXUWFLAGS) and extra (CXXEXFLAGS) flags for c++
export CXXUWFLAGS +=
export CXXEXFLAGS +=

# use the nano-specs of the NewLib when available
ifeq ($(shell $(LINK) -specs=nano.specs -E - 2>/dev/null >/dev/null </dev/null ; echo $$?),0)
export LINKFLAGS += -specs=nano.specs -lc -lnosys
endif

# export board specific includes to the global includes-listing
export INCLUDES += -I$(RIOTBOARD)/$(BOARD)/include
29 changes: 29 additions & 0 deletions boards/rfduino/board.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (C) 2014 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 board_rfduino-nrf51822
* @{
*
* @file board.c
* @brief Board specific implementations for the RFduino NRF51822 board
*
* @author Hauke Petersen <[email protected]>
* @author Jan Wagner <[email protected]>
*
* @}
*/

#include "board.h"
#include "cpu.h"

void board_init(void)
{
/* initialize the CPU */
cpu_init();
}
17 changes: 17 additions & 0 deletions boards/rfduino/dist/debug-server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

if [ -L "$0" ]; then
FILE=$(readlink "$0")
else
FILE="$0"
fi

BIN_FOLDER=$(dirname "${FILE}")

echo "##"
echo "## Starting debug server"
echo "##"
openocd -f "${BIN_FOLDER}/openocd.cfg" \
-c "init" \
-c "targets" \
-c "reset halt" \
19 changes: 19 additions & 0 deletions boards/rfduino/dist/debug.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

if [ ! -f "$1" ]; then
echo "ELF-file $1 does not exist"
exit 1
fi

if [ -L "$0" ]; then
FILE=$(readlink "$0")
else
FILE="$0"
fi

BIN_FOLDER=$(dirname "${FILE}")

echo "##"
echo "## Debugging $1"
echo "##"
arm-none-eabi-gdb -tui -command="${BIN_FOLDER}/gdb.cfg" $1
27 changes: 27 additions & 0 deletions boards/rfduino/dist/flash.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/sh

if [ ! -f "$1" ]; then
echo "Binary file $1 does not exist"
exit 1
fi

if [ -L "$0" ]; then
FILE=$(readlink "$0")
else
FILE="$0"
fi

BIN_FOLDER=$(dirname "${FILE}")

echo "##"
echo "## Flashing $1"
echo "##"
openocd -f "${BIN_FOLDER}/openocd.cfg" \
-c "init" \
-c "targets" \
-c "flash banks" \
-c "reset halt" \
-c "flash write_image erase $1 0" \
-c "verify_image $1" \
-c "reset run"\
-c "shutdown"
1 change: 1 addition & 0 deletions boards/rfduino/dist/gdb.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
target extended-remote :3333
7 changes: 7 additions & 0 deletions boards/rfduino/dist/openocd.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# nRF51822 Target
source [find interface/stlink-v2.cfg]

transport select hla_swd

set WORKAREASIZE 0x4000
source [find target/nrf51.cfg]
17 changes: 17 additions & 0 deletions boards/rfduino/dist/reset.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh

if [ -L "$0" ]; then
FILE=$(readlink "$0")
else
FILE="$0"
fi

BIN_FOLDER=$(dirname "${FILE}")

echo "##"
echo "## Resetting $BOARD"
echo "##"
openocd -f "${BIN_FOLDER}/openocd.cfg" \
-c "init" \
-c "reset run" \
-c "shutdown"
75 changes: 75 additions & 0 deletions boards/rfduino/include/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2014 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 board_rfduino-nrf51822 RFduino NRF51822
* @ingroup boards
* @brief Board specific files for the RFduino RF51822 board
* @{
*
* @file
* @brief Board specific definitions for the RFduino RF51822 board
*
* @author Hauke Petersen <[email protected]>
* @author Jan Wagner <[email protected]>
*/

#ifndef __BOARD_H
#define __BOARD_H

#include "cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
* @name Define the nominal CPU core clock in this board
*/
#define F_CPU (16000000UL)

/**
* @name Define the boards stdio
* @{
*/
#define STDIO UART_0
#define STDIO_BAUDRATE (115200U)
#define STDIO_RX_BUFSIZE (64U)
/** @} */

/**
* @name Assign the hardware timer
*/
#define HW_TIMER TIMER_0

/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED_RED_ON /* not available */
#define LED_RED_OFF /* not available */
#define LED_RED_TOGGLE /* not available */
#define LED_GREEN_ON /* not available */
#define LED_GREEN_OFF /* not available */
#define LED_GREEN_TOGGLE /* not available */
#define LED_BLUE_ON /* not available */
#define LED_BLUE_OFF /* not available */
#define LED_BLUE_TOGGLE /* not available */
/* @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);

#ifdef __cplusplus
}
#endif

#endif /** __BOARD_H */
/** @} */
Loading