mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2026-01-01 01:41:18 +01:00
cpu/atmega8: new cpu
This commit is contained in:
parent
84a3078a93
commit
0401d55de5
34
cpu/atmega8/Kconfig
Normal file
34
cpu/atmega8/Kconfig
Normal file
@ -0,0 +1,34 @@
|
||||
# Copyright (c) 2020 HAW Hamburg
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
config CPU_FAM_ATMEGA8
|
||||
bool
|
||||
select CPU_COMMON_ATMEGA
|
||||
|
||||
## CPU Models
|
||||
config CPU_MODEL_ATMEGA8
|
||||
bool
|
||||
select CPU_FAM_ATMEGA8
|
||||
select HAS_CPU_ATMEGA8
|
||||
|
||||
## Definition of specific features
|
||||
config HAS_CPU_ATMEGA8
|
||||
bool
|
||||
help
|
||||
Indicates that a 'atmega8' cpu is being used.
|
||||
|
||||
## Common CPU symbols
|
||||
config CPU_FAM
|
||||
default "atmega8" if CPU_FAM_ATMEGA8
|
||||
|
||||
config CPU_MODEL
|
||||
default "atmega8" if CPU_MODEL_ATMEGA8
|
||||
|
||||
config CPU
|
||||
default "atmega8" if CPU_FAM_ATMEGA8
|
||||
|
||||
source "$(RIOTCPU)/atmega_common/Kconfig"
|
||||
7
cpu/atmega8/Makefile
Normal file
7
cpu/atmega8/Makefile
Normal file
@ -0,0 +1,7 @@
|
||||
# define the module that is build
|
||||
MODULE = cpu
|
||||
|
||||
# add a list of subdirectories, that should also be build
|
||||
DIRS = $(RIOTCPU)/atmega_common/
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
||||
1
cpu/atmega8/Makefile.dep
Normal file
1
cpu/atmega8/Makefile.dep
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTCPU)/atmega_common/Makefile.dep
|
||||
1
cpu/atmega8/Makefile.features
Normal file
1
cpu/atmega8/Makefile.features
Normal file
@ -0,0 +1 @@
|
||||
include $(RIOTCPU)/atmega_common/Makefile.features
|
||||
7
cpu/atmega8/Makefile.include
Normal file
7
cpu/atmega8/Makefile.include
Normal file
@ -0,0 +1,7 @@
|
||||
RAM_LEN = 1K
|
||||
ROM_LEN = 8K
|
||||
|
||||
LINKER_SCRIPT ?= avr4.ld
|
||||
|
||||
# CPU depends on the atmega common module, so include it
|
||||
include $(RIOTCPU)/atmega_common/Makefile.include
|
||||
10
cpu/atmega8/doc.txt
Normal file
10
cpu/atmega8/doc.txt
Normal file
@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @defgroup cpu_atmega8 Atmel ATmega8
|
||||
* @ingroup cpu
|
||||
* @brief Implementation of Atmel's ATmega8 MCU
|
||||
*/
|
||||
|
||||
/**
|
||||
* @defgroup cpu_atmega8_definitions Atmel ATmega8 Definitions
|
||||
* @ingroup cpu_atmega8
|
||||
*/
|
||||
93
cpu/atmega8/include/cpu_conf.h
Normal file
93
cpu/atmega8/include/cpu_conf.h
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Freie Universität Berlin, Hinnerk van Bruinehsen
|
||||
* 2017 RWTH Aachen, Josua Arndt
|
||||
* 2018 Matthew Blue
|
||||
* 2023 Hugues Larrive
|
||||
*
|
||||
* 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_atmega_common
|
||||
* @{
|
||||
*
|
||||
* @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>
|
||||
* @author Josua Arndt <jarndt@ias.rwth-aachen.de>
|
||||
* @author Steffen Robertz <steffen.robertz@rwth-aachen.de>
|
||||
* @author Matthew Blue <matthew.blue.neuro@gmail.com>
|
||||
* @author Hugues Larrive <hugues.larrive@pm.me>
|
||||
*/
|
||||
|
||||
#ifndef CPU_CONF_H
|
||||
#define CPU_CONF_H
|
||||
|
||||
#include "atmega_regs_common.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef THREAD_EXTRA_STACKSIZE_PRINTF
|
||||
#define THREAD_EXTRA_STACKSIZE_PRINTF (64)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Kernel configuration
|
||||
*
|
||||
* Since printf seems to get memory allocated by the
|
||||
* linker/avr-libc the stack size tested successfully
|
||||
* even with pretty small stacks.
|
||||
* @{
|
||||
*/
|
||||
#ifndef THREAD_STACKSIZE_DEFAULT
|
||||
#define THREAD_STACKSIZE_DEFAULT (128)
|
||||
#endif
|
||||
|
||||
/* keep THREAD_STACKSIZE_IDLE > THREAD_EXTRA_STACKSIZE_PRINTF
|
||||
* to avoid not printing of debug in interrupts
|
||||
*/
|
||||
#ifndef THREAD_STACKSIZE_IDLE
|
||||
#if MODULE_XTIMER || MODULE_ZTIMER || MODULE_ZTIMER64
|
||||
/* For AVR no ISR stack is used, hence an IRQ will victimize the stack of
|
||||
* whatever thread happens to be running with the IRQ kicks in. If more than
|
||||
* trivial stuff is needed to be done in ISRs (e.g. when soft timers are used),
|
||||
* the idle stack will overflow.
|
||||
*/
|
||||
#define THREAD_STACKSIZE_IDLE (192)
|
||||
#else
|
||||
#define THREAD_STACKSIZE_IDLE (96)
|
||||
#endif
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Attribute for memory sections required by SRAM PUF
|
||||
*/
|
||||
#define PUF_SRAM_ATTRIBUTES __attribute__((used, section(".noinit")))
|
||||
|
||||
/**
|
||||
* @brief Declare the heap_stats function as available
|
||||
*/
|
||||
#define HAVE_HEAP_STATS
|
||||
|
||||
/**
|
||||
* @brief This arch uses the inlined IRQ API.
|
||||
*/
|
||||
#define IRQ_API_INLINED (1)
|
||||
|
||||
#ifndef DOXYGEN
|
||||
#define HAS_FLASH_UTILS_ARCH 1
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* CPU_CONF_H */
|
||||
/** @} */
|
||||
46
cpu/atmega8/include/default_timer_config.h
Normal file
46
cpu/atmega8/include/default_timer_config.h
Normal file
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (C) 2015 HAW Hamburg
|
||||
* 2016 Freie Universität Berlin
|
||||
* 2023 Hugues Larrive
|
||||
*
|
||||
* 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_atmega8
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Default timer configuration
|
||||
*
|
||||
* @author René Herthel <rene-herthel@outlook.de>
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Hugues Larrive <hugues.larrive@pm.me>
|
||||
*/
|
||||
|
||||
#ifndef DEFAULT_TIMER_CONFIG_H
|
||||
#define DEFAULT_TIMER_CONFIG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef TIMER_NUMOF
|
||||
#define TIMER_NUMOF (1U)
|
||||
#define TIMER_CHANNEL_NUMOF (2)
|
||||
|
||||
#define TIMER_0 MEGA_TIMER1
|
||||
#define TIMER_0_MASK &TIMSK
|
||||
#define TIMER_0_FLAG &TIFR
|
||||
#define TIMER_0_ISRA TIMER1_COMPA_vect
|
||||
#define TIMER_0_ISRB TIMER1_COMPB_vect
|
||||
#endif /* TIMER_NUMOF */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* DEFAULT_TIMER_CONFIG_H */
|
||||
/** @} */
|
||||
98
cpu/atmega8/include/periph_cpu.h
Normal file
98
cpu/atmega8/include/periph_cpu.h
Normal file
@ -0,0 +1,98 @@
|
||||
/*
|
||||
* Copyright (C) 2015 HAW Hamburg
|
||||
* 2016 Freie Universität Berlin
|
||||
* 2023 Hugues Larrive
|
||||
*
|
||||
* 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_atmega8
|
||||
* @{
|
||||
*
|
||||
* @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 Hugues Larrive <hugues.larrive@pm.me>
|
||||
*/
|
||||
|
||||
#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 ATmega8 family
|
||||
*/
|
||||
enum {
|
||||
PORT_B = 1, /**< port B */
|
||||
PORT_C = 2, /**< port C */
|
||||
PORT_D = 3 /**< port D */
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Available external interrupt pins on the ATmega8 family
|
||||
*
|
||||
* In order of their interrupt number.
|
||||
*/
|
||||
#define CPU_ATMEGA_EXT_INTS { GPIO_PIN(PORT_D, 2), \
|
||||
GPIO_PIN(PORT_D, 3) }
|
||||
|
||||
/**
|
||||
* @brief Get the interrupt vector number of the given GPIO pin
|
||||
*/
|
||||
static inline uint8_t atmega_pin2exti(uint8_t port_num, uint8_t pin_num)
|
||||
{
|
||||
(void)port_num;
|
||||
return pin_num - 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Check if the given pin can be used as external interrupt
|
||||
*/
|
||||
static inline bool atmega_has_pin_exti(uint8_t port_num, uint8_t pin_num)
|
||||
{
|
||||
if (port_num == PORT_D) {
|
||||
return ((pin_num == 2) || (pin_num == 3));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @name Defines for the I2C interface
|
||||
* @{
|
||||
*/
|
||||
#define I2C_PORT_REG PORTC
|
||||
#define I2C_PIN_MASK (1 << PORTC4) | (1 << PORTC5)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name EEPROM configuration
|
||||
* @{
|
||||
*/
|
||||
#define EEPROM_SIZE (512U) /* 512B */
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "periph_conf.h"
|
||||
#include "default_timer_config.h"
|
||||
|
||||
#endif /* PERIPH_CPU_H */
|
||||
/** @} */
|
||||
Loading…
x
Reference in New Issue
Block a user