1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/waspmote-pro: add support for Waspmote PRO v1.2

This commit is contained in:
kYc0o 2016-03-20 14:36:15 +01:00
parent 4d7664c357
commit 62a9773a9c
37 changed files with 933 additions and 21 deletions

View File

@ -0,0 +1,3 @@
MODULE = board
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,3 @@
#ifneq (,$(filter saul_default,$(USEMODULE)))
# USEMODULE += saul_gpio
#endif

View File

@ -0,0 +1,10 @@
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_gpio
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# Various other features (if any)
# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = avr8

View File

@ -0,0 +1,60 @@
# define the cpu used by the waspmote pro board
export CPU = atmega1281
# define tools used for building the project
export PREFIX = avr-
export CC = $(PREFIX)gcc
export CXX = $(PREFIX)c++
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 TERMFLAGS = -b 9600 -p $(PORT)
#define the flash-tool and default port depending on the host operating system
OS = $(shell uname)
ifeq ($(OS),Linux)
PORT ?= /dev/ttyACM0
FLASHER = avrdude
else ifeq ($(OS),Darwin)
PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbserial*)))
FLASHER = avrdude
else
$(info CAUTION: No flash tool for your host system found!)
# TODO: fix for building under windows
endif
# setup the boards dependencies
include $(RIOTBOARD)/$(BOARD)/Makefile.dep
export FLASHER
export PORT
export DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
export DEBUGSERVER_PORT = 4242
export DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
export DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
export DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
export DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)
# PROGRAMMER defaults to stk500v1 which is the internal flasher via USB. Can be
# overridden for debugging (which requires changes that require to use an ISP)
export PROGRAMMER ?= stk500v1
ifeq ($(PROGRAMMER), stk500v1)
export PROGRAMMER_FLAGS = -P $(PORT) -b 115200
endif
# define build specific options
export CFLAGS_CPU = -mmcu=atmega1281 $(CFLAGS_FPU)
export CFLAGS_LINK = -ffunction-sections -fdata-sections -fno-builtin -fshort-enums
export CFLAGS_DBG = -ggdb -g3
export CFLAGS_OPT ?= -Os
export CFLAGS += $(CFLAGS_CPU) $(CFLAGS_LINK) $(CFLAGS_DBG) $(CFLAGS_OPT)
export ASFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG)
export LINKFLAGS += $(CFLAGS_CPU) $(CFLAGS_DBG) $(CFLAGS_OPT) -static -lgcc -e reset_handler
export OFLAGS += -j .text -j .data -O ihex
export FFLAGS += -p m1281 -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex

114
boards/waspmote-pro/board.c Normal file
View File

@ -0,0 +1,114 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
* 2015 Kaspar Schleiser <kaspar@schleiser.de>
* 2016 INRIA, Francisco Acosta
*
* 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 boards_waspmote-pro
* @{
*
* @file
* @brief Board specific implementations for the Waspmote PRO v1.2 board
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
* @author Kaspar Schleiser <kaspar@schleiser.de>
* @author Francisco Acosta <francisco.acosta@inria.fr>
*
* @}
*/
#include <stdio.h>
#include <avr/io.h>
#include "board.h"
#include "cpu.h"
#include "uart_stdio.h"
void led_init(void);
void SystemInit(void);
static int uart_putchar(char c, FILE *stream);
static int uart_getchar(FILE *stream);
static FILE uart_stdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE);
static FILE uart_stdin = FDEV_SETUP_STREAM(NULL, uart_getchar, _FDEV_SETUP_READ);
void board_init(void)
{
/* initialize UART_1 on AUX1 */
SET_MUX_AUX1_MODULE;
#ifdef XBEE_UART
#if XBEE_UART == 0
/* initialize UART0 on SOCKET0 (XBee) */
SET_MUX_SOCKET0;
#else
/* Initialize UART0 on USB */
SET_MUX_USB_MODULE;
#endif
#endif
/* initialize stdio via UART_STDIO_DEV */
SystemInit();
/* initialize the CPU */
cpu_init();
/* initialize the boards LEDs */
led_init();
irq_enable();
}
/**
* @brief Initialize the boards on-board LEDs (green and red)
*
* 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 LEDs are connected to the following pins:
* - LED_GREEN: PC1
* - LED_RED: PD6
*/
void led_init(void)
{
LED0_ENABLE_PORT;
LED_GREEN_ON;
LED1_ENABLE_PORT;
LED_RED_ON;
}
/**
* @brief Initialize the System, initialize IO via UART_0
*/
void SystemInit(void)
{
/* initialize UART_0 for use as stdout */
uart_stdio_init();
stdout = &uart_stdout;
stdin = &uart_stdin;
/* Flush stdout */
puts("\f");
}
static int uart_putchar(char c, FILE *stream)
{
(void) stream;
uart_stdio_write(&c, 1);
return 0;
}
int uart_getchar(FILE *stream)
{
(void) stream;
char c;
uart_stdio_read(&c, 1);
return (int)c;
}

