Jamie McCrae | 1496129 | 2024-04-18 09:12:09 +0100 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2020 Intel Corporation |
| 3 | * Copyright (c) 2024 Nordic Semiconductor ASA |
| 4 | * |
| 5 | * SPDX-License-Identifier: Apache-2.0 |
| 6 | */ |
| 7 | |
| 8 | #include <zephyr/kernel.h> |
| 9 | #include <zephyr/init.h> |
| 10 | #include <zephyr/device.h> |
| 11 | #include <version.h> |
| 12 | #include <app_version.h> |
| 13 | |
| 14 | #if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) |
| 15 | #define DELAY_STR STRINGIFY(CONFIG_BOOT_DELAY) |
| 16 | #define BANNER_POSTFIX " (delayed boot " DELAY_STR "ms)" |
| 17 | #else |
| 18 | #define BANNER_POSTFIX "" |
| 19 | #endif /* defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) */ |
| 20 | |
| 21 | #ifndef BANNER_VERSION |
| 22 | #if defined(BUILD_VERSION) && !IS_EMPTY(BUILD_VERSION) |
| 23 | #define BANNER_VERSION STRINGIFY(BUILD_VERSION) |
| 24 | #else |
| 25 | #define BANNER_VERSION KERNEL_VERSION_STRING |
| 26 | #endif /* BUILD_VERSION */ |
| 27 | #endif /* !BANNER_VERSION */ |
| 28 | |
| 29 | #if defined(APP_BUILD_VERSION) |
| 30 | #define APPLICATION_BANNER_VERSION STRINGIFY(APP_BUILD_VERSION) |
| 31 | #elif defined(APP_VERSION_EXTENDED_STRING) |
| 32 | #define APPLICATION_BANNER_VERSION APP_VERSION_EXTENDED_STRING |
| 33 | #endif |
| 34 | |
| 35 | #if defined(APPLICATION_BANNER_VERSION) |
| 36 | void boot_banner(void) |
| 37 | { |
| 38 | #if defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) |
| 39 | printk("***** delaying boot " DELAY_STR "ms (per build configuration) *****\n"); |
| 40 | k_busy_wait(CONFIG_BOOT_DELAY * USEC_PER_MSEC); |
| 41 | #endif /* defined(CONFIG_BOOT_DELAY) && (CONFIG_BOOT_DELAY > 0) */ |
| 42 | |
| 43 | printk("*** Booting MCUboot " APPLICATION_BANNER_VERSION " ***\n"); |
| 44 | printk("*** " CONFIG_BOOT_BANNER_STRING " " BANNER_VERSION BANNER_POSTFIX " ***\n"); |
| 45 | } |
| 46 | #endif /* APP_BUILD_VERSION */ |