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

boards/common: Introduce Atmel xmega common

Add atxmega common board definitions.  This works is a port from @josar
with few modifications.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This commit is contained in:
Gerson Fernando Budke 2021-01-11 20:18:40 -03:00
parent 1d55c85f24
commit 85fcba0ce9
6 changed files with 185 additions and 0 deletions

View File

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

View File

@ -0,0 +1 @@
CPU = atxmega

View File

@ -0,0 +1,38 @@
INCLUDES += -I$(RIOTBOARD)/common/atxmega/include
# Use JTAG as default protocol for debugging
DEBUGPROTO ?= -x
FLASHFILE ?= $(ELFFILE)
# Use avrdude programmer with Atmel ICE as default flash/debug system
PROGRAMMER ?= avrdude
AVRDUDE_PROGRAMMER ?= atmelice
ifneq (,$(filter flash%,$(MAKECMDGOALS)))
FFLAGS_EXTRA ?= -e
endif
# If avrdude specific programmer is not set, set it based on the bootloader used
ifeq (,$(AVRDUDE_PROGRAMMER))
FLASHFILE ?= $(BINFILE)
ifeq (stk500v2,$(BOOTLOADER))
AVRDUDE_PROGRAMMER = stk500v2
BOOTLOADER_SIZE ?= 4K
# Disable auto erase; erasing the flash is done implicitly by the bootloader
# and explicit erase is not supported
FFLAGS_EXTRA += -D
endif
ifeq (avr109,$(BOOTLOADER))
AVRDUDE_PROGRAMMER = avr109
BOOTLOADER_SIZE ?= 4K
endif
ifneq (,$(BOOTLOADER_BAUD))
FFLAGS_EXTRA += -b $(BOOTLOADER_BAUD)
endif
endif
BOOTLOADER_SIZE ?= 0
ROM_RESERVED ?= $(BOOTLOADER_SIZE)

View File

@ -0,0 +1,38 @@
/*
* Copyright (C) 2021 Gerson Fernando Budke <nandojve@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_common
* @{
*
* @file
* @brief Common implementations for ATxmega boards
*
* @author Gerson Fernando Budke <nandojve@gmail.com>
*
* @}
*/
#include "board.h"
#include "cpu.h"
#ifdef LED_PORT
void __attribute__((weak)) led_init(void)
{
LED_PORT.DIR = LED_PORT_MASK;
LED_PORT.OUT = LED_PORT_MASK;
}
#endif
void __attribute__((weak)) board_init(void)
{
cpu_init();
#ifdef LED_PORT
led_init();
#endif
}

View File

@ -0,0 +1,5 @@
/**
@defgroup boards_common_atxmega ATxmega common
@ingroup boards
@brief Shared files and configuration for ATxmega-based boards
*/

View File

@ -0,0 +1,100 @@
/*
* Copyright (C) 2021 Gerson Fernando Budke <nandojve@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_common_atxmega
* @{
*
* @file
* @brief Common configuration of MCU periphery for ATxmega boards
*
* @author Gerson Fernando Budke <nandojve@gmail.com>
*/
#ifndef PERIPH_CONF_COMMON_H
#define PERIPH_CONF_COMMON_H
#include "periph_cpu.h"
#include "macros/units.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Clock configuration
* @{
*/
#ifndef CLOCK_CORECLOCK
#define CLOCK_CORECLOCK MHZ(32)
#endif /* CLOCK_CORECLOCK */
/** @} */
/**
* @name ADC Configuration
*
* @{
*/
#ifndef ADC_NUMOF
#define ADC_NUMOF (0U)
#endif /* ADC_NUMOF */
/** @} */
/**
* @name I2C configuration
* @{
*/
#ifndef I2C_NUMOF
#define I2C_NUMOF (0U)
#endif /* I2C_NUMOF */
/** @} */
/**
* @name PWM configuration
*
* @{
*/
#ifndef PWM_NUMOF
#define PWM_NUMOF (0U)
#endif /* PWM_NUMOF */
/** @} */
/**
* @name SPI configuration
*
* The SS pin must be configured as output for the SPI device to work as
* master correctly, though we do not use it for now (as we handle the chip
* select externally for now)
*
* @{
*/
#ifndef SPI_NUMOF
#define SPI_NUMOF (0U)
#endif /* SPI_NUMOF */
/** @} */
/**
* @name 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.
*
* @{
*/
#ifndef UART_NUMOF
#define UART_NUMOF (0U)
#endif /* UART_NUMOF */
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_COMMON_H */
/** @} */