2023-03-23 23:54:31 +08:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023 Yonatan Schachter
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <zephyr/kernel.h>
|
|
|
|
#include <zephyr/bindesc.h>
|
2024-01-24 17:35:04 +08:00
|
|
|
#include <zephyr/version.h>
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_KERNEL_VERSION_STRING)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_STR_DEFINE(kernel_version_string, BINDESC_ID_KERNEL_VERSION_STRING,
|
|
|
|
KERNEL_VERSION_STRING);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_KERNEL_VERSION_STRING) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_KERNEL_VERSION_MAJOR)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(kernel_version_major, BINDESC_ID_KERNEL_VERSION_MAJOR,
|
|
|
|
KERNEL_VERSION_MAJOR);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_KERNEL_VERSION_MAJOR) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_KERNEL_VERSION_MINOR)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(kernel_version_minor, BINDESC_ID_KERNEL_VERSION_MINOR,
|
|
|
|
KERNEL_VERSION_MINOR);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_KERNEL_VERSION_MINOR) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_KERNEL_VERSION_PATCHLEVEL)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(kernel_version_patchlevel, BINDESC_ID_KERNEL_VERSION_PATCHLEVEL,
|
|
|
|
KERNEL_PATCHLEVEL);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_KERNEL_VERSION_PATCHLEVEL) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_KERNEL_VERSION_NUMBER)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(kernel_version_number, BINDESC_ID_KERNEL_VERSION_NUMBER,
|
|
|
|
KERNEL_VERSION_NUMBER);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_KERNEL_VERSION_NUMBER) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-01-23 07:19:53 +08:00
|
|
|
#if defined(CONFIG_BINDESC_KERNEL_BUILD_VERSION)
|
|
|
|
BINDESC_STR_DEFINE(kernel_build_version, BINDESC_ID_KERNEL_BUILD_VERSION,
|
|
|
|
STRINGIFY(BUILD_VERSION));
|
|
|
|
#endif /* CONFIG_BINDESC_KERNEL_BUILD_VERSION */
|
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(HAS_APP_VERSION)
|
2024-01-24 17:35:04 +08:00
|
|
|
#include <zephyr/app_version.h>
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_APP_VERSION_STRING)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_STR_DEFINE(app_version_string, BINDESC_ID_APP_VERSION_STRING,
|
|
|
|
APP_VERSION_STRING);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_APP_VERSION_STRING) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_APP_VERSION_MAJOR)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(app_version_major, BINDESC_ID_APP_VERSION_MAJOR,
|
|
|
|
APP_VERSION_MAJOR);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_APP_VERSION_MAJOR) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_APP_VERSION_MINOR)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(app_version_minor, BINDESC_ID_APP_VERSION_MINOR,
|
|
|
|
APP_VERSION_MINOR);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_APP_VERSION_MINOR) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_APP_VERSION_PATCHLEVEL)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(app_version_patchlevel, BINDESC_ID_APP_VERSION_PATCHLEVEL,
|
|
|
|
APP_PATCHLEVEL);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_APP_VERSION_PATCHLEVEL) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#if defined(CONFIG_BINDESC_APP_VERSION_NUMBER)
|
2023-03-23 23:54:31 +08:00
|
|
|
BINDESC_UINT_DEFINE(app_version_number, BINDESC_ID_APP_VERSION_NUMBER,
|
|
|
|
APP_VERSION_NUMBER);
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(CONFIG_BINDESC_APP_VERSION_NUMBER) */
|
2023-03-23 23:54:31 +08:00
|
|
|
|
2024-01-23 07:19:53 +08:00
|
|
|
#if defined(CONFIG_BINDESC_APP_BUILD_VERSION)
|
|
|
|
BINDESC_STR_DEFINE(app_build_version, BINDESC_ID_APP_BUILD_VERSION,
|
|
|
|
STRINGIFY(APP_BUILD_VERSION));
|
|
|
|
#endif /* CONFIG_BINDESC_APP_BUILD_VERSION */
|
|
|
|
|
2024-06-24 18:59:51 +08:00
|
|
|
#endif /* defined(HAS_APP_VERSION) */
|