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
39#define BINDESC_ID_APP_VERSION_STRING 0x800
42#define BINDESC_ID_APP_VERSION_MAJOR 0x801
45#define BINDESC_ID_APP_VERSION_MINOR 0x802
48#define BINDESC_ID_APP_VERSION_PATCHLEVEL 0x803
51#define BINDESC_ID_APP_VERSION_NUMBER 0x804
54#define BINDESC_ID_KERNEL_VERSION_STRING 0x900
57#define BINDESC_ID_KERNEL_VERSION_MAJOR 0x901
60#define BINDESC_ID_KERNEL_VERSION_MINOR 0x902
63#define BINDESC_ID_KERNEL_VERSION_PATCHLEVEL 0x903
66#define BINDESC_ID_KERNEL_VERSION_NUMBER 0x904
69#define BINDESC_ID_BUILD_TIME_YEAR 0xa00
72#define BINDESC_ID_BUILD_TIME_MONTH 0xa01
75#define BINDESC_ID_BUILD_TIME_DAY 0xa02
78#define BINDESC_ID_BUILD_TIME_HOUR 0xa03
81#define BINDESC_ID_BUILD_TIME_MINUTE 0xa04
84#define BINDESC_ID_BUILD_TIME_SECOND 0xa05
87#define BINDESC_ID_BUILD_TIME_UNIX 0xa06
90#define BINDESC_ID_BUILD_DATE_TIME_STRING 0xa07
93#define BINDESC_ID_BUILD_DATE_STRING 0xa08
96#define BINDESC_ID_BUILD_TIME_STRING 0xa09
99#define BINDESC_ID_HOST_NAME 0xb00
102#define BINDESC_ID_C_COMPILER_NAME 0xb01
105#define BINDESC_ID_C_COMPILER_VERSION 0xb02
108#define BINDESC_ID_CXX_COMPILER_NAME 0xb03
111#define BINDESC_ID_CXX_COMPILER_VERSION 0xb04
113#define BINDESC_TAG_DESCRIPTORS_END BINDESC_TAG(DESCRIPTORS_END, 0x0fff)
125#define BINDESC_TAG(type, id) ((BINDESC_TYPE_##type & 0xf) << 12 | (id & 0x0fff))
131#if !IS_ENABLED(_LINKER)
142#define BINDESC_NAME(name) bindesc_entry_##name
145#define __BINDESC_ENTRY_DEFINE(name) \
146 __aligned(BINDESC_ALIGNMENT) const struct bindesc_entry BINDESC_NAME(name) \
147 __in_section(_bindesc_entry, static, name) __used __noasan
167#define BINDESC_STR_DEFINE(name, id, value) \
168 __BINDESC_ENTRY_DEFINE(name) = { \
169 .tag = BINDESC_TAG(STR, id), \
170 .len = (uint16_t)sizeof(value), \
188#define BINDESC_UINT_DEFINE(name, id, value) \
189 __BINDESC_ENTRY_DEFINE(name) = { \
190 .tag = BINDESC_TAG(UINT, id), \
191 .len = (uint16_t)sizeof(uint32_t), \
192 .data = sys_uint32_to_array(value), \
213#define BINDESC_BYTES_DEFINE(name, id, value) \
214 __BINDESC_ENTRY_DEFINE(name) = { \
215 .tag = BINDESC_TAG(BYTES, id), \
216 .len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \
217 .data = __DEBRACKET value, \
229#define BINDESC_GET_STR(name) BINDESC_NAME(name).data
240#define BINDESC_GET_UINT(name) *(uint32_t *)&(BINDESC_NAME(name).data)
254#define BINDESC_GET_BYTES(name) BINDESC_NAME(name).data
265#define BINDESC_GET_SIZE(name) BINDESC_NAME(name).len
290BUILD_ASSERT(offsetof(
struct bindesc_entry, tag) == 0,
"Incorrect memory layout");
291BUILD_ASSERT(offsetof(
struct bindesc_entry, len) == 2,
"Incorrect memory layout");
292BUILD_ASSERT(offsetof(
struct bindesc_entry, data) == 4,
"Incorrect memory layout");
294#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_STRING)
295extern const struct bindesc_entry BINDESC_NAME(kernel_version_string);
298#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_MAJOR)
299extern const struct bindesc_entry BINDESC_NAME(kernel_version_major);
302#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_MINOR)
303extern const struct bindesc_entry BINDESC_NAME(kernel_version_minor);
306#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_PATCHLEVEL)
307extern const struct bindesc_entry BINDESC_NAME(kernel_version_patchlevel);
310#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_NUMBER)
311extern const struct bindesc_entry BINDESC_NAME(kernel_version_number);
314#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_STRING)
315extern const struct bindesc_entry BINDESC_NAME(app_version_string);
318#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_MAJOR)
319extern const struct bindesc_entry BINDESC_NAME(app_version_major);
322#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_MINOR)
323extern const struct bindesc_entry BINDESC_NAME(app_version_minor);
326#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_PATCHLEVEL)
327extern const struct bindesc_entry BINDESC_NAME(app_version_patchlevel);
330#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_NUMBER)
331extern const struct bindesc_entry BINDESC_NAME(app_version_number);
334#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_YEAR)
335extern const struct bindesc_entry BINDESC_NAME(build_time_year);
338#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_MONTH)
339extern const struct bindesc_entry BINDESC_NAME(build_time_month);
342#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_DAY)
343extern const struct bindesc_entry BINDESC_NAME(build_time_day);
346#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_HOUR)
347extern const struct bindesc_entry BINDESC_NAME(build_time_hour);
350#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_MINUTE)
351extern const struct bindesc_entry BINDESC_NAME(build_time_minute);
354#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_SECOND)
355extern const struct bindesc_entry BINDESC_NAME(build_time_second);
358#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_UNIX)
359extern const struct bindesc_entry BINDESC_NAME(build_time_unix);
362#if IS_ENABLED(CONFIG_BINDESC_BUILD_DATE_TIME_STRING)
363extern const struct bindesc_entry BINDESC_NAME(build_date_time_string);
366#if IS_ENABLED(CONFIG_BINDESC_BUILD_DATE_STRING)
367extern const struct bindesc_entry BINDESC_NAME(build_date_string);
370#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_STRING)
371extern const struct bindesc_entry BINDESC_NAME(build_time_string);
374#if IS_ENABLED(CONFIG_BINDESC_HOST_NAME)
378#if IS_ENABLED(CONFIG_BINDESC_C_COMPILER_NAME)
379extern const struct bindesc_entry BINDESC_NAME(c_compiler_name);
382#if IS_ENABLED(CONFIG_BINDESC_C_COMPILER_VERSION)
383extern const struct bindesc_entry BINDESC_NAME(c_compiler_version);
386#if IS_ENABLED(CONFIG_BINDESC_CXX_COMPILER_NAME)
387extern const struct bindesc_entry BINDESC_NAME(cxx_compiler_name);
390#if IS_ENABLED(CONFIG_BINDESC_CXX_COMPILER_VERSION)
391extern 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
Definition: bindesc.h:275
uint8_t data[]
Value of the entry.
Definition: bindesc.h:281
uint16_t tag
Tag of the entry.
Definition: bindesc.h:277
uint16_t len
Length of the descriptor data.
Definition: bindesc.h:279