mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
Merge pull request #5451 from mali/uno
boards: add arduino uno and duemilanove support
This commit is contained in:
commit
b2b42c7b71
3
boards/arduino-common/Makefile
Normal file
3
boards/arduino-common/Makefile
Normal file
@ -0,0 +1,3 @@
|
||||
MODULE = arduino-common
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
10
boards/arduino-common/Makefile.features
Normal file
10
boards/arduino-common/Makefile.features
Normal 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
|
44
boards/arduino-common/Makefile.include
Normal file
44
boards/arduino-common/Makefile.include
Normal file
@ -0,0 +1,44 @@
|
||||
# define the cpu used by the arduino uno and duemilanove boards
|
||||
export CPU = atmega328p
|
||||
|
||||
# define port used to flash the board
|
||||
OS = $(shell uname)
|
||||
ifeq ($(OS),Linux)
|
||||
PORT = $(LINUX_PORT)
|
||||
else ifeq ($(OS),Darwin)
|
||||
PORT ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||
else
|
||||
$(info CAUTION: No flash tool for your host system found!)
|
||||
# TODO: fix for building under windows
|
||||
endif
|
||||
|
||||
export TERMPROG = $(RIOTBASE)/dist/tools/pyterm/pyterm
|
||||
export TERMFLAGS = -b 9600 -p $(PORT)
|
||||
export FLASHER = avrdude
|
||||
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 arduino which is the internal flasher via USB. Can be
|
||||
# overridden for debugging (which requires changes that require to use an ISP)
|
||||
export PROGRAMMER ?= arduino
|
||||
|
||||
ifeq ($(PROGRAMMER), arduino)
|
||||
export PROGRAMMER_FLAGS = -P $(PORT) -b $(PROGRAMMER_SPEED)
|
||||
endif
|
||||
|
||||
# define build specific options
|
||||
export CFLAGS_CPU = -mmcu=atmega328p $(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 atmega328p -c $(PROGRAMMER) $(PROGRAMMER_FLAGS) -F -D -U flash:w:bin/$(BOARD)/$(PROJECT)$(APPLICATION).hex
|
84
boards/arduino-common/board.c
Normal file
84
boards/arduino-common/board.c
Normal file
@ -0,0 +1,84 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
||||
* 2015 Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* 2016 Laurent Navet <laurent.navet@gmail.com>
|
||||
*
|
||||
* 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_arduino-common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations for the arduino Uno
|
||||
* @brief and Duemilanove boards.
|
||||
*
|
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
||||
* @author Kaspar Schleiser <kaspar@schleiser.de>
|
||||
* @author Laurent Navet <laurent.navet@gmail.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#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 stdio via USART_0 */
|
||||
SystemInit();
|
||||
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
||||
/* initialize the board LED (connected to pin PB5) */
|
||||
DDRB |= (1 << DDB5);
|
||||
PORTB &= ~(1 << 5);
|
||||
|
||||
irq_enable();
|
||||
}
|
||||
|
||||
/**
|
||||
* @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/arduino-common/dist/debug.sh
vendored
Executable file
8
boards/arduino-common/dist/debug.sh
vendored
Executable 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/arduino-common/dist/debug_srv.sh
vendored
Executable file
7
boards/arduino-common/dist/debug_srv.sh
vendored
Executable 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/arduino-common/dist/gdb.conf
vendored
Normal file
1
boards/arduino-common/dist/gdb.conf
vendored
Normal file
@ -0,0 +1 @@
|
||||
set $pc=0x00
|
65
boards/arduino-common/include/arduino_board.h
Normal file
65
boards/arduino-common/include/arduino_board.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*
|
||||
* Copyright (C) 2016 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 boards_arduino-common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration for the Arduino API
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Laurent Navet <laurent.navet@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef ARDUINO_BOARD_H
|
||||
#define ARDUINO_BOARD_H
|
||||
|
||||
#include "arduino_pinmap.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The on-board LED is connected to pin 13 on this board
|
||||
*/
|
||||
#define ARDUINO_LED (13)
|
||||
|
||||
/**
|
||||
* @brief Look-up table for the Arduino's digital pins
|
||||
*/
|
||||
static const gpio_t arduino_pinmap[] = {
|
||||
ARDUINO_PIN_0,
|
||||
ARDUINO_PIN_1,
|
||||
ARDUINO_PIN_2,
|
||||
ARDUINO_PIN_3,
|
||||
ARDUINO_PIN_4,
|
||||
ARDUINO_PIN_5,
|
||||
ARDUINO_PIN_6,
|
||||
ARDUINO_PIN_7,
|
||||
ARDUINO_PIN_8,
|
||||
ARDUINO_PIN_9,
|
||||
ARDUINO_PIN_10,
|
||||
ARDUINO_PIN_11,
|
||||
ARDUINO_PIN_12,
|
||||
ARDUINO_PIN_13,
|
||||
ARDUINO_PIN_14,
|
||||
ARDUINO_PIN_15,
|
||||
ARDUINO_PIN_16,
|
||||
ARDUINO_PIN_17,
|
||||
ARDUINO_PIN_18,
|
||||
ARDUINO_PIN_19
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARDUINO_BOARD_H */
|
||||
/** @} */
|
74
boards/arduino-common/include/arduino_pinmap.h
Normal file
74
boards/arduino-common/include/arduino_pinmap.h
Normal file
@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Copyright (C) 2015 Freie Universität Berlin
|
||||
* 2016 Laurent Navet <laurent.navet@gmail.com>
|
||||
*
|
||||
* 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_arduino-common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Mapping from MCU pins to Arduino pins
|
||||
*
|
||||
* You can use the defines in this file for simplified interaction with the
|
||||
* Arduino specific pin numbers.
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Daniel Nordahl <nordahl.d@gmail.com>
|
||||
* @author Laurent Navet <laurent.navet@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef ARDUINO_PINMAP_H
|
||||
#define ARDUINO_PINMAP_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Mapping of MCU pins to Arduino pins
|
||||
*
|
||||
* @note ISCP pins are not mapped.
|
||||
*/
|
||||
|
||||
/* Digital pins */
|
||||
#define ARDUINO_PIN_0 GPIO_PIN(PORT_D, 0)
|
||||
#define ARDUINO_PIN_1 GPIO_PIN(PORT_D, 1)
|
||||
#define ARDUINO_PIN_2 GPIO_PIN(PORT_D, 2)
|
||||
#define ARDUINO_PIN_3 GPIO_PIN(PORT_D, 3)
|
||||
#define ARDUINO_PIN_4 GPIO_PIN(PORT_D, 4)
|
||||
#define ARDUINO_PIN_5 GPIO_PIN(PORT_D, 5)
|
||||
#define ARDUINO_PIN_6 GPIO_PIN(PORT_D, 6)
|
||||
#define ARDUINO_PIN_7 GPIO_PIN(PORT_D, 7)
|
||||
#define ARDUINO_PIN_8 GPIO_PIN(PORT_B, 0)
|
||||
#define ARDUINO_PIN_9 GPIO_PIN(PORT_B, 1)
|
||||
#define ARDUINO_PIN_10 GPIO_PIN(PORT_B, 2)
|
||||
#define ARDUINO_PIN_11 GPIO_PIN(PORT_B, 3)
|
||||
#define ARDUINO_PIN_12 GPIO_PIN(PORT_B, 4)
|
||||
#define ARDUINO_PIN_13 GPIO_PIN(PORT_B, 5)
|
||||
/* Analog pins */
|
||||
#define ARDUINO_PIN_14 GPIO_PIN(PORT_C, 0)
|
||||
#define ARDUINO_PIN_15 GPIO_PIN(PORT_C, 1)
|
||||
#define ARDUINO_PIN_16 GPIO_PIN(PORT_C, 2)
|
||||
#define ARDUINO_PIN_17 GPIO_PIN(PORT_C, 3)
|
||||
#define ARDUINO_PIN_18 GPIO_PIN(PORT_C, 4)
|
||||
#define ARDUINO_PIN_19 GPIO_PIN(PORT_C, 5)
|
||||
/* Analog input */
|
||||
#define ARDUINO_PIN_A0 ARDUINO_PIN_14
|
||||
#define ARDUINO_PIN_A1 ARDUINO_PIN_15
|
||||
#define ARDUINO_PIN_A2 ARDUINO_PIN_16
|
||||
#define ARDUINO_PIN_A3 ARDUINO_PIN_17
|
||||
#define ARDUINO_PIN_A4 ARDUINO_PIN_18
|
||||
#define ARDUINO_PIN_A5 ARDUINO_PIN_19
|
||||
/** @ */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* ARDUINO_PINMAP_H */
|
||||
/** @} */
|
89
boards/arduino-common/include/board.h
Normal file
89
boards/arduino-common/include/board.h
Normal file
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
||||
* 2016 Laurent Navet <laurent.navet@gmail.com>
|
||||
*
|
||||
* 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_arduino-common Arduino common
|
||||
* @ingroup boards
|
||||
* @brief Board specific files for the arduino Uno and
|
||||
* @brief Duemilanove boards.
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for the arduino Uno and
|
||||
* @brief Duemilanove boards.
|
||||
*
|
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
||||
* @author Laurent Navet <laurent.navet@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H_
|
||||
#define BOARD_H_
|
||||
|
||||
#include "cpu.h"
|
||||
#include "arduino_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 LED pin definitions and handlers
|
||||
* @{
|
||||
*/
|
||||
#define LED0_PIN GPIO_PIN(1, 5)
|
||||
|
||||
#define LED0_MASK (1 << DDB5)
|
||||
|
||||
#define LED0_ON (PORTB |= LED0_MASK)
|
||||
#define LED0_OFF (PORTB &= ~LED0_MASK)
|
||||
#define LED0_TOGGLE (PORTB ^= LED0_MASK)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
** Context swap defines
|
||||
** Setup to use PJ6 which is pin change interrupt 15 (PCINT15)
|
||||
** This emulates a software triggered interrupt
|
||||
***/
|
||||
#define AVR_CONTEXT_SWAP_INIT do { \
|
||||
DDRC |= (1 << PC6); \
|
||||
PCICR |= (1 << PCIE1); \
|
||||
PCMSK1 |= (1 << PCINT14); \
|
||||
} while (0)
|
||||
#define AVR_CONTEXT_SWAP_INTERRUPT_VECT PCINT1_vect
|
||||
#define AVR_CONTEXT_SWAP_TRIGGER PORTC ^= (1 << PC6)
|
||||
|
||||
|
||||
/**
|
||||
* @brief xtimer configuration values
|
||||
* @{
|
||||
*/
|
||||
#define XTIMER_WIDTH (16)
|
||||
#define XTIMER_SHIFT (2)
|
||||
#define XTIMER_BACKOFF (40)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H_ */
|
||||
/** @} */
|
90
boards/arduino-common/include/periph_conf.h
Normal file
90
boards/arduino-common/include/periph_conf.h
Normal file
@ -0,0 +1,90 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
||||
* 2016 Laurent Navet <laurent.navet@gmail.com>
|
||||
*
|
||||
* 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_arduino-common
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Peripheral MCU configuration for the arduino Uno and
|
||||
* @brief Dumilanove boards.
|
||||
*
|
||||
* @author Hinnerk van Bruinehsen <h.v.bruinehsen@fu-berlin.de>
|
||||
* @author Laurent Navet <laurent.navet@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H_
|
||||
#define PERIPH_CONF_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Clock configuration
|
||||
* @{
|
||||
*/
|
||||
#define CLOCK_CORECLOCK (16000000L)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Timer configuration
|
||||
*
|
||||
* The timer driver only supports the 16-bit timer (Timer1)
|
||||
* so this is the only one 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
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief UART configuration
|
||||
*
|
||||
* Uno has only one UART, look in atmega_common
|
||||
* This is where magic happens
|
||||
*
|
||||
* @{
|
||||
*/
|
||||
#define UART_NUMOF (1U)
|
||||
|
||||
#define UART_0 MEGA_UART0
|
||||
#define UART_0_ISR USART_RX_vect
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief SPI configuration
|
||||
*
|
||||
* The atmega2560 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 - PB3 (Arduino pin 11)
|
||||
* MISO - PB4 (Arduino pin 12)
|
||||
* SCK - PB5 (Arduino pin 13)
|
||||
* SS - PB2 (Arduino pin 10) -> 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 */
|
||||
#define MEGA_PRR PRR /* Power Reduction Register is PRR */
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H_ */
|
5
boards/arduino-duemilanove/Makefile
Normal file
5
boards/arduino-duemilanove/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
MODULE = board
|
||||
|
||||
DIRS = $(RIOTBOARD)/arduino-common
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
1
boards/arduino-duemilanove/Makefile.features
Normal file
1
boards/arduino-duemilanove/Makefile.features
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTBOARD)/arduino-common/Makefile.features
|
10
boards/arduino-duemilanove/Makefile.include
Normal file
10
boards/arduino-duemilanove/Makefile.include
Normal file
@ -0,0 +1,10 @@
|
||||
USEMODULE += arduino-common
|
||||
|
||||
# add arduino-common include path
|
||||
INCLUDES += -I$(RIOTBOARD)/arduino-common/include
|
||||
|
||||
#export needed for flash rule
|
||||
export LINUX_PORT = /dev/ttyUSB0
|
||||
export PROGRAMMER_SPEED = 57600
|
||||
|
||||
include $(RIOTBOARD)/arduino-common/Makefile.include
|
5
boards/arduino-uno/Makefile
Normal file
5
boards/arduino-uno/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
MODULE = board
|
||||
|
||||
DIRS = $(RIOTBOARD)/arduino-common
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
1
boards/arduino-uno/Makefile.features
Normal file
1
boards/arduino-uno/Makefile.features
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTBOARD)/arduino-common/Makefile.features
|
10
boards/arduino-uno/Makefile.include
Normal file
10
boards/arduino-uno/Makefile.include
Normal file
@ -0,0 +1,10 @@
|
||||
USEMODULE += arduino-common
|
||||
|
||||
# add arduino-common include path
|
||||
INCLUDES += -I$(RIOTBOARD)/arduino-common/include
|
||||
|
||||
# export needed for flash rule
|
||||
export LINUX_PORT = /dev/ttyACM0
|
||||
export PROGRAMMER_SPEED = 115200
|
||||
|
||||
include $(RIOTBOARD)/arduino-common/Makefile.include
|
6
cpu/atmega328p/Makefile
Normal file
6
cpu/atmega328p/Makefile
Normal file
@ -0,0 +1,6 @@
|
||||
# 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
|
11
cpu/atmega328p/Makefile.include
Normal file
11
cpu/atmega328p/Makefile.include
Normal file
@ -0,0 +1,11 @@
|
||||
# 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/
|
||||
|
||||
# CPU depends on the atmega common module, so include it
|
||||
include $(ATMEGA_COMMON)Makefile.include
|
29
cpu/atmega328p/cpu.c
Normal file
29
cpu/atmega328p/cpu.c
Normal 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_atmega328p
|
||||
* @{
|
||||
*
|
||||
* @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/atmega328p/doc.txt
Normal file
10
cpu/atmega328p/doc.txt
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @defgroup cpu_atmega328p Atmel ATmega328p
|
||||
* @ingroup cpu
|
||||
* @brief Implementation of Atmel's ATmega328p MCU
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup cpu_atmega328p_definitions Atmel ATmega328p Definitions
|
||||
* @ingroup cpu_atmega328p
|
||||
*/
|
51
cpu/atmega328p/include/cpu_conf.h
Normal file
51
cpu/atmega328p/include/cpu_conf.h
Normal file
@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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_atmega328p
|
||||
* @{
|
||||
*
|
||||
* @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 */
|
||||
/** @} */
|
49
cpu/atmega328p/include/periph_cpu.h
Normal file
49
cpu/atmega328p/include/periph_cpu.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2015 HAW Hamburg
|
||||
* 2016 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 cpu_atmega328p
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief CPU specific definitions for internal peripheral handling
|
||||
*
|
||||
* @author René Herthel <rene-herthel@outlook.de>
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CPU_H_
|
||||
#define PERIPH_CPU_H_
|
||||
|
||||
#include "periph_cpu_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Define a CPU specific GPIO pin generator macro
|
||||
*/
|
||||
#define GPIO_PIN(x, y) ((x << 4) | y)
|
||||
|
||||
/**
|
||||
* @brief Available ports on the ATmega328p family
|
||||
*/
|
||||
enum {
|
||||
PORT_B = 1, /**< port B */
|
||||
PORT_C = 2, /**< port C */
|
||||
PORT_D = 3 /**< port D */
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CPU_H_ */
|
||||
/** @} */
|
54
cpu/atmega328p/lpm_arch.c
Normal file
54
cpu/atmega328p/lpm_arch.c
Normal 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_atmega328p
|
||||
* @{
|
||||
*
|
||||
* @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 */
|
||||
}
|
35
cpu/atmega328p/reboot_arch.c
Normal file
35
cpu/atmega328p/reboot_arch.c
Normal 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_atmega328p
|
||||
* @{
|
||||
*
|
||||
* @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/atmega328p/startup.c
Normal file
72
cpu/atmega328p/startup.c
Normal 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_atmega328p
|
||||
* @{
|
||||
*
|
||||
* @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();
|
||||
}
|
@ -25,7 +25,7 @@
|
||||
* @}
|
||||
*/
|
||||
|
||||
#if defined(MCU_ATMEGA2560) || defined(MCU_ATMEGA1281)
|
||||
#if defined(MCU_ATMEGA2560) || defined(MCU_ATMEGA1281) || defined(MCU_ATMEGA328P)
|
||||
#include <stdlib.h>
|
||||
#else
|
||||
#include <malloc.h>
|
||||
|
@ -3,7 +3,7 @@ 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 waspmote-pro
|
||||
wsn430-v1_4 z1 waspmote-pro arduino-uno arduino-duemilanove
|
||||
BOARD_INSUFFICIENT_MEMORY := chronos msb-430 msb-430h nucleo-f334 \
|
||||
stm32f0discovery telosb weio wsn430-v1_3b wsn430-v1_4 z1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
APPLICATION = libfixmath_unittests
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino-mega2560: builds locally but breaks travis (possibly because of
|
||||
# differences in the toolchain)
|
||||
|
||||
|
@ -4,7 +4,8 @@ BOARD ?= iotlab-m3
|
||||
|
||||
RIOTBASE ?= $(CURDIR)/../..
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 msb-430h telosb waspmote-pro z1
|
||||
BOARD_BLACKLIST := arduino-mega2560 msb-430h telosb waspmote-pro z1 arduino-uno \
|
||||
arduino-duemilanove
|
||||
BOARD_INSUFFICIENT_MEMORY := airfy-beacon arduino-mega2560 msb-430h nrf6310 \
|
||||
nucleo-f334 pca10005 stm32f0discovery telosb \
|
||||
weio yunjia-nrf51822 z1
|
||||
|
@ -2,7 +2,8 @@ APPLICATION = nhdp
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 chronos msb-430 msb-430h telosb \
|
||||
wsn430-v1_3b wsn430-v1_4 z1 waspmote-pro
|
||||
wsn430-v1_3b wsn430-v1_4 z1 waspmote-pro arduino-uno \
|
||||
arduino-duemilanove
|
||||
BOARD_INSUFFICIENT_MEMORY := nucleo-f334 stm32f0discovery weio
|
||||
|
||||
USEMODULE += gnrc_ipv6
|
||||
|
@ -1,8 +1,8 @@
|
||||
APPLICATION = pthread
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove : unknown type name: clockid_t
|
||||
|
||||
USEMODULE += posix
|
||||
USEMODULE += pthread
|
||||
|
@ -2,8 +2,8 @@
|
||||
APPLICATION = pthread_barrier
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove: unknown type name: clockid_t
|
||||
|
||||
# exclude boards with insufficient memory
|
||||
BOARD_INSUFFICIENT_MEMORY := stm32f0discovery
|
||||
|
@ -1,8 +1,8 @@
|
||||
APPLICATION = pthread_cleanup
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove : unknown type name: clockid_t
|
||||
|
||||
USEMODULE += pthread
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
APPLICATION = condition_variable
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove: unknown type name: clockid_t
|
||||
|
||||
BOARD_INSUFFICIENT_MEMORY := stm32f0discovery
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
APPLICATION = pthread_cooperation
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove: unknown type name: clockid_t
|
||||
|
||||
USEMODULE += posix
|
||||
USEMODULE += pthread
|
||||
|
@ -1,8 +1,8 @@
|
||||
APPLICATION = pthread_rwlock
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove: unknown type name: clockid_t
|
||||
|
||||
USEMODULE += pthread
|
||||
USEMODULE += xtimer
|
||||
|
@ -1,8 +1,8 @@
|
||||
APPLICATION = pthread_tls
|
||||
include ../Makefile.tests_common
|
||||
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro
|
||||
# arduino-mega2560: unknown type name: clockid_t
|
||||
BOARD_BLACKLIST := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
# arduino mega2560 uno duemilanove: unknown type name: clockid_t
|
||||
|
||||
USEMODULE += posix
|
||||
USEMODULE += pthread
|
||||
|
@ -6,7 +6,8 @@ BOARD_INSUFFICIENT_MEMORY := airfy-beacon cc2650stk chronos msb-430 msb-430h pca
|
||||
telosb wsn430-v1_3b wsn430-v1_4 z1 nucleo-f103 \
|
||||
nucleo-f334 yunjia-nrf51822 samr21-xpro \
|
||||
arduino-mega2560 airfy-beacon nrf51dongle nrf6310 \
|
||||
weio waspmote-pro nucleo-f072
|
||||
weio waspmote-pro nucleo-f072 arduino-uno \
|
||||
arduino-duemilanove
|
||||
|
||||
USEMODULE += embunit
|
||||
|
||||
@ -27,7 +28,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 waspmote-pro
|
||||
AVR_BOARDS := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
|
||||
DISABLE_TEST_FOR_AVR := tests-relic
|
||||
|
||||
MSP430_BOARDS := chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1
|
||||
|
Loading…
Reference in New Issue
Block a user