-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
19606: doc: add board selection guide r=benpicco a=maribu ### Contribution description This adds a board selection guide to the documentation to aid new users picking good hardware for their use case. 19753: cpu/atmega8: new cpu r=benpicco a=hugueslarrive ### Contribution description Splitted from: - #19740 ### Testing procedure Tested on atmega8 with: - #19755 ### Issues/PRs references Dependencies: - #19752 - #19751 19757: core: fix null pointer dereference r=benpicco a=szsam Check return values of following functions for null: - thread_get - thread_get_unchecked Co-authored-by: Marian Buschsieweke <[email protected]> Co-authored-by: Hugues Larrive <[email protected]> Co-authored-by: Mingjie Shen <[email protected]>
- Loading branch information
Showing
11 changed files
with
365 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include $(RIOTCPU)/atmega_common/Makefile.dep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include $(RIOTCPU)/atmega_common/Makefile.features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @author Hinnerk van Bruinehsen <[email protected]> | ||
* @author Josua Arndt <[email protected]> | ||
* @author Steffen Robertz <[email protected]> | ||
* @author Matthew Blue <[email protected]> | ||
* @author Hugues Larrive <[email protected]> | ||
*/ | ||
|
||
#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 */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @author Hauke Petersen <[email protected]> | ||
* @author Hugues Larrive <[email protected]> | ||
*/ | ||
|
||
#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 */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
* @author Hauke Petersen <[email protected]> | ||
* @author Hugues Larrive <[email protected]> | ||
*/ | ||
|
||
#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 */ | ||
/** @} */ |