Skip to content

Commit

Permalink
cpu/atmega_common: Move stdio_init() to cpu_init()
Browse files Browse the repository at this point in the history
Moving atmega_stdio_init() to cpu_init() just before periph_init() guarantees
that stdio is available to allow DEBUG() in periph_init(). This also helps to
unify the boot up process of ATmega boards and de-duplicates the stdio init from
board_init().
  • Loading branch information
maribu committed Apr 10, 2019
1 parent 53af7eb commit ca5e196
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
4 changes: 0 additions & 4 deletions boards/common/atmega/board.c
Expand Up @@ -34,10 +34,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();
Expand Down
4 changes: 0 additions & 4 deletions boards/waspmote-pro/board.c
Expand Up @@ -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();
Expand Down
4 changes: 4 additions & 0 deletions cpu/atmega_common/cpu.c
Expand Up @@ -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 */
Expand Down

0 comments on commit ca5e196

Please sign in to comment.