diff --git a/core/lib/include/kernel_init.h b/core/lib/include/kernel_init.h index 69ba87da93..2e724d5ae0 100644 --- a/core/lib/include/kernel_init.h +++ b/core/lib/include/kernel_init.h @@ -56,6 +56,15 @@ void kernel_init(void); */ void board_init(void); +/** + * @brief Initialize debug LEDs and stdio + */ +#ifdef MODULE_CORE_INIT +void early_init(void); +#else +static inline void early_init(void) {} +#endif + #ifdef __cplusplus } #endif diff --git a/core/lib/init.c b/core/lib/init.c index cf5bf972a0..cee564e0e5 100644 --- a/core/lib/init.c +++ b/core/lib/init.c @@ -29,6 +29,7 @@ #include "log.h" #include "periph/pm.h" #include "thread.h" +#include "stdio_base.h" #define ENABLE_DEBUG 0 #include "debug.h" @@ -102,3 +103,14 @@ void kernel_init(void) cpu_switch_context_exit(); } + +void early_init(void) +{ + /* initialize leds */ + if (IS_USED(MODULE_PERIPH_INIT_LEDS)) { + extern void led_init(void); + led_init(); + } + + stdio_init(); +} diff --git a/drivers/periph_common/init.c b/drivers/periph_common/init.c index f547852cf5..cc7242fd7f 100644 --- a/drivers/periph_common/init.c +++ b/drivers/periph_common/init.c @@ -58,11 +58,6 @@ void periph_init(void) { #ifdef MODULE_PERIPH_INIT - /* initialize leds */ - if (IS_USED(MODULE_PERIPH_INIT_LEDS)) { - extern void led_init(void); - led_init(); - } /* initialize buttonss */ if (IS_USED(MODULE_PERIPH_INIT_BUTTONS)) { extern void button_init(void);