Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
samr21-xpro: initial import for the samr21-xpro board
- Loading branch information
1 parent
408eb3d
commit bf256f6
Showing
92 changed files
with
24,569 additions
and
8 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,5 @@ | ||
# tell the Makefile.base which module to build | ||
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,39 @@ | ||
# define the cpu used by the arduino due board | ||
export CPU = samd21 | ||
export CPU_MODEL = samr21g18a | ||
|
||
# set the default port | ||
export PORT ?= /dev/ttyACM0 | ||
|
||
# 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 -p | ||
export FLASHER = $(RIOTBOARD)/$(BOARD)/dist/flash.sh | ||
export DEBUGGER = $(RIOTBOARD)/$(BOARD)/dist/debug.sh | ||
|
||
# define build specific options | ||
export CPU_USAGE = -mcpu=cortex-m0plus | ||
FPU_USAGE = | ||
export CFLAGS += -ggdb -g3 -std=gnu99 -O0 -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 specified in cpu/Makefile.include | ||
export LINKFLAGS += -T$(LINKERSCRIPT) | ||
export OFLAGS += -O binary | ||
export FFLAGS += $(HEXFILE) | ||
export TERMFLAGS += "$(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 |
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,53 @@ | ||
/* | ||
* 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_samr21-xpro | ||
* @{ | ||
* | ||
* @file board.c | ||
* @brief Board specific implementations for the Atem SAM R21 Xplained Pro board | ||
* | ||
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> | ||
* | ||
* @} | ||
*/ | ||
|
||
#include <stdio.h> | ||
|
||
#include "board.h" | ||
#include "cpu.h" | ||
|
||
|
||
void led_init(void); | ||
|
||
|
||
void board_init(void) | ||
{ | ||
/* initialize the CPU */ | ||
cpu_init(); | ||
|
||
/* initialize the boards LEDs */ | ||
led_init(); | ||
} | ||
|
||
|
||
/** | ||
* @brief Initialize the boards on-board LED | ||
* | ||
* The LED initialization is hard-coded in this function. As the LED is soldered | ||
* onto the board it is fixed to its CPU pins. | ||
* | ||
* The LED is connected to the following pin: | ||
* - LED: PA19 | ||
*/ | ||
void led_init(void) | ||
{ | ||
LED_PORT.DIRSET.reg = LED_PIN; | ||
LED_PORT.OUTSET.reg = LED_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,8 @@ | ||
#!/bin/bash | ||
|
||
openocd -f "board/atmel_samr21_xplained_pro.cfg" \ | ||
-c "tcl_port 6333" \ | ||
-c "telnet_port 4444" \ | ||
-c "init" \ | ||
-c "targets" \ | ||
-c "reset halt" |
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,11 @@ | ||
#!/bin/bash | ||
|
||
openocd -f "board/atmel_samr21_xplained_pro.cfg" \ | ||
-c "init" \ | ||
-c "targets" \ | ||
-c "reset halt" \ | ||
-c "reset init" \ | ||
-c "flash write_image erase $1" \ | ||
-c "verify_image $1" \ | ||
-c "reset run" \ | ||
-c "shutdown" |
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,79 @@ | ||
/* | ||
* 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_samr21-xpro Atmel SAM R21 Xplained Pro | ||
* @ingroup boards | ||
* @brief Support for the Atmel SAM R21 Xplained Pro board. | ||
* @{ | ||
* | ||
* @file board.h | ||
* @brief Board specific definitions for the Atmel SAM R21 Xplained Pro board. | ||
* | ||
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> | ||
*/ | ||
|
||
#ifndef __BOARD_H | ||
#define __BOARD_H | ||
|
||
#include "cpu.h" | ||
|
||
/** | ||
* Define the nominal CPU core clock in this board | ||
*/ | ||
#define F_CPU (48000000UL) | ||
|
||
/** | ||
* Assign the hardware timer | ||
*/ | ||
#define HW_TIMER TIMER_0 | ||
|
||
/** | ||
* @name Define UART device and baudrate for stdio | ||
* @{ | ||
*/ | ||
#define STDIO UART_0 | ||
#define STDIO_BAUDRATE (115200U) | ||
#define STDIO_BUFSIZE (64U) | ||
/** @} */ | ||
|
||
/** | ||
* @name LED pin definitions | ||
* @{ | ||
*/ | ||
#define LED_PORT PORT->Group[0] | ||
#define LED_PIN PORT_PA19 | ||
/** @} */ | ||
|
||
/** | ||
* @name Macros for controlling the on-board LEDs. | ||
* @{ | ||
*/ | ||
#define LED_ON (LED_PORT.OUTCLR.reg = LED_PIN) | ||
#define LED_OFF (LED_PORT.OUTSET.reg = LED_PIN) | ||
#define LED_TOGGLE (LED_PORT.OUTTGL.reg = LED_PIN) | ||
|
||
/* for compatability to other boards */ | ||
#define LED_GREEN_ON /* not available */ | ||
#define LED_GREEN_OFF /* not available */ | ||
#define LED_GREEN_TOGGLE /* not available */ | ||
#define LED_ORANGE_ON /* not available */ | ||
#define LED_ORANGE_OFF /* not available */ | ||
#define LED_ORANGE_TOGGLE /* not available */ | ||
#define LED_RED_ON LED_ON | ||
#define LED_RED_OFF LED_OFF | ||
#define LED_RED_TOGGLE LED_TOGGLE | ||
/** @} */ | ||
|
||
/** | ||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO | ||
*/ | ||
void board_init(void); | ||
|
||
#endif /** __BOARD_H */ | ||
/** @} */ |
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,120 @@ | ||
/* | ||
* 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_samr21-xpro | ||
* @{ | ||
* | ||
* @file periph_conf.h | ||
* @brief Peripheral MCU configuration for the Atmel SAM R21 Xplained Pro board | ||
* | ||
* @author Thomas Eichinger <thomas.eichinger@fu-berlin.de> | ||
*/ | ||
|
||
#ifndef __PERIPH_CONF_H | ||
#define __PERIPH_CONF_H | ||
|
||
/** | ||
* @name Timer peripheral configuration | ||
* @{ | ||
*/ | ||
#define TIMER_NUMOF (3U) | ||
#define TIMER_0_EN 1 | ||
#define TIMER_1_EN 1 | ||
#define TIMER_2_EN 1 | ||
|
||
/* Timer 0 configuration */ | ||
#define TIMER_0_DEV TC3->COUNT16 | ||
#define TIMER_0_CHANNELS 2 | ||
#define TIMER_0_MAX_VALUE (0xffff) | ||
#define TIMER_0_ISR isr_tc3 | ||
|
||
/* Timer 1 configuration */ | ||
#define TIMER_1_DEV TC4->COUNT16 | ||
#define TIMER_1_CHANNELS 2 | ||
#define TIMER_1_MAX_VALUE (0xffff) | ||
#define TIMER_1_ISR isr_tc4 | ||
|
||
/* Timer 2 configuration */ | ||
#define TIMER_2_DEV TC5->COUNT16 | ||
#define TIMER_2_CHANNELS 2 | ||
#define TIMER_2_MAX_VALUE (0xffff) | ||
#define TIMER_2_ISR isr_tc5 | ||
/** @} */ | ||
|
||
|
||
/** | ||
* @name UART configuration | ||
* @{ | ||
*/ | ||
#define UART_NUMOF (1U) | ||
#define UART_0_EN 1 | ||
#define UART_1_EN 0 | ||
#define UART_2_EN 0 | ||
#define UART_3_EN 0 | ||
#define UART_IRQ_PRIO 1 | ||
|
||
/* UART 0 device configuration */ | ||
#define UART_0_DEV SERCOM0->USART | ||
#define UART_0_IRQ SERCOM0_IRQn | ||
#define UART_0_ISR isr_sercom0 | ||
/* UART 0 pin configuration */ | ||
#define UART_0_PORT (PORT->Group[0]) | ||
#define UART_0_TX_PIN PIN_PA04 | ||
#define UART_0_RX_PIN PIN_PA05 | ||
#define UART_0_PINS (PORT_PA04 | PORT_PA05) | ||
#define UART_0_REF_F (8000000UL) | ||
|
||
|
||
/* UART 1 device configuration */ | ||
#define UART_1_DEV | ||
#define UART_1_IRQ | ||
#define UART_1_ISR | ||
/* UART 1 pin configuration */ | ||
#define UART_1_PORT | ||
#define UART_1_PINS | ||
/** @} */ | ||
|
||
/** | ||
* @name Random Number Generator configuration | ||
* @{ | ||
*/ | ||
#define RANDOM_NUMOF (0U) | ||
/** @} */ | ||
|
||
/** | ||
* @name GPIO configuration | ||
* @{ | ||
*/ | ||
#define GPIO_NUMOF (4U) | ||
#define GPIO_0_EN 1 | ||
#define GPIO_1_EN 1 | ||
#define GPIO_2_EN 1 | ||
#define GPIO_3_EN 1 | ||
|
||
/* GPIO channel 0 config */ | ||
#define GPIO_0_DEV PORT->Group[0] | ||
#define GPIO_0_PIN PIN_PA13 | ||
#define GPIO_0_EXTINT 13 | ||
/* GPIO channel 1 config */ | ||
/* SW0 Button, configure w/ GPIO_PULLUP and GPIO_FALLING */ | ||
#define GPIO_1_DEV PORT->Group[0] | ||
#define GPIO_1_PIN PIN_PA28 | ||
#define GPIO_1_EXTINT 8 | ||
/* GPIO channel 2 config */ | ||
#define GPIO_2_DEV PORT->Group[0] | ||
#define GPIO_2_PIN PIN_PA15 | ||
#define GPIO_2_EXTINT 15 | ||
/* GPIO channel 3 config */ | ||
#define GPIO_3_DEV PORT->Group[0] | ||
#define GPIO_3_PIN PIN_PA19 | ||
#define GPIO_3_EXTINT 3 | ||
/** @} */ | ||
|
||
#endif /* __PERIPH_CONF_H */ | ||
/** @} */ |
Oops, something went wrong.