Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/atmega*: factorise common code into atmega_common #9866

Merged
merged 7 commits into from
Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions boards/common/arduino-atmega/include/board_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ extern "C" {
#define LED0_TOGGLE (PORTB ^= LED0_MASK)
/** @} */

/**
* @name Usage of LED to turn on when a kernel panic occurs.
* @{
*/
#define LED_PANIC LED0_ON
/** @} */

/**
* @name CPU clock scale for arduino boards
*
*/
#define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
/** @} */

/**
* @name xtimer configuration values
* @{
Expand Down
41 changes: 41 additions & 0 deletions boards/jiminy-mega256rfr2/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ extern "C" {
#define LED2_TOGGLE (LED_PORT ^= LED2_MASK)
/** @} */

/**
* @name White LED light is used to signal ERROR.
* @{
*/
#define LED_PANIC (LED_PORT |= LED2_MASK | LED1_MASK | LED0_MASK)
/** @} */

/**
* @name xtimer configuration values
* @{
Expand All @@ -83,6 +90,40 @@ extern "C" {
#define XTIMER_HZ (125000UL)
/** @} */

/**
* @name Indicate Watchdog cleared in bootloader an
*
* AVR CPUs need to reset the Watchdog as fast as possible.
* This flag indicates that the watchdog is reseted in the bootloader
* and that the MCUSR value is stored in register 2 (r2)
* @{
*/
#define BOOTLOADER_CLEARS_WATCHDOG_AND_PASSES_MCUSR 1
/** @} */

/**
* @name Indicate Watchdog cleared in bootloader an
*
* AVR CPUs need to reset the Watchdog as fast as possible.
* This flag indicates that the watchdog is reseted in the bootloader
* and that the MCUSR value is stored in register 2 (r2)
* @{
*/
#define BOOTLOADER_CLEARS_WATCHDOG_AND_PASSES_MCUSR 1
/** @} */

/**
* @name CPU clock scale for jiminy-megarfr256rfr2
*
* The CPU can not be used with the external xtal oscillator if the core
* should be put in sleep while the transceiver is in rx mode.
*
* It seems the as teh peripheral clock divider is set to 1 and this all
* clocks of the timer, etc run with 16MHz increasing power consumption.
*/
#define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
Expand Down
14 changes: 14 additions & 0 deletions boards/mega-xplained/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ extern "C" {
#define LED3_TOGGLE PORTB ^= LED3_PIN
/** @} */

/**
* @name Usage of LED to turn on when a kernel panic occurs.
* @{
*/
#define LED_PANIC LED1_ON
/** @} */

/**
* @name Button pin configuration
* @{
Expand All @@ -111,6 +118,13 @@ extern "C" {
#define FILTER_OUTPUT GPIO_PIN(PORT_A, 7)
/** @} */

/**
* @name CPU clock scale for mega-xplained
*
*/
#define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
/** @} */

/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
Expand Down
14 changes: 14 additions & 0 deletions boards/waspmote-pro/include/board.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@ extern "C" {
#define LED_RED_TOGGLE LED0_TOGGLE
/** @} */

/**
* @name Usage of LED to turn on when a kernel panic occurs.
* @{
*/
#define LED_PANIC LED_RED_ON
/** @} */

/**
* @name Macros for controlling the on-board MUXes.
* @{
Expand Down Expand Up @@ -143,6 +150,13 @@ extern "C" {
MUX_USB_XBEE_ON
/** @} */

/**
* @name CPU clock scale for waspmote-pro
*
*/
#define CPU_ATMEGA_CLK_SCALE_INIT CPU_ATMEGA_CLK_SCALE_DIV1
/** @} */

/**
* @name xtimer configuration values
* @{
Expand Down
4 changes: 3 additions & 1 deletion cpu/atmega1281/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# define the module that is build
MODULE = cpu

# add a list of subdirectories, that should also be build
DIRS = $(ATMEGA_COMMON)
DIRS = $(RIOTCPU)/atmega_common/

include $(RIOTBASE)/Makefile.base
9 changes: 1 addition & 8 deletions cpu/atmega1281/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# 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/

# explicitly tell the linker to link the syscalls and startup code.
# Without this the interrupt vectors will not be linked correctly!
export UNDEF += $(BINDIR)/cpu/startup.o

RAM_LEN = 8K
ROM_LEN = 128K

# CPU depends on the atmega common module, so include it
include $(ATMEGA_COMMON)Makefile.include
include $(RIOTCPU)/atmega_common/Makefile.include
30 changes: 0 additions & 30 deletions cpu/atmega1281/cpu.c

This file was deleted.

51 changes: 0 additions & 51 deletions cpu/atmega1281/include/cpu_conf.h

This file was deleted.

72 changes: 0 additions & 72 deletions cpu/atmega1281/startup.c

This file was deleted.

3 changes: 2 additions & 1 deletion cpu/atmega1284p/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# define the module that is build
MODULE = cpu

# add a list of subdirectories, that should also be build
DIRS = $(ATMEGA_COMMON)
DIRS = $(RIOTCPU)/atmega_common/

include $(RIOTBASE)/Makefile.base
5 changes: 1 addition & 4 deletions cpu/atmega1284p/Makefile.include
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# 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/

RAM_LEN = 16K
ROM_LEN = 128K

# CPU depends on the atmega common module, so include it
include $(ATMEGA_COMMON)Makefile.include
include $(RIOTCPU)/atmega_common/Makefile.include
32 changes: 0 additions & 32 deletions cpu/atmega1284p/cpu.c

This file was deleted.

Loading