Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Christian Mehlis
committed
Nov 2, 2014
1 parent
d28c588
commit f3b1753
Showing
12 changed files
with
769 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
MODULE =$(BOARD)_base | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
## the cpu to build for | ||
export CPU = stm32f1 | ||
export CPU_MODEL = stm32f103cb | ||
|
||
# set the default port | ||
export PORT ?= /dev/ttyUSB0 | ||
|
||
export BINFILE = $(patsubst %.elf,%.bin,$(ELFFILE)) | ||
|
||
# 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 = $(OBJCOPY) -O binary $(ELFFILE) $(BINFILE) ; dfu-util -d 1d50:607f -a 0 -s 0x08005000:leave -D "$(BINFILE)" | ||
export DEBUGGER = # spark core has no debugger | ||
export RESET = # dfu-util has no support for resetting the device | ||
|
||
# define build specific options | ||
export CPU_USAGE = -mcpu=cortex-m3 | ||
export 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 += -ggdb -g3 -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 ihex | ||
export FFLAGS = $(HEXFILE) | ||
export DEBUGGER_FLAGS = $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE) | ||
export TERMFLAGS = -p $(PORT) | ||
|
||
# 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/ -I$(RIOTBASE)/drivers/at86rf231/include -I$(RIOTBASE)/sys/net/include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
/* | ||
* 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_spark-core | ||
* @{ | ||
* | ||
* @file board.c | ||
* @brief Board specific implementations for the spark-core board | ||
* | ||
* @author Christian Mehlis <mehlis@inf.fu-berlin.de> | ||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include "board.h" | ||
#include "cpu.h" | ||
|
||
static void leds_init(void); | ||
|
||
void board_init(void) | ||
{ | ||
/* initialize the CPU */ | ||
cpu_init(); | ||
/* initialize the boards LEDs */ | ||
leds_init(); | ||
/* disable systick interrupt, set by the spark bootloader */ | ||
SysTick->CTRL = 0; | ||
/* signal to spark bootloader: do not enable IWDG! set Stop Mode Flag! */ | ||
BKP->DR9 = 0xAFFF; | ||
/* configure the RIOT vector table location to internal flash + spark bootloader offset */ | ||
SCB->VTOR = LOCATION_VTABLE; | ||
} | ||
|
||
/** | ||
* @brief Initialize the boards on-board LEDs | ||
* | ||
* The LEDs initialization is hard-coded in this function. As the LED is soldered | ||
* onto the board it is fixed to its CPU pins. | ||
* | ||
*/ | ||
static void leds_init(void) | ||
{ | ||
/* enable clock for port A */ | ||
RCC->APB2ENR |= RCC_APB2ENR_IOPAEN; | ||
|
||
/* reset pins */ | ||
LED_PORT->CRH &= ~(0xf << (4*(LED_RED_PIN - 8)) | | ||
0xf << (4*(LED_GREEN_PIN - 8)) | | ||
0xf << (4*(LED_BLUE_PIN - 8)) | | ||
0xf << (4*(LED_WHITE_PIN - 8))); | ||
|
||
/* set pins to out */ | ||
LED_PORT->CRH |= (0x3 << (4*(LED_RED_PIN - 8)) | | ||
0x3 << (4*(LED_GREEN_PIN - 8)) | | ||
0x3 << (4*(LED_BLUE_PIN - 8)) | | ||
0x3 << (4*(LED_WHITE_PIN - 8))); | ||
|
||
LED_PORT->BSRR = (1 << LED_RED_PIN) | (1 << LED_GREEN_PIN) | (1 << LED_BLUE_PIN) | (1 << LED_WHITE_PIN); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
/* | ||
* 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_spark-core Spark-Core | ||
* @ingroup boards | ||
* @brief Board specific files for the spark-core board. | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific definitions for the spark-core board. | ||
* | ||
* @author Christian Mehlis <mehlis@inf.fu-berlin.de> | ||
*/ | ||
|
||
#ifndef BOARD_H_ | ||
#define BOARD_H_ | ||
|
||
#include <stdint.h> | ||
|
||
#include "cpu.h" | ||
#include "periph_conf.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @name Define the nominal CPU core clock in this board | ||
*/ | ||
#define F_CPU CLOCK_CORECLOCK | ||
|
||
/** | ||
* @name Define the location of the RIOT image in flash | ||
*/ | ||
#define LOCATION_VTABLE (0x08005000) | ||
|
||
/** | ||
* @name Define the UART to be used as stdio and its baudrate | ||
* @{ | ||
*/ | ||
#define STDIO UART_0 | ||
#define STDIO_BAUDRATE (115200) | ||
#define STDIO_RX_BUFSIZE (64U) | ||
/** @} */ | ||
|
||
/** | ||
* @name Assign the hardware timer | ||
*/ | ||
#define HW_TIMER TIMER_0 | ||
|
||
/** | ||
* @name LED pin definitions | ||
* @{ | ||
*/ | ||
#define LED_PORT (GPIOA) | ||
#define LED_RED_PIN (9) | ||
#define LED_GREEN_PIN (10) | ||
#define LED_BLUE_PIN (8) | ||
#define LED_WHITE_PIN (13) | ||
/** @} */ | ||
|
||
/** | ||
* @name Macros for controlling the on-board LEDs. | ||
* @{ | ||
*/ | ||
#define LED_RED_ON (LED_PORT->BRR = (1<<LED_RED_PIN)) | ||
#define LED_RED_OFF (LED_PORT->BSRR = (1<<LED_RED_PIN)) | ||
#define LED_RED_TOGGLE (LED_PORT->ODR ^= (1<<LED_RED_PIN)) | ||
#define LED_GREEN_ON (LED_PORT->BRR = (1<<LED_GREEN_PIN)) | ||
#define LED_GREEN_OFF (LED_PORT->BSRR = (1<<LED_GREEN_PIN)) | ||
#define LED_GREEN_TOGGLE (LED_PORT->ODR ^= (1<<LED_GREEN_PIN)) | ||
#define LED_BLUE_ON (LED_PORT->BRR = (1<<LED_BLUE_PIN)) | ||
#define LED_BLUE_OFF (LED_PORT->BSRR = (1<<LED_BLUE_PIN)) | ||
#define LED_BLUE_TOGGLE (LED_PORT->ODR ^= (1<<LED_BLUE_PIN)) | ||
#define LED_WHITE_ON (LED_PORT->BRR = (1<<LED_WHITE_PIN)) | ||
#define LED_WHITE_OFF (LED_PORT->BSRR = (1<<LED_WHITE_PIN)) | ||
#define LED_WHITE_TOGGLE (LED_PORT->ODR ^= (1<<LED_WHITE_PIN)) | ||
/** @} */ | ||
|
||
/** | ||
* @name User button configuration | ||
*/ | ||
#define BUTTON1 GPIO_0 | ||
|
||
/** | ||
* @name CC3000 pin configuration | ||
* @{ | ||
*/ | ||
#define CC3000_SPI SPI_0 | ||
#define CC3000_CS GPIO_1 | ||
#define CC3000_EN GPIO_2 | ||
#define CC3000_INT GPIO_3 | ||
/** @} */ | ||
|
||
/** | ||
* @name EXTFLASH pin configuration | ||
* @{ | ||
*/ | ||
#define EXTFLASH_SPI SPI_0 | ||
#define EXTFLASH GPIO_4 | ||
/** @} */ | ||
|
||
/** | ||
* Define the type for the radio packet length for the transceiver | ||
*/ | ||
typedef uint8_t radio_packet_length_t; | ||
|
||
/** | ||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO | ||
*/ | ||
void board_init(void); | ||
|
||
#ifdef __cplusplus | ||
} /* end extern "C" */ | ||
#endif | ||
|
||
#endif /* BOARD_H_ */ | ||
/** @} */ |
Oops, something went wrong.