From 25e67e019e298f937da921f98859a31f51dd2bcb Mon Sep 17 00:00:00 2001 From: Benjamin Valentin Date: Thu, 2 Jul 2020 18:35:29 +0200 Subject: [PATCH] core/init: make boot message configurable It can be desirable to not have the boot message printed each time (e.g. logs are transferred over a wireless link on battery) while still retaining the ability to receive INFO level logs. This adds the option to disable the boot-up message (and also to customize it if that is desireable). --- core/include/kernel_init.h | 21 +++++++++++++++++++++ core/init.c | 8 +++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/core/include/kernel_init.h b/core/include/kernel_init.h index 46aec9bb91..43b6076880 100644 --- a/core/include/kernel_init.h +++ b/core/include/kernel_init.h @@ -25,6 +25,27 @@ extern "C" { #endif +/** + * @defgroup core_init_config Core initialization compile configuration + * @ingroup config + * @{ + */ +#ifdef DOXYGEN + +/** + * @brief Enable this to disable printing a message on bootup. + */ +#define CONFIG_SKIP_BOOT_MSG + +/** + * @brief The message printed by RIOT before calling the main() function, when + * @ref CONFIG_SKIP_BOOT_MSG is not set. + */ +#define CONFIG_BOOT_MSG_STRING + +#endif /* DOXYGEN */ +/** @} */ + /** * @brief Initializes scheduler and creates main and idle task */ diff --git a/core/init.c b/core/init.c index a679867a37..f0254d993c 100644 --- a/core/init.c +++ b/core/init.c @@ -36,6 +36,10 @@ #include #endif +#ifndef CONFIG_BOOT_MSG_STRING +#define CONFIG_BOOT_MSG_STRING "main(): This is RIOT! (Version: " RIOT_VERSION ")" +#endif + extern int main(void); static void *main_trampoline(void *arg) @@ -46,7 +50,9 @@ static void *main_trampoline(void *arg) auto_init(); #endif - LOG_INFO("main(): This is RIOT! (Version: " RIOT_VERSION ")\n"); + if (!IS_ACTIVE(CONFIG_SKIP_BOOT_MSG)) { + LOG_INFO(CONFIG_BOOT_MSG_STRING "\n"); + } main();