boards: initial import of yunjia-nrf51822 board
parent
c61721cac0
commit
e0fec98477
@ -0,0 +1,4 @@
|
||||
# tell the Makefile.base which module to build
|
||||
MODULE = $(BOARD)_base
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
@ -0,0 +1,52 @@
|
||||
# define the cpu used by the yunjia-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 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)
|
||||
|
||||
# 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
|
@ -0,0 +1,30 @@
|
||||
/*
|
||||
* 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_yunjia-nrf51822
|
||||
* @{
|
||||
*
|
||||
* @file board.c
|
||||
* @brief Board specific implementations for the Yunjia NRF51822 board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "cpu.h"
|
||||
|
||||
#include "periph/uart.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -L "$0" ]; then
|
||||
FILE=$(readlink -e "$0")
|
||||
else
|
||||
FILE="$0"
|
||||
fi
|
||||
|
||||
BIN_FOLDER=$(dirname "${FILE}")
|
||||
|
||||
openocd -f "${BIN_FOLDER}/openocd.cfg" \
|
||||
-c "init" \
|
||||
-c "targets" \
|
||||
-c "reset halt" \
|
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -L "$0" ]; then
|
||||
FILE=$(readlink -e "$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" \
|
@ -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 -e "$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
|
@ -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 -e "$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"
|
@ -0,0 +1 @@
|
||||
target extended-remote 127.0.0.1:3333
|
@ -0,0 +1,8 @@
|
||||
# nRF51822 Target
|
||||
source [find interface/stlink-v2.cfg]
|
||||
|
||||
set WORKAREASIZE 0x4000
|
||||
source [find target/nrf51_stlink.tcl]
|
||||
|
||||
# use hardware reset, connect under reset
|
||||
#reset_config srst_only srst_nogate
|
@ -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"
|
@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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_yunjia-nrf51822 Yunjia NRF51822
|
||||
* @ingroup boards
|
||||
* @brief Board specific files for the Yunjia NRF51822 board
|
||||
* @{
|
||||
*
|
||||
* @file board.h
|
||||
* @brief Board specific definitions for the Yunjia NRF51822 board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
|
||||
/**
|
||||
* @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)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @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 */
|
||||
/* @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#endif /** __BOARD_H */
|
||||
/** @} */
|
@ -0,0 +1,119 @@
|
||||
/*
|
||||
* 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_yunjia-nrf51822
|
||||
* @{
|
||||
*
|
||||
* @file periph_conf.h
|
||||
* @brief Peripheral MCU configuration for the Yunjia NRF51822 board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __PERIPH_CONF_H
|
||||
#define __PERIPH_CONF_H
|
||||
|
||||
/**
|
||||
* @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 (0xffffffff)
|
||||
#define TIMER_0_BITMODE TIMER_BITMODE_BITMODE_32Bit
|
||||
#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 UART configuration
|
||||
* @{
|
||||
*/
|
||||
#define UART_NUMOF (1U)
|
||||
#define UART_0_EN 1
|
||||
#define UART_IRQ_PRIO 1
|
||||
|
||||
/* UART 0 device configuration */
|
||||
#define UART_0_DEV NRF_UART0
|
||||
#define UART_0_PIN_RX 1
|
||||
#define UART_0_PIN_TX 2
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Real time counter configuration
|
||||
* @{
|
||||
*/
|
||||
#define RTT_NUMOF (1U)
|
||||
#define RTT_IRQ_PRIO 1
|
||||
|
||||
#define RTT_DEV NRF_RTC0
|
||||
#define RTT_IRQ RTC0_IRQn
|
||||
#define RTT_ISR isr_rtc0
|
||||
#define RTT_MAX_VALUE (0xffffff)
|
||||
#define RTT_FREQUENCY (10) /* in Hz */
|
||||
#define RTT_PRESCALER (3275U) /* run with 10 Hz */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Random Number Generator configuration
|
||||
* @{
|
||||
*/
|
||||
#define RANDOM_NUMOF (1U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name GPIO configuration
|
||||
* @{
|
||||
*/
|
||||
#define GPIO_NUMOF (8U)
|
||||
#define GPIO_0_EN 1
|
||||
#define GPIO_1_EN 1
|
||||
#define GPIO_2_EN 1
|
||||
#define GPIO_3_EN 1
|
||||
#define GPIO_4_EN 1
|
||||
#define GPIO_5_EN 1
|
||||
#define GPIO_6_EN 1
|
||||
#define GPIO_7_EN 1
|
||||
#define GPIO_IRQ_PRIO 1
|
||||
|
||||
/* GPIO pin configuration */
|
||||
#define GPIO_0_PIN 7
|
||||
#define GPIO_1_PIN 8
|
||||
#define GPIO_2_PIN 9
|
||||
#define GPIO_3_PIN 10
|
||||
#define GPIO_4_PIN 11
|
||||
#define GPIO_5_PIN 12
|
||||
#define GPIO_6_PIN 13
|
||||
#define GPIO_7_PIN 14
|
||||
/** @} */
|
||||
|
||||
#endif /* __PERIPH_CONF_H */
|
Loading…
Reference in New Issue