1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-24 05:53:49 +01:00

Merge pull request #12639 from aabadie/pr/boards/atmega256rfr2

boards/atmega256rfr2-xpro: initial support
This commit is contained in:
benpicco 2019-11-05 19:03:49 +01:00 committed by GitHub
commit 035bac0bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 303 additions and 3 deletions

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/atmega
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,7 @@
USEMODULE += boards_common_atmega
ifneq (,$(filter saul_default,$(USEMODULE)))
# I2C sensor available at address 0x4B
USEMODULE += at30tse75x
USEMODULE += saul_gpio
endif

View File

@ -0,0 +1,7 @@
CPU = atmega256rfr2
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

View File

@ -0,0 +1,16 @@
# configure the terminal program
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
BAUD ?= 9600
include $(RIOTMAKE)/tools/serial.inc.mk
# Use EDBG (xplainedpro) programmer with avrdude
PROGRAMMER ?= xplainedpro
# This board can be reset via avrdude
RESET ?= avrdude -c $(PROGRAMMER) -p m256rfr2
# Use edbg interface for debugging
DEBUGSERVER_INTERFACE ?= --edbg
include $(RIOTMAKE)/tools/avrdude.inc.mk
include $(RIOTBOARD)/common/atmega/Makefile.include

11
boards/atmega256rfr2-xpro/dist/debug.sh vendored Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env bash
# The setsid command is needed so that Ctrl+C in GDB doesn't kill avarice
: ${SETSID:=setsid}
sleep 2
${SETSID} -w avarice $1 &
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/atmega256rfr2-xpro/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

View File

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

View File

@ -0,0 +1,29 @@
/**
@defgroup boards_atmega256rfr2-xpro Atmega256RFR2 Xplained Pro
@ingroup boards
@brief Support for the Atmega256RFR2 Xplained Pro board
### General information
The [Atmega256RFR2 Xplained Pro](https://www.microchip.com/DevelopmentTools/ProductDetails/ATMEGA256RFR2-XPRO)
is an evaluation kit by Microchip for their ATmega256RFR2 microcontroller.
### Flash the board
You can flash the board using the on-board EDBG programmer via JTAG. Avrdude has
support for programming an AVR via EDBG with its xplainedpro programmer:
```
make BOARD=atmega256rfr2-xpro -C examples/hello-world flash
```
### Accessing STDIO via UART
STDIO can be accessed through the USB connector. The on-board UART-USB
adapter is not affected by flashing. It shows up as /dev/ttyACM0 on Linux.
It will be used automatically with `make term`:
```
make BOARD=atmega256rfr2-xpro -C examples/hello-world term
```
*/

View File

@ -0,0 +1,87 @@
/*
* Copyright (C) 2019 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Board specific definitions for the Atmega256RFR2 Xplained Pro
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "periph/gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name STDIO configuration
*
* As the CPU is too slow to handle 115200 baud, we set the default
* baudrate to 9600 for this board
* @{
*/
#define STDIO_UART_BAUDRATE (9600U)
/** @} */
/**
* @brief Use the UART 1 for STDIO on this board
*/
#define STDIO_UART_DEV (UART_DEV(1))
/**
* @name xtimer configuration values
*
* Xtimer runs at 8MHz / 64 = 125kHz
* @{
*/
#define XTIMER_DEV (0)
#define XTIMER_CHAN (0)
#define XTIMER_WIDTH (16)
#define XTIMER_HZ (125000UL)
#define XTIMER_BACKOFF (40)
/** @} */
/**
* @name Macros for controlling the on-board LED
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_B, 4)
#define LED0_MODE GPIO_OUT
#define LED0_ENABLE_PORT DDRB |= LED0_PIN
#define LED0_ON PORTB |= LED0_PIN
#define LED0_OFF PORTB &= ~LED0_PIN
#define LED0_TOGGLE PORTB ^= LED0_PIN
/** @} */
/**
* @name Button pin configuration
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_E, 4)
#define BTN0_MODE GPIO_IN_PU
/** @} */
/**
* @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,53 @@
/*
* Copyright (C) 2019 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Configuration of SAUL mapped GPIO pins
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "BTN0 (SW0)",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED,
},
{
.name = "LED0 (Yellow)",
.pin = LED0_PIN,
.mode = LED0_MODE,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2019 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Peripheral MCU configuration for the Atmega256RFR2 Xplained Pro
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Clock configuration
* @{
*/
#ifndef CLOCK_CORECLOCK
/* Using 8MHz internal oscillator as default clock source */
#define CLOCK_CORECLOCK (8000000UL)
#endif
/** @} */
#ifdef __cplusplus
}
#endif
#include "periph_conf_atmega_common.h"
#endif /* PERIPH_CONF_H */

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2019 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Board specific implementation for the Atmega256RFR2 Xplained Pro
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#include "board.h"
void led_init(void)
{
LED0_ENABLE_PORT;
LED0_OFF;
}