8
boards/waspmote-pro/dist/debug.sh vendored Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
sleep 2
setsid -w avarice $1 &
#sleep 2 && $2/avr-gdb-wrapper -ex "target remote localhost:$3" $4
sleep 3 && avr-gdb -ex "target remote localhost:$3" $4
# avarice exits with 1 if the connection is released, therefore we always exit with 0
exit 0

7
boards/waspmote-pro/dist/debug_srv.sh vendored Executable file
View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
sleep 2
avarice $1
# avarice exits with 1 if the connection is released, therefore we always exit with 0
exit 0

1
boards/waspmote-pro/dist/gdb.conf vendored Normal file
View File

@ -0,0 +1 @@
set $pc=0x00

View File

@ -0,0 +1,173 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
*
* 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 boards_waspmote-pro Waspmote PRO v1.2
* @ingroup boards
* @brief Board specific files for the Waspmote PRO v1.2 board.
* @{
*
* @file
* @brief Board specific definitions for the Waspmote PRO v1.2 board.
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
* @author Francisco Acosta <francisco.acosta@inria.fr>
*/
#ifndef BOARD_H_
#define BOARD_H_
#include "cpu.h"
#include "waspmote_pinmap.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief As the CPU is too slow to handle 115200 baud, we set the default
* baudrate to 9600 for this board
*/
#define UART_STDIO_BAUDRATE (9600U)
/** @} */
/**
* @brief Use the UART 0 for STDIO on this board, if the XBee socket is not
* being used
*/
#ifdef XBEE_UART
#if XBEE_UART == 0
#define UART_STDIO_DEV (UART_DEV(1))
#else
#define UART_STDIO_DEV (UART_DEV(0))
#endif
#endif
/** @} */
/**
* @name LED pin definitions
* @{
*/
#define LED0_PORT PORTD
#define LED1_PORT PORTC
#define LED0_PIN (1 << 6)
#define LED1_PIN (1 << 1)
/** @} */
/**
* @name Macros for controlling the on-board LEDs.
* @{
*/
#define LED0_ENABLE_PORT DDRD |= (1 << DDD6)
#define LED0_ON LED0_PORT |= LED0_PIN
#define LED0_OFF LED0_PORT &= ~LED0_PIN
#define LED0_TOGGLE LED0_PORT ^= LED0_PIN;
#define LED1_ENABLE_PORT DDRC |= (1 << DDC1)
#define LED1_ON LED1_PORT |= LED1_PIN
#define LED1_OFF LED1_PORT &= ~LED1_PIN
#define LED1_TOGGLE LED1_PORT ^= LED1_PIN;
/* for compatibility to other boards */
#define LED_GREEN_ON LED1_ON
#define LED_GREEN_OFF LED1_OFF
#define LED_GREEN_TOGGLE LED1_TOGGLE
#define LED_RED_ON LED0_ON
#define LED_RED_OFF LED0_OFF
#define LED_RED_TOGGLE LED0_TOGGLE
/** @} */
/**
* @name Macros for controlling the on-board MUXes.
* @{
*/
#define MUX_PW_PORT PORTD
#define MUX0_PORT PORTB
#define MUX1_PORT PORTB
#define MUX_USB_XBEE_PORT PORTD
#define MUX_PW_PIN (1 << 7)
#define MUX0_PIN (1 << 6)
#define MUX1_PIN (1 << 7)
#define MUX_USB_XBEE_PIN (1 << 5)
#define MUX_PW_ENABLE_PORT DDRD |= (1 << DDD7);
#define MUX_PW_ON MUX_PW_PORT |= MUX_PW_PIN
#define MUX_PW_OFF MUX_PW_PORT &= ~MUX_PW_PIN
#define MUX0_ENABLE_PORT DDRB |= (1 << DDB6)
#define MUX0_ON MUX0_PORT |= MUX0_PIN
#define MUX0_OFF MUX0_PORT &= ~MUX0_PIN
#define MUX1_ENABLE_PORT DDRB |= (1 << DDB7)
#define MUX1_ON MUX1_PORT |= MUX1_PIN
#define MUX1_OFF MUX1_PORT &= ~MUX1_PIN
#define MUX_USB_XBEE_ENABLE_PORT DDRD |= (1 << DDD5)
#define MUX_USB_XBEE_ON MUX_USB_XBEE_PORT |= MUX_USB_XBEE_PIN
#define MUX_USB_XBEE_OFF MUX_USB_XBEE_PORT &= ~MUX_USB_XBEE_PIN
/* Multiplexer settings to enable UART1 on the desired module
*
* --------------
* MUX0_OFF & MUX1_ON ---> GPS MODULE
* MUX0_ON & MUX1_ON ---> SOCKET1
* MUX0_ON & MUX1_OFF ---> AUX1 MODULE
* MUX0_OFF & MUX1_OFF ---> AUX2 MODULE
*
* Multiplexer setting to enable UART0 to the desired module
*
* --------------
* MUX_USB_XBEE_OFF ---> USB MODULE
* MUX_USB_XBEE_ON ---> SOCKET0
*
*/
#define SET_MUX_GPS MUX_PW_ENABLE_PORT; MUX_PW_ON; \
MUX0_ENABLE_PORT; MUX1_ENABLE_PORT; \
MUX0_OFF; MUX1_ON
#define SET_MUX_SOCKET1 MUX_PW_ENABLE_PORT; MUX_PW_ON; \
MUX0_ENABLE_PORT; MUX1_ENABLE_PORT; \
MUX0_ON; MUX1_ON
#define SET_MUX_AUX1_MODULE MUX_PW_ENABLE_PORT; MUX_PW_ON; \
MUX0_ENABLE_PORT; MUX1_ENABLE_PORT; \
MUX0_ON; MUX1_OFF
#define SET_MUX_AUX2_MODULE MUX_PW_ENABLE_PORT; MUX_PW_ON; \
MUX0_ENABLE_PORT; MUX1_ENABLE_PORT; \
MUX0_OFF; MUX1_OFF
#define SET_MUX_USB_MODULE MUX_PW_ENABLE_PORT; MUX_PW_ON; \
MUX_USB_XBEE_ENABLE_PORT; \
MUX_USB_XBEE_OFF
#define SET_MUX_SOCKET0 MUX_PW_ENABLE_PORT; MUX_PW_ON; \
MUX_USB_XBEE_ENABLE_PORT; \
MUX_USB_XBEE_ON
/** @} */
/**
* @brief xtimer configuration values
* @{
*/
#define XTIMER_MASK (0xffff0000)
#define XTIMER_SHIFT (4)
#define XTIMER_BACKOFF (40)
#define XTIMER_TICKS_INIT (921600ul)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H_ */
/** @} */

View File

@ -0,0 +1,113 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
* Copyright (C) 2016 INRIA, Francisco Acosta
*
* 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 boards_waspmote-pro
* @{
*
* @file
* @brief Peripheral MCU configuration for the Waspmote PRO v1.2 board
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
* @author Francisco Acosta <francisco.acosta@inria.fr>
*/
#ifndef PERIPH_CONF_H_
#define PERIPH_CONF_H_
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Clock configuration
* @{
*/
#define CLOCK_CORECLOCK (14745600L)
/** @} */
/**
* @brief Timer peripheral configuration
* @brief Timer configuration
* The ATmega1281 has 6 timers. Timer0 and Timer2 are 8 Bit Timers,
* Timer0 has special uses too and therefore we'll avoid using it.
*
* The timer driver only supports the four 16-bit timers (Timer1, Timer3,
* Timer4, Timer5), so those are the only ones we can use here.
*
* @{
*/
#define TIMER_NUMOF (2U)
#define TIMER_0 MEGA_TIMER1
#define TIMER_0_MASK &TIMSK1
#define TIMER_0_FLAG &TIFR1
#define TIMER_0_ISRA TIMER1_COMPA_vect
#define TIMER_0_ISRB TIMER1_COMPB_vect
#define TIMER_0_ISRC TIMER1_COMPC_vect
#define TIMER_1 MEGA_TIMER4
#define TIMER_1_MASK &TIMSK4
#define TIMER_1_FLAG &TIFR4
#define TIMER_1_ISRA TIMER4_COMPA_vect
#define TIMER_1_ISRB TIMER4_COMPB_vect
#define TIMER_1_ISRC TIMER4_COMPC_vect
/** @} */
/**
* @brief UART configuration
*
* The UART devices have fixed pin mappings, so all we need to do, is to specify
* which devices we would like to use and their corresponding RX interrupts. See
* the reference manual for the fixed pin mapping.
*
* @{
*/
#define UART_NUMOF (2U)
#define UART_0 MEGA_UART0
#define UART_0_ISR USART0_RX_vect
#define UART_1 MEGA_UART1
#define UART_1_ISR USART1_RX_vect
/*
* UART speed constants for CLK=14745600
*/
#define UART_2400 (383)
#define UART_4800 (191)
#define UART_9600 (95)
#define UART_115200 (7)
/** @} */
/**
* @brief SPI configuration
*
* The atmega1281 has only one hardware SPI with fixed pin configuration, so all
* we can do here, is to enable or disable it...
*
* The fixed pins used, are:
* MOSI - PB2 (waspmote SPI-UART socket MOSI)
* MISO - PB3 (waspmote SPI-UART socket MISO)
* SCK - PB1 (waspmote SPI-UART socket SCK)
* SS - PB0 (waspmote SD Card Chip Select) -> this pin is configured as output, but not used
*
* @{
*/
#define SPI_NUMOF 1 /* set to 0 to disable SPI */
#define SPI_0_EN 1 /* remove once SPI rework is done */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H_ */

View File

@ -0,0 +1,94 @@
/*
* Copyright (C) 2016 INRIA
*
* 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 boards_waspmote-pro
* @{
*
* @file
* @brief Mapping from MCU pins to Waspmote pins
*
* You can use the defines in this file for simplified interaction with the
* Waspmote specific pin names.
*
* @author Francisco Acosta <francisco.acosta@inria.fr>
*/
#ifndef WASPMOTE_PINMAP_H
#define WASPMOTE_PINMAP_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Mapping of MCU pins to Waspomte board pins
*
*/
/*
* DESCRIPTION WASP API PIN PORT PIN
*/
#define USB_XBEE_RX GPIO_PIN(PORT_E, 0)
#define USB_XBEE_TX GPIO_PIN(PORT_E, 1)
#define DIGITAL1 GPIO_PIN(PORT_E, 3)
#define DIGITAL0 GPIO_PIN(PORT_E, 4)
#define DIGITAL7 GPIO_PIN(PORT_C, 4)
#define DIGITAL8 GPIO_PIN(PORT_C, 5)
#define DIGITAL6 GPIO_PIN(PORT_C, 6)
#define DIGITAL5 GPIO_PIN(PORT_C, 7)
#define DIGITAL2 GPIO_PIN(PORT_A, 2)
#define DIGITAL4 GPIO_PIN(PORT_A, 3)
#define DIGITAL3 GPIO_PIN(PORT_A, 4)
#define MUX_USB_XBEE GPIO_PIN(PORT_D, 5)
#define LED0 GPIO_PIN(PORT_F, 4)
#define LED1 GPIO_PIN(PORT_C, 1)
#define ANA0 GPIO_PIN(PORT_F, 1)
#define ANA1 GPIO_PIN(PORT_F, 2)
#define ANA2 GPIO_PIN(PORT_F, 3)
#define ANA3 GPIO_PIN(PORT_F, 4)
#define ANA4 GPIO_PIN(PORT_F, 5)
#define ANA5 GPIO_PIN(PORT_F, 6)
#define ANA6 GPIO_PIN(PORT_F, 7)
#define BAT_MONITOR GPIO_PIN(PORT_F, 0)
#define XBEE_PW GPIO_PIN(PORT_A, 1)
#define MUX_PW GPIO_PIN(PORT_D, 7)
#define SENS_PW_5V GPIO_PIN(PORT_E, 5)
#define BAT_MONITOR_PW GPIO_PIN(PORT_A, 6)
#define SENS_PW_3V3 GPIO_PIN(PORT_E, 2)
#define MEM_PW GPIO_PIN(PORT_A, 5)
#define SD_PRESENT GPIO_PIN(PORT_C, 0)
#define SD_SS GPIO_PIN(PORT_B, 0)
#define SD_SCK GPIO_PIN(PORT_B, 1)
#define SD_MOSI GPIO_PIN(PORT_B, 2)
#define SD_MISO GPIO_PIN(PORT_B, 3)
#define HIB_PIN GPIO_PIN(PORT_B, 4)
#define SOCKET0_SS GPIO_PIN(PORT_B, 5)
#define GPS_PW GPIO_PIN(PORT_A, 0)
#define MUX_0 GPIO_PIN(PORT_B, 6)
#define MUX_1 GPIO_PIN(PORT_B, 7)
#define RDY_ACC GPIO_PIN(PORT_E, 6)
#define RST_RTC GPIO_PIN(PORT_E, 7)
#define I2C_SCL GPIO_PIN(PORT_D, 0)
#define I2C_SDA GPIO_PIN(PORT_D, 1)
#define GPRS_PW GPIO_PIN(PORT_C, 3)
#define MUX_RX GPIO_PIN(PORT_D, 2)
#define MUX_TX GPIO_PIN(PORT_D, 3)
#define XBEE_MON GPIO_PIN(PORT_A, 7)
#define GPRS_PIN GPIO_PIN(PORT_C, 2)
#define XBEE_SLEEP GPIO_PIN(PORT_D, 4)
#define RTC_PW GPIO_PIN(PORT_G, 2)
#define RTC_SLEEP GPIO_PIN(PORT_G, 1)
#define LOW_BAT_MON GPIO_PIN(PORT_G, 0)
/** @ */
#ifdef __cplusplus
}
#endif
#endif /* WASPMOTE_PINMAP_H */
/** @} */

5
cpu/atmega1281/Makefile Normal file
View File

@ -0,0 +1,5 @@
# define the module that is build
MODULE = cpu
# add a list of subdirectories, that should also be build
DIRS = $(ATMEGA_COMMON)
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,15 @@
# this CPU implementation is using the new core/CPU interface
export CFLAGS += -DCOREIF_NG=1
# tell the build system that the CPU depends on the atmega common files
USEMODULE += atmega_common
# define path to atmega common module, which is needed for this CPU
export ATMEGA_COMMON = $(RIOTCPU)/atmega_common/
# explicitly tell the linker to link the syscalls and startup code.
# Without this the interrupt vectors will not be linked correctly!
export UNDEF += $(BINDIR)cpu/startup.o
# CPU depends on the atmega common module, so include it
include $(ATMEGA_COMMON)Makefile.include

29
cpu/atmega1281/cpu.c Normal file
View File

@ -0,0 +1,29 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
*
* 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 cpu_atmega1281
* @{
*
* @file
* @brief Implementation of the CPU initialization
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
* @}
*/
#include "cpu.h"
/**
* @brief Initialize the CPU, set IRQ priorities
*/
void cpu_init(void)
{
/* Right now we need to do nothing here */
;
}

10
cpu/atmega1281/doc.txt Normal file
View File

@ -0,0 +1,10 @@
/**
* @defgroup cpu_atmega1281 Atmel ATmega1281
* @ingroup cpu
* @brief Implementation of Atmel's ATmega1281 MCU
*/
/**
* @defgroup cpu_atmega1281_definitions Atmel ATmega1281 Definitions
* @ingroup cpu_atmega1281
*/

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
*
* 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.
*/
/**
* @{
*
* @file
* @brief Implementation specific CPU configuration options
*
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
*/
#ifndef __CPU_CONF_H
#define __CPU_CONF_H
#include "atmega_regs_common.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Kernel configuration
*
* Since printf seems to get memory allocated by the linker/avr-libc the stack
* size tested sucessfully even with pretty small stacks.k
* @{
*/
#define THREAD_EXTRA_STACKSIZE_PRINTF (128)
#ifndef THREAD_STACKSIZE_DEFAULT
#define THREAD_STACKSIZE_DEFAULT (256)
#endif
#define THREAD_STACKSIZE_IDLE (128)
#define ISR_STACKSIZE (0)
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* __CPU_CONF_H */
/** @} */

View File

@ -0,0 +1,50 @@
/*
* Copyright (C) 2015 HAW Hamburg
* 2016 Freie Universität Berlin
* 2016 INRIA
*
* 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 cpu_atmega1281
* @{
*
* @file
* @brief CPU specific definitions for internal peripheral handling
*
* @author René Herthel <rene-herthel@outlook.de>
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
* @author Francisco Acosta <francisco.acosta@inria.fr>
*/
#ifndef PERIPH_CPU_H_
#define PERIPH_CPU_H_
#ifdef __cplusplus
extern "C" {
#endif
#include "periph_cpu_common.h"
/**
* @brief Available ports on the ATmega1281 family
*/
enum {
PORT_A = 0, /**< port A */
PORT_B = 1, /**< port B */
PORT_C = 2, /**< port C */
PORT_D = 3, /**< port D */
PORT_E = 4, /**< port E */
PORT_F = 5, /**< port F */
PORT_G = 6, /**< port G */
};
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CPU_H_ */
/** @} */

54
cpu/atmega1281/lpm_arch.c Normal file
View File

@ -0,0 +1,54 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
*
* 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 cpu_atmega1281
* @{
*
* @file
* @brief Implementation of the kernels power management interface
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
*
* @}
*/
#include "arch/lpm_arch.h"
void lpm_arch_init(void)
{
/* TODO */
}
enum lpm_mode lpm_arch_set(enum lpm_mode target)
{
(void) target;
/* TODO */
return 0;
}
enum lpm_mode lpm_arch_get(void)
{
/* TODO */
return 0;
}
void lpm_arch_awake(void)
{
/* TODO */
}
void lpm_arch_begin_awake(void)
{
/* TODO */
}
void lpm_arch_end_awake(void)
{
/* TODO */
}

View File

@ -0,0 +1,35 @@
/*
* Copyright (C) 2016 Kaspar Schleiser <kaspar@schleiser.de>
* 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
*
* 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 cpu_atmega1281
* @{
*
* @file
* @brief Implementation of the kernels reboot interface
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
* @author Kaspar Schleiser <kaspar@schleiser.de>
*
* @}
*/
#include <avr/wdt.h>
#include "cpu.h"
void reboot(void)
{
/*
* Since the AVR doesn't support a real software reset, we set the Watchdog
* Timer on a 250ms timeout. Consider this a kludge.
*/
wdt_enable(WDTO_250MS);
while(1);
}

72
cpu/atmega1281/startup.c Normal file
View File

@ -0,0 +1,72 @@
/*
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
*
* 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 cpu_atmega1281
* @{
*
* @file
* @brief Startup code and interrupt vector definition
*
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
*
* @}
*/
#include <stdint.h>
#include <avr/interrupt.h>
#include <avr/io.h>
/* For Catchall-Loop */
#include "board.h"
/**
* @brief functions for initializing the board, std-lib and kernel
*/
extern void board_init(void);
extern void kernel_init(void);
extern void __libc_init_array(void);
/**
* @brief This pair of functions hook circumvent the call to main
*
* avr-libc normally uses the .init9 section for a call to main. This call
* seems to be not replaceable without hacking inside the library. We
* circumvent the call to main by using section .init7 to call the function
* reset_handler which therefore is the real entry point and section .init8
* which should never be reached but just in case jumps to exit.
* This way there should be no way to call main directly.
*/
void init7_ovr(void) __attribute__((naked)) __attribute__((section(".init7")));
void init8_ovr(void) __attribute__((naked)) __attribute__((section(".init8")));
void init7_ovr(void)
{
asm("call reset_handler");
}
void init8_ovr(void)
{
asm("jmp exit");
}
/**
* @brief This function is the entry point after a system reset
*
* After a system reset, the following steps are necessary and carried out:
* 1. initialize the board (sync clock, setup std-IO)
* 2. initialize and start RIOTs kernel
*/
void reset_handler(void)
{
/* initialize the board and startup the kernel */
board_init();
/* startup the kernel */
kernel_init();
}

View File

@ -65,7 +65,7 @@ typedef struct {
* @{
*/
#define MEGA_TIMER1_BASE (uint16_t *)(&TCCR1A)
#if defined(__AVR_ATmega2560__)
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1281__)
#define MEGA_TIMER3_BASE (uint16_t *)(&TCCR3A)
#define MEGA_TIMER4_BASE (uint16_t *)(&TCCR4A)
#define MEGA_TIMER5_BASE (uint16_t *)(&TCCR5A)
@ -77,7 +77,7 @@ typedef struct {
* @{
*/
#define MEGA_UART0_BASE ((uint16_t *)(&UCSR0A))
#if defined(__AVR_ATmega2560__)
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1281__)
#define MEGA_UART1_BASE ((uint16_t *)(&UCSR1A))
#define MEGA_UART2_BASE ((uint16_t *)(&UCSR2A))
#define MEGA_UART3_BASE ((uint16_t *)(&UCSR3A))
@ -89,7 +89,7 @@ typedef struct {
* @{
*/
#define MEGA_TIMER1 ((mega_timer_t *)MEGA_TIMER1_BASE)
#if defined(__AVR_ATmega2560__)
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1281__)
#define MEGA_TIMER3 ((mega_timer_t *)MEGA_TIMER3_BASE)
#define MEGA_TIMER4 ((mega_timer_t *)MEGA_TIMER4_BASE)
#define MEGA_TIMER5 ((mega_timer_t *)MEGA_TIMER5_BASE)
@ -101,7 +101,7 @@ typedef struct {
* @{
*/
#define MEGA_UART0 ((mega_uart_t *)MEGA_UART0_BASE)
#if defined(__AVR_ATmega2560__)
#if defined(__AVR_ATmega2560__) || defined(__AVR_ATmega1281__)
#define MEGA_UART1 ((mega_uart_t *)MEGA_UART1_BASE)
#define MEGA_UART2 ((mega_uart_t *)MEGA_UART2_BASE)
#define MEGA_UART3 ((mega_uart_t *)MEGA_UART3_BASE)

View File

@ -25,7 +25,7 @@
* @}
*/
#if defined(MCU_ATMEGA2560)
#if defined(MCU_ATMEGA2560) || defined(MCU_ATMEGA1281)
#include <stdlib.h>
#else
#include <malloc.h>

View File

@ -2,7 +2,8 @@ APPLICATION = coap
include ../Makefile.tests_common
# msp430 and avr have problems with int width and libcoaps usage of :x notation in structs
BOARD_BLACKLIST := arduino-mega2560 chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1
BOARD_BLACKLIST := arduino-mega2560 chronos msb-430 msb-430h telosb wsn430-v1_3b \
wsn430-v1_4 z1 waspmote-pro
BOARD_INSUFFICIENT_MEMORY := chronos msb-430 msb-430h nucleo-f334 \
stm32f0discovery telosb weio wsn430-v1_3b wsn430-v1_4 z1

View File

@ -1,7 +1,7 @@
APPLICATION = driver_adt7310
include ../Makefile.tests_common
BOARD_INSUFFICIENT_MEMORY := arduino-mega2560
BOARD_INSUFFICIENT_MEMORY := arduino-mega2560 waspmote-pro
FEATURES_REQUIRED = periph_spi periph_gpio

View File

@ -1,7 +1,7 @@
APPLICATION = libfixmath_unittests
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: builds locally but breaks travis (possibly because of
# differences in the toolchain)

View File

@ -4,7 +4,7 @@ BOARD ?= iotlab-m3
RIOTBASE ?= $(CURDIR)/../..
BOARD_BLACKLIST := arduino-mega2560 msb-430h z1
BOARD_BLACKLIST := arduino-mega2560 msb-430h z1 waspmote-pro
BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-mega2560 msb-430h nrf6310 \
nucleo-f334 pca10005 stm32f0discovery weio \
yunjia-nrf51822 z1

View File

@ -1,7 +1,8 @@
APPLICATION = nhdp
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560 chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1
BOARD_BLACKLIST := arduino-mega2560 chronos msb-430 msb-430h telosb \
wsn430-v1_3b wsn430-v1_4 z1 waspmote-pro
BOARD_INSUFFICIENT_MEMORY := nucleo-f334 stm32f0discovery weio
USEMODULE += gnrc_ipv6

View File

@ -1,7 +1,7 @@
APPLICATION = pthread
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
USEMODULE += posix

View File

@ -2,7 +2,7 @@
APPLICATION = pthread_barrier
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
# exclude boards with insufficient memory

View File

@ -1,7 +1,7 @@
APPLICATION = pthread_cleanup
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
USEMODULE += pthread

View File

@ -1,7 +1,7 @@
APPLICATION = condition_variable
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
BOARD_INSUFFICIENT_MEMORY := stm32f0discovery

View File

@ -1,7 +1,7 @@
APPLICATION = pthread_cooperation
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
USEMODULE += posix

View File

@ -1,7 +1,7 @@
APPLICATION = pthread_rwlock
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
USEMODULE += pthread

View File

@ -1,7 +1,7 @@
APPLICATION = pthread_tls
include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-mega2560
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
# arduino-mega2560: unknown type name: clockid_t
USEMODULE += posix

View File

@ -5,7 +5,8 @@ BOARD_INSUFFICIENT_MEMORY := airfy-beacon cc2650stk chronos msb-430 msb-430h pca
pca10005 spark-core stm32f0discovery \
telosb wsn430-v1_3b wsn430-v1_4 z1 nucleo-f103 \
nucleo-f334 yunjia-nrf51822 samr21-xpro \
arduino-mega2560 airfy-beacon nrf51dongle nrf6310 weio nucleo-f072
arduino-mega2560 airfy-beacon nrf51dongle nrf6310 \
weio waspmote-pro nucleo-f072
USEMODULE += embunit
@ -26,7 +27,7 @@ ARM_CORTEX_M_BOARDS := airfy-beacon arduino-due cc2538dk ek-lm4f120xl f4vi1 fox
yunjia-nrf51822
DISABLE_TEST_FOR_ARM_CORTEX_M := tests-relic
AVR_BOARDS := arduino-mega2560
AVR_BOARDS := arduino-mega2560 waspmote-pro
DISABLE_TEST_FOR_AVR := tests-relic
MSP430_BOARDS := chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1

View File

@ -1,6 +1,9 @@
MODULE = tests-relic
# The following boards are known to fail or have not been tested.
BOARD_BLACKLIST := arduino-mega2560 chronos f4vi1 msb-430 msb-430h msbiot qemu-i386 redbee-econotag stm32f0discovery stm32f3discovery telosb wsn430-v1_3b wsn430-v1_4 z1
BOARD_BLACKLIST := arduino-mega2560 chronos f4vi1 msb-430 msb-430h msbiot \
qemu-i386 redbee-econotag stm32f0discovery \
stm32f3discovery telosb wsn430-v1_3b wsn430-v1_4 z1 \
waspmote-pro
include $(RIOTBASE)/Makefile.base

View File

@ -1,7 +1,7 @@
APPLICATION = xtimer_shift_on_compare
include ../Makefile.tests_common
BOARD_WHITELIST += msb-430h arduino-mega2560
BOARD_WHITELIST += msb-430h arduino-mega2560 waspmote-pro
BOARD ?= native
RIOTBASE ?= $(CURDIR)/../..