diff --git a/boards/common/atmega/board.c b/boards/common/atmega/board.c index 9e0fe6ebd0..2809630a55 100644 --- a/boards/common/atmega/board.c +++ b/boards/common/atmega/board.c @@ -38,10 +38,6 @@ void board_init(void) atmega_set_prescaler(CPU_ATMEGA_CLK_SCALE_INIT); -#ifdef MODULE_AVR_LIBC_EXTRA - atmega_stdio_init(); -#endif - cpu_init(); led_init(); irq_enable(); diff --git a/boards/waspmote-pro/board.c b/boards/waspmote-pro/board.c index abedc5d67e..fa918eb747 100644 --- a/boards/waspmote-pro/board.c +++ b/boards/waspmote-pro/board.c @@ -58,10 +58,6 @@ void board_init(void) #endif #endif -#ifdef MODULE_AVR_LIBC_EXTRA - atmega_stdio_init(); -#endif - cpu_init(); led_init(); irq_enable(); diff --git a/cpu/atmega_common/cpu.c b/cpu/atmega_common/cpu.c index f02469beb4..01f1c4cfc0 100644 --- a/cpu/atmega_common/cpu.c +++ b/cpu/atmega_common/cpu.c @@ -105,6 +105,10 @@ void cpu_init(void) wdt_reset(); /* should not be nececessary as done in bootloader */ wdt_disable(); /* but when used without bootloader this is needed */ + /* Initialize stdio before periph_init() to allow use of DEBUG() there */ +#ifdef MODULE_AVR_LIBC_EXTRA + atmega_stdio_init(); +#endif /* Initialize peripherals for which modules are included in the makefile.*/ /* spi_init */ /* rtc_init */