View File

@ -34,7 +34,7 @@ USEMODULE += ps
# include and auto-initialize all available sensors
USEMODULE += saul_default
BOARD_PROVIDES_NETIF := acd52832 airfy-beacon b-l072z-lrwan1 cc2538dk fox \
BOARD_PROVIDES_NETIF := acd52832 airfy-beacon atmega256rfr2-xpro b-l072z-lrwan1 cc2538dk fox \
hamilton iotlab-m3 iotlab-a8-m3 lobaro-lorabox lsn50 mulle microbit msba2 \
microduino-corerf native nrf51dk nrf51dongle nrf52dk nrf52840dk nrf52840-mdk nrf6310 \
nucleo-f767zi openmote-b openmote-cc2538 pba-d-01-kw2x remote-pa remote-reva \

View File

@ -2,7 +2,8 @@ FLASHER = avrdude
DIST_PATH = $(RIOTBOARD)/$(BOARD)/dist
DEBUGSERVER_PORT = 4242
DEBUGSERVER = $(DIST_PATH)/debug_srv.sh
DEBUGSERVER_FLAGS = "-g -j usb :$(DEBUGSERVER_PORT)"
DEBUGSERVER_INTERFACE ?=
DEBUGSERVER_FLAGS = "-g -j usb $(DEBUGSERVER_INTERFACE) :$(DEBUGSERVER_PORT)"
DEBUGGER_FLAGS = "-x $(RIOTBOARD)/$(BOARD)/dist/gdb.conf $(ELFFILE)"
DEBUGGER = $(DIST_PATH)/debug.sh $(DEBUGSERVER_FLAGS) $(DIST_PATH) $(DEBUGSERVER_PORT)

View File

@ -2,7 +2,8 @@ include ../Makefile.tests_common
BOARD_BLACKLIST := arduino-duemilanove arduino-leonardo \
arduino-mega2560 arduino-nano arduino-uno \
atmega328p mega-xplained microduino-corerf waspmote-pro
atmega328p atmega256rfr2-xpro mega-xplained \
microduino-corerf waspmote-pro
# arduino-mega2560: builds locally but breaks travis (possibly because of
# differences in the toolchain)
# The MSP boards don't feature round(), exp(), and log(), which are used in the unittests

View File

@ -3,6 +3,7 @@ BOARD_INSUFFICIENT_MEMORY := \
arduino-leonardo \
arduino-nano \
arduino-uno \
atmega256rfr2-xpro \
atmega328p \
chronos \
mega-xplained \

View File

@ -6,6 +6,7 @@ BOARD_BLACKLIST := arduino-duemilanove \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega256rfr2-xpro \
atmega328p \
chronos \
f4vi1 \

View File

@ -4,6 +4,7 @@ BOARD_INSUFFICIENT_MEMORY := \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega256rfr2-xpro \
atmega328p \
mega-xplained \
microduino-corerf \

View File

@ -4,6 +4,7 @@ BOARD_INSUFFICIENT_MEMORY := \
arduino-mega2560 \
arduino-nano \
arduino-uno \
atmega256rfr2-xpro \
atmega328p \
hifive1 \
hifive1b \

View File

@ -6,6 +6,7 @@ BOARD_BLACKLIST += arduino-leonardo
BOARD_BLACKLIST += arduino-mega2560
BOARD_BLACKLIST += arduino-nano
BOARD_BLACKLIST += arduino-uno
BOARD_BLACKLIST += atmega256rfr2-xpro
BOARD_BLACKLIST += atmega328p
BOARD_BLACKLIST += chronos
BOARD_BLACKLIST += mega-xplained

View File

@ -9,6 +9,7 @@ BOARD_INSUFFICIENT_MEMORY := \
arduino-mkrzero \
arduino-nano \
arduino-uno \
atmega256rfr2-xpro \
atmega328p \
arduino-zero \
b-l072z-lrwan1 \