7#ifndef ZEPHYR_INCLUDE_ZEPHYR_BINDESC_H_
8#define ZEPHYR_INCLUDE_ZEPHYR_BINDESC_H_
20#define BINDESC_MAGIC 0xb9863e5a7ea46046
21#define BINDESC_ALIGNMENT 4
22#define BINDESC_TYPE_UINT 0x0
23#define BINDESC_TYPE_STR 0x1
24#define BINDESC_TYPE_BYTES 0x2
25#define BINDESC_TYPE_DESCRIPTORS_END 0xf
40#define BINDESC_ID_APP_VERSION_STRING 0x800
43#define BINDESC_ID_APP_VERSION_MAJOR 0x801
46#define BINDESC_ID_APP_VERSION_MINOR 0x802
49#define BINDESC_ID_APP_VERSION_PATCHLEVEL 0x803
52#define BINDESC_ID_APP_VERSION_NUMBER 0x804
55#define BINDESC_ID_KERNEL_VERSION_STRING 0x900
58#define BINDESC_ID_KERNEL_VERSION_MAJOR 0x901
61#define BINDESC_ID_KERNEL_VERSION_MINOR 0x902
64#define BINDESC_ID_KERNEL_VERSION_PATCHLEVEL 0x903
67#define BINDESC_ID_KERNEL_VERSION_NUMBER 0x904
70#define BINDESC_ID_BUILD_TIME_YEAR 0xa00
73#define BINDESC_ID_BUILD_TIME_MONTH 0xa01
76#define BINDESC_ID_BUILD_TIME_DAY 0xa02
79#define BINDESC_ID_BUILD_TIME_HOUR 0xa03
82#define BINDESC_ID_BUILD_TIME_MINUTE 0xa04
85#define BINDESC_ID_BUILD_TIME_SECOND 0xa05
88#define BINDESC_ID_BUILD_TIME_UNIX 0xa06
91#define BINDESC_ID_BUILD_DATE_TIME_STRING 0xa07
94#define BINDESC_ID_BUILD_DATE_STRING 0xa08
97#define BINDESC_ID_BUILD_TIME_STRING 0xa09
100#define BINDESC_ID_HOST_NAME 0xb00
103#define BINDESC_ID_C_COMPILER_NAME 0xb01
106#define BINDESC_ID_C_COMPILER_VERSION 0xb02
109#define BINDESC_ID_CXX_COMPILER_NAME 0xb03
112#define BINDESC_ID_CXX_COMPILER_VERSION 0xb04
114#define BINDESC_TAG_DESCRIPTORS_END BINDESC_TAG(DESCRIPTORS_END, 0x0fff)
126#define BINDESC_TAG(type, id) ((BINDESC_TYPE_##type & 0xf) << 12 | (id & 0x0fff))
143#define BINDESC_NAME(name) bindesc_entry_##name
146#define __BINDESC_ENTRY_DEFINE(name) \
147 __aligned(BINDESC_ALIGNMENT) const struct bindesc_entry BINDESC_NAME(name) \
148 __in_section(_bindesc_entry, static, name) __used __noasan
168#define BINDESC_STR_DEFINE(name, id, value) \
169 __BINDESC_ENTRY_DEFINE(name) = { \
170 .tag = BINDESC_TAG(STR, id), \
171 .len = (uint16_t)sizeof(value), \
189#define BINDESC_UINT_DEFINE(name, id, value) \
190 __BINDESC_ENTRY_DEFINE(name) = { \
191 .tag = BINDESC_TAG(UINT, id), \
192 .len = (uint16_t)sizeof(uint32_t), \
193 .data = sys_uint32_to_array(value), \
214#define BINDESC_BYTES_DEFINE(name, id, value) \
215 __BINDESC_ENTRY_DEFINE(name) = { \
216 .tag = BINDESC_TAG(BYTES, id), \
217 .len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \
218 .data = __DEBRACKET value, \
230#define BINDESC_GET_STR(name) BINDESC_NAME(name).data
241#define BINDESC_GET_UINT(name) *(uint32_t *)&(BINDESC_NAME(name).data)
255#define BINDESC_GET_BYTES(name) BINDESC_NAME(name).data
266#define BINDESC_GET_SIZE(name) BINDESC_NAME(name).len
272struct bindesc_entry {
287BUILD_ASSERT(offsetof(
struct bindesc_entry, tag) == 0,
"Incorrect memory layout");
288BUILD_ASSERT(offsetof(
struct bindesc_entry, len) == 2,
"Incorrect memory layout");
289BUILD_ASSERT(offsetof(
struct bindesc_entry, data) == 4,
"Incorrect memory layout");
291#if defined(CONFIG_BINDESC_KERNEL_VERSION_STRING)
292extern const struct bindesc_entry BINDESC_NAME(kernel_version_string);
295#if defined(CONFIG_BINDESC_KERNEL_VERSION_MAJOR)
296extern const struct bindesc_entry BINDESC_NAME(kernel_version_major);
299#if defined(CONFIG_BINDESC_KERNEL_VERSION_MINOR)
300extern const struct bindesc_entry BINDESC_NAME(kernel_version_minor);
303#if defined(CONFIG_BINDESC_KERNEL_VERSION_PATCHLEVEL)
304extern const struct bindesc_entry BINDESC_NAME(kernel_version_patchlevel);
307#if defined(CONFIG_BINDESC_KERNEL_VERSION_NUMBER)
308extern const struct bindesc_entry BINDESC_NAME(kernel_version_number);
311#if defined(CONFIG_BINDESC_APP_VERSION_STRING)
312extern const struct bindesc_entry BINDESC_NAME(app_version_string);
315#if defined(CONFIG_BINDESC_APP_VERSION_MAJOR)
316extern const struct bindesc_entry BINDESC_NAME(app_version_major);
319#if defined(CONFIG_BINDESC_APP_VERSION_MINOR)
320extern const struct bindesc_entry BINDESC_NAME(app_version_minor);
323#if defined(CONFIG_BINDESC_APP_VERSION_PATCHLEVEL)
324extern const struct bindesc_entry BINDESC_NAME(app_version_patchlevel);
327#if defined(CONFIG_BINDESC_APP_VERSION_NUMBER)
328extern const struct bindesc_entry BINDESC_NAME(app_version_number);
331#if defined(CONFIG_BINDESC_BUILD_TIME_YEAR)
332extern const struct bindesc_entry BINDESC_NAME(build_time_year);
335#if defined(CONFIG_BINDESC_BUILD_TIME_MONTH)
336extern const struct bindesc_entry BINDESC_NAME(build_time_month);
339#if defined(CONFIG_BINDESC_BUILD_TIME_DAY)
340extern const struct bindesc_entry BINDESC_NAME(build_time_day);
343#if defined(CONFIG_BINDESC_BUILD_TIME_HOUR)
344extern const struct bindesc_entry BINDESC_NAME(build_time_hour);
347#if defined(CONFIG_BINDESC_BUILD_TIME_MINUTE)
348extern const struct bindesc_entry BINDESC_NAME(build_time_minute);
351#if defined(CONFIG_BINDESC_BUILD_TIME_SECOND)
352extern const struct bindesc_entry BINDESC_NAME(build_time_second);
355#if defined(CONFIG_BINDESC_BUILD_TIME_UNIX)
356extern const struct bindesc_entry BINDESC_NAME(build_time_unix);
359#if defined(CONFIG_BINDESC_BUILD_DATE_TIME_STRING)
360extern const struct bindesc_entry BINDESC_NAME(build_date_time_string);
363#if defined(CONFIG_BINDESC_BUILD_DATE_STRING)
364extern const struct bindesc_entry BINDESC_NAME(build_date_string);
367#if defined(CONFIG_BINDESC_BUILD_TIME_STRING)
368extern const struct bindesc_entry BINDESC_NAME(build_time_string);
371#if defined(CONFIG_BINDESC_HOST_NAME)
372extern const struct bindesc_entry BINDESC_NAME(host_name);
375#if defined(CONFIG_BINDESC_C_COMPILER_NAME)
376extern const struct bindesc_entry BINDESC_NAME(c_compiler_name);
379#if defined(CONFIG_BINDESC_C_COMPILER_VERSION)
380extern const struct bindesc_entry BINDESC_NAME(c_compiler_version);
383#if defined(CONFIG_BINDESC_CXX_COMPILER_NAME)
384extern const struct bindesc_entry BINDESC_NAME(cxx_compiler_name);
387#if defined(CONFIG_BINDESC_CXX_COMPILER_VERSION)
388extern const struct bindesc_entry BINDESC_NAME(cxx_compiler_version);
__UINT8_TYPE__ uint8_t
Definition: stdint.h:88
__UINT16_TYPE__ uint16_t
Definition: stdint.h:89