boards: added support for OpenMote
This commit is contained in:
parent
ffea9fc4e8
commit
a0ac86ed16
4
boards/openmote/Makefile
Normal file
4
boards/openmote/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
# tell the Makefile.base which module to build
|
||||
MODULE = $(BOARD)_base
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
1
boards/openmote/Makefile.features
Normal file
1
boards/openmote/Makefile.features
Normal file
@ -0,0 +1 @@
|
||||
FEATURES_PROVIDED = periph_gpio periph_random periph_cpuid
|
||||
53
boards/openmote/Makefile.include
Normal file
53
boards/openmote/Makefile.include
Normal file
@ -0,0 +1,53 @@
|
||||
# define the cpu used by the OpenMote board
|
||||
export CPU = cc2538
|
||||
export CPU_MODEL = cc2538sf53
|
||||
|
||||
#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.usbserial-* | 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 = JLinkGDBServer -device CC2538SF53
|
||||
export RESET = $(RIOTBOARD)/$(BOARD)/dist/reset.sh
|
||||
|
||||
# define build specific options
|
||||
CPU_USAGE = -mcpu=cortex-m3
|
||||
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) -L$(RIOTCPU)/$(CPU)
|
||||
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)
|
||||
|
||||
# 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
|
||||
59
boards/openmote/board.c
Normal file
59
boards/openmote/board.c
Normal file
@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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_openmote
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the OpenMote board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "cpu.h"
|
||||
|
||||
static inline void leds_init(void);
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the boards LEDs */
|
||||
leds_init();
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Initialize the boards on-board LEDs (LD3 and LD4)
|
||||
*
|
||||
* The LED initialization is hard-coded in this function. As the LEDs are soldered
|
||||
* onto the board they are fixed to their CPU pins.
|
||||
*
|
||||
* The LEDs are connected to the following pins:
|
||||
* - LED1: PC4 (red)
|
||||
* - LED2: PC5 (orange)
|
||||
* - LED3: PC6 (yellow)
|
||||
* - LED4: PC7 (green)
|
||||
*/
|
||||
static inline void leds_init(void)
|
||||
{
|
||||
/* set pins to be controlled by software */
|
||||
LED_PORT->AFSEL &= ~((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN) |
|
||||
(1 << LED_YELLOW_PIN) | (1 << LED_ORANGE_PIN));
|
||||
/* configure pins as output */
|
||||
LED_PORT->DIR |= ((1 << LED_RED_PIN) | (1 << LED_GREEN_PIN) |
|
||||
(1 << LED_YELLOW_PIN) | (1 << LED_ORANGE_PIN));
|
||||
/* configure io-mux for used pins */
|
||||
IOC->PC_OVER[LED_RED_PIN] = IOC_OVERRIDE_OE;
|
||||
IOC->PC_OVER[LED_GREEN_PIN] = IOC_OVERRIDE_OE;
|
||||
IOC->PC_OVER[LED_YELLOW_PIN] = IOC_OVERRIDE_OE;
|
||||
IOC->PC_OVER[LED_ORANGE_PIN] = IOC_OVERRIDE_OE;
|
||||
}
|
||||
17
boards/openmote/dist/debug.sh
vendored
Executable file
17
boards/openmote/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
|
||||
23
boards/openmote/dist/flash.sh
vendored
Executable file
23
boards/openmote/dist/flash.sh
vendored
Executable file
@ -0,0 +1,23 @@
|
||||
#!/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 Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
|
||||
BINDIR=$1
|
||||
HEXFILE=$2
|
||||
FLASHADDR=200000
|
||||
|
||||
# setup JLink command file
|
||||
echo "speed 1000" >> $BINDIR/burn.seg
|
||||
echo "loadbin $HEXFILE $FLASHADDR" >> $BINDIR/burn.seg
|
||||
echo "r" >> $BINDIR/burn.seg
|
||||
echo "g" >> $BINDIR/burn.seg
|
||||
echo "exit" >> $BINDIR/burn.seg
|
||||
|
||||
# flash new binary to the board
|
||||
JLinkExe -device CC2538SF53 < $BINDIR/burn.seg
|
||||
echo ""
|
||||
17
boards/openmote/dist/reset.sh
vendored
Executable file
17
boards/openmote/dist/reset.sh
vendored
Executable file
@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script resets a CC2538SF53 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 "r" >> $BINDIR/reset.seg
|
||||
echo "g" >> $BINDIR/reset.seg
|
||||
echo "exit" >> $BINDIR/reset.seg
|
||||
|
||||
# reset the board
|
||||
JLinkExe -device CC2538SF53 < $BINDIR/reset.seg
|
||||
echo ""
|
||||
92
boards/openmote/include/board.h
Normal file
92
boards/openmote/include/board.h
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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_openmote OpenMote
|
||||
* @ingroup boards
|
||||
* @brief Support for the OpenMote board
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for the OpenMote board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __BOARD_H
|
||||
#define __BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph/gpio.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name The nominal CPU core clock in this board
|
||||
*/
|
||||
#define F_CPU (32000000UL)
|
||||
|
||||
/**
|
||||
* @name Assign the peripheral timer to be used as hardware timer
|
||||
*/
|
||||
#define HW_TIMER TIMER_0
|
||||
|
||||
/**
|
||||
* @name Assign the UART interface to be used for stdio
|
||||
* @{
|
||||
*/
|
||||
#define STDIO UART_0
|
||||
#define STDIO_BAUDRATE (115200U)
|
||||
#define STDIO_RX_BUFSIZE (64U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define LED_PORT GPIO_C
|
||||
#define LED_RED_PIN (4)
|
||||
#define LED_GREEN_PIN (7)
|
||||
#define LED_YELLOW_PIN (6)
|
||||
#define LED_ORANGE_PIN (5)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs.
|
||||
* @{
|
||||
*/
|
||||
#define LED_RED_ON (LED_PORT->DATA |= (1 << LED_RED_PIN))
|
||||
#define LED_RED_OFF (LED_PORT->DATA &= ~(1 << LED_RED_PIN))
|
||||
#define LED_RED_TOGGLE (LED_PORT->DATA ^= (1 << LED_RED_PIN))
|
||||
|
||||
#define LED_GREEN_ON (LED_PORT->DATA |= (1 << LED_GREEN_PIN))
|
||||
#define LED_GREEN_OFF (LED_PORT->DATA &= ~(1 << LED_GREEN_PIN))
|
||||
#define LED_GREEN_TOGGLE (LED_PORT->DATA ^= (1 << LED_GREEN_PIN))
|
||||
|
||||
#define LED_YELLOW_ON (LED_PORT->DATA |= (1 << LED_YELLOW_PIN))
|
||||
#define LED_YELLOW_OFF (LED_PORT->DATA &= ~(1 << LED_YELLOW_PIN))
|
||||
#define LED_YELLOW_TOGGLE (LED_PORT->DATA ^= (1 << LED_YELLOW_PIN))
|
||||
|
||||
#define LED_ORANGE_ON (LED_PORT->DATA |= (1 << LED_ORANGE_PIN))
|
||||
#define LED_ORANGE_OFF (LED_PORT->DATA &= ~(1 << LED_ORANGE_PIN))
|
||||
#define LED_ORANGE_TOGGLE (LED_PORT->DATA ^= (1 << LED_ORANGE_PIN))
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /** __BOARD_H */
|
||||
/** @} */
|
||||
179
boards/openmote/include/periph_conf.h
Normal file
179
boards/openmote/include/periph_conf.h
Normal file
@ -0,0 +1,179 @@
|
||||
/*
|
||||
* 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_openmote
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral MCU configuration for the OpenMote board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef __PERIPH_CONF_H
|
||||
#define __PERIPH_CONF_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Clock system configuration
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_CORECLOCK (32000000U) /* desired core clock frequency, 32MHz */
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Timer configuration
|
||||
* @{
|
||||
*/
|
||||
#define TIMER_NUMOF (4U)
|
||||
#define TIMER_0_EN 1
|
||||
#define TIMER_1_EN 1
|
||||
#define TIMER_2_EN 1
|
||||
#define TIMER_3_EN 1
|
||||
#define TIMER_IRQ_PRIO 1
|
||||
|
||||
/* Timer 0 configuration */
|
||||
#define TIMER_0_DEV GPTIMER0
|
||||
#define TIMER_0_CHANNELS NUM_CHANNELS_PER_GPTIMER
|
||||
#define TIMER_0_MAX_VALUE 0xffffffff
|
||||
#define TIMER_0_IRQn_1 GPTIMER_0A_IRQn
|
||||
#define TIMER_0_IRQn_2 GPTIMER_0B_IRQn
|
||||
#define TIMER_0_ISR_1 isr_timer0_chan0
|
||||
#define TIMER_0_ISR_2 isr_timer0_chan1
|
||||
|
||||
/* Timer 1 configuration */
|
||||
#define TIMER_1_DEV GPTIMER1
|
||||
#define TIMER_1_CHANNELS NUM_CHANNELS_PER_GPTIMER
|
||||
#define TIMER_1_MAX_VALUE 0xffffffff
|
||||
#define TIMER_1_IRQn_1 GPTIMER_1A_IRQn
|
||||
#define TIMER_1_IRQn_2 GPTIMER_1B_IRQn
|
||||
#define TIMER_1_ISR_1 isr_timer1_chan0
|
||||
#define TIMER_1_ISR_2 isr_timer1_chan1
|
||||
|
||||
/* Timer 2 configuration */
|
||||
#define TIMER_2_DEV GPTIMER2
|
||||
#define TIMER_2_CHANNELS NUM_CHANNELS_PER_GPTIMER
|
||||
#define TIMER_2_MAX_VALUE 0xffffffff
|
||||
#define TIMER_2_IRQn_1 GPTIMER_2A_IRQn
|
||||
#define TIMER_2_IRQn_2 GPTIMER_2B_IRQn
|
||||
#define TIMER_2_ISR_1 isr_timer2_chan0
|
||||
#define TIMER_2_ISR_2 isr_timer2_chan1
|
||||
|
||||
/* Timer 3 configuration */
|
||||
#define TIMER_3_DEV GPTIMER3
|
||||
#define TIMER_3_CHANNELS NUM_CHANNELS_PER_GPTIMER
|
||||
#define TIMER_3_MAX_VALUE 0xffffffff
|
||||
#define TIMER_3_IRQn_1 GPTIMER_3A_IRQn
|
||||
#define TIMER_3_IRQn_2 GPTIMER_3B_IRQn
|
||||
#define TIMER_3_ISR_1 isr_timer3_chan0
|
||||
#define TIMER_3_ISR_2 isr_timer3_chan1
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @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 UART0
|
||||
#define UART_0_IRQ UART0_IRQn
|
||||
#define UART_0_ISR isr_uart0
|
||||
/* UART 0 pin configuration */
|
||||
#define UART_0_TX_PIN GPIO_PA1
|
||||
#define UART_0_RX_PIN GPIO_PA0
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Random Number Generator configuration
|
||||
* @{
|
||||
*/
|
||||
#define RANDOM_NUMOF 1
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name GPIO configuration
|
||||
* @{
|
||||
*/
|
||||
#define GPIO_NUMOF 12
|
||||
#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_8_EN 1
|
||||
#define GPIO_9_EN 1
|
||||
#define GPIO_10_EN 1
|
||||
#define GPIO_11_EN 1
|
||||
#define GPIO_IRQ_PRIO 1
|
||||
|
||||
/* GPIO 0 configuration */
|
||||
#define GPIO_0_PORT GPIO_A
|
||||
#define GPIO_0_PIN 0
|
||||
#define GPIO_0_OVER PA_OVER
|
||||
/* GPIO 1 configuration */
|
||||
#define GPIO_1_PORT GPIO_A
|
||||
#define GPIO_1_PIN 1
|
||||
#define GPIO_1_OVER PA_OVER
|
||||
/* GPIO 2 configuration */
|
||||
#define GPIO_2_PORT GPIO_A
|
||||
#define GPIO_2_PIN 2
|
||||
#define GPIO_2_OVER PA_OVER
|
||||
/* GPIO 3 configuration */
|
||||
#define GPIO_3_PORT GPIO_A
|
||||
#define GPIO_3_PIN 3
|
||||
#define GPIO_3_OVER PA_OVER
|
||||
/* GPIO 4 configuration */
|
||||
#define GPIO_4_PORT GPIO_A
|
||||
#define GPIO_4_PIN 4
|
||||
#define GPIO_4_OVER PA_OVER
|
||||
/* GPIO 5 configuration */
|
||||
#define GPIO_5_PORT GPIO_A
|
||||
#define GPIO_5_PIN 5
|
||||
#define GPIO_5_OVER PA_OVER
|
||||
/* GPIO 6 configuration */
|
||||
#define GPIO_6_PORT GPIO_A
|
||||
#define GPIO_6_PIN 6
|
||||
#define GPIO_6_OVER PA_OVER
|
||||
/* GPIO 7 configuration */
|
||||
#define GPIO_7_PORT GPIO_A
|
||||
#define GPIO_7_PIN 7
|
||||
#define GPIO_7_OVER PA_OVER
|
||||
/* GPIO 8 configuration */
|
||||
#define GPIO_8_PORT GPIO_B
|
||||
#define GPIO_8_PIN 0
|
||||
#define GPIO_8_OVER PB_OVER
|
||||
/* GPIO 9 configuration */
|
||||
#define GPIO_9_PORT GPIO_B
|
||||
#define GPIO_9_PIN 1
|
||||
#define GPIO_9_OVER PB_OVER
|
||||
/* GPIO 10 configuration */
|
||||
#define GPIO_10_PORT GPIO_B
|
||||
#define GPIO_10_PIN 2
|
||||
#define GPIO_10_OVER PB_OVER
|
||||
/* GPIO 11 configuration */
|
||||
#define GPIO_11_PORT GPIO_B
|
||||
#define GPIO_11_PIN 3
|
||||
#define GPIO_11_OVER PB_OVER
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* end extern "C" */
|
||||
#endif
|
||||
|
||||
#endif /* __PERIPH_CONF_H */
|
||||
/** @} */
|
||||
Loading…
x
Reference in New Issue
Block a user