forked from mcu-tools/mcuboot
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boot: zephyr: Add optional MCUboot boot banner
Adds an optional MCUboot boot banner which displays the MCUboot version and zephyr version Signed-off-by: Jamie McCrae <[email protected]>
- Loading branch information
Showing
3 changed files
with
68 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright (c) 2020 Intel Corporation | ||
* Copyright (c) 2024 Nordic Semiconductor ASA | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
#include <zephyr/kernel.h> | ||
#include <zephyr/init.h> | ||
#include <zephyr/device.h> | ||
#include <version.h> | ||
#include <app_version.h> | ||
|
||
#if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) | ||
#define DELAY_STR STRINGIFY(CONFIG_BOOT_DELAY) | ||
#define BANNER_POSTFIX " (delayed boot " DELAY_STR "ms)" | ||
#else | ||
#define BANNER_POSTFIX "" | ||
#endif /* defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) */ | ||
|
||
#ifndef BANNER_VERSION | ||
#if defined(BUILD_VERSION) && !IS_EMPTY(BUILD_VERSION) | ||
#define BANNER_VERSION STRINGIFY(BUILD_VERSION) | ||
#else | ||
#define BANNER_VERSION KERNEL_VERSION_STRING | ||
#endif /* BUILD_VERSION */ | ||
#endif /* !BANNER_VERSION */ | ||
|
||
#if defined(APP_BUILD_VERSION) | ||
#define APPLICATION_BANNER_VERSION STRINGIFY(APP_BUILD_VERSION) | ||
#elif defined(APP_VERSION_EXTENDED_STRING) | ||
#define APPLICATION_BANNER_VERSION APP_VERSION_EXTENDED_STRING | ||
#endif | ||
|
||
#if defined(APPLICATION_BANNER_VERSION) | ||
void boot_banner(void) | ||
{ | ||
#if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) | ||
printk("***** delaying boot " DELAY_STR "ms (per build configuration) *****\n"); | ||
k_busy_wait(CONFIG_BOOT_DELAY * USEC_PER_MSEC); | ||
#endif /* defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) */ | ||
|
||
printk("*** Booting MCUboot " APPLICATION_BANNER_VERSION " ***\n"); | ||
printk("*** " CONFIG_BOOT_BANNER_STRING " " BANNER_VERSION BANNER_POSTFIX " ***\n"); | ||
} | ||
#endif /* APP_BUILD_VERSION */ |