7#ifndef ZEPHYR_INCLUDE_ZEPHYR_BINDESC_H_
8#define ZEPHYR_INCLUDE_ZEPHYR_BINDESC_H_
18#define BINDESC_MAGIC 0xb9863e5a7ea46046
19#define BINDESC_ALIGNMENT 4
20#define BINDESC_TYPE_UINT 0x0
21#define BINDESC_TYPE_STR 0x1
22#define BINDESC_TYPE_BYTES 0x2
23#define BINDESC_TYPE_DESCRIPTORS_END 0xf
37#define BINDESC_ID_APP_VERSION_STRING 0x800
40#define BINDESC_ID_APP_VERSION_MAJOR 0x801
43#define BINDESC_ID_APP_VERSION_MINOR 0x802
46#define BINDESC_ID_APP_VERSION_PATCHLEVEL 0x803
49#define BINDESC_ID_APP_VERSION_NUMBER 0x804
52#define BINDESC_ID_KERNEL_VERSION_STRING 0x900
55#define BINDESC_ID_KERNEL_VERSION_MAJOR 0x901
58#define BINDESC_ID_KERNEL_VERSION_MINOR 0x902
61#define BINDESC_ID_KERNEL_VERSION_PATCHLEVEL 0x903
64#define BINDESC_ID_KERNEL_VERSION_NUMBER 0x904
67#define BINDESC_ID_BUILD_TIME_YEAR 0xa00
70#define BINDESC_ID_BUILD_TIME_MONTH 0xa01
73#define BINDESC_ID_BUILD_TIME_DAY 0xa02
76#define BINDESC_ID_BUILD_TIME_HOUR 0xa03
79#define BINDESC_ID_BUILD_TIME_MINUTE 0xa04
82#define BINDESC_ID_BUILD_TIME_SECOND 0xa05
85#define BINDESC_ID_BUILD_TIME_UNIX 0xa06
88#define BINDESC_ID_BUILD_DATE_TIME_STRING 0xa07
91#define BINDESC_ID_BUILD_DATE_STRING 0xa08
94#define BINDESC_ID_BUILD_TIME_STRING 0xa09
97#define BINDESC_ID_HOST_NAME 0xb00
100#define BINDESC_ID_C_COMPILER_NAME 0xb01
103#define BINDESC_ID_C_COMPILER_VERSION 0xb02
106#define BINDESC_ID_CXX_COMPILER_NAME 0xb03
109#define BINDESC_ID_CXX_COMPILER_VERSION 0xb04
111#define BINDESC_TAG_DESCRIPTORS_END BINDESC_TAG(DESCRIPTORS_END, 0x0fff)
123#define BINDESC_TAG(type, id) ((BINDESC_TYPE_##type & 0xf) << 12 | (id & 0x0fff))
129#if !IS_ENABLED(_LINKER)
140#define BINDESC_NAME(name) bindesc_entry_##name
143#define __BINDESC_ENTRY_DEFINE(name) \
144 __aligned(BINDESC_ALIGNMENT) const struct bindesc_entry BINDESC_NAME(name) \
145 __in_section(_bindesc_entry, static, name) __used __noasan
165#define BINDESC_STR_DEFINE(name, id, value) \
166 __BINDESC_ENTRY_DEFINE(name) = { \
167 .tag = BINDESC_TAG(STR, id), \
168 .len = (uint16_t)sizeof(value), \
186#define BINDESC_UINT_DEFINE(name, id, value) \
187 __BINDESC_ENTRY_DEFINE(name) = { \
188 .tag = BINDESC_TAG(UINT, id), \
189 .len = (uint16_t)sizeof(uint32_t), \
190 .data = sys_uint32_to_array(value), \
211#define BINDESC_BYTES_DEFINE(name, id, value) \
212 __BINDESC_ENTRY_DEFINE(name) = { \
213 .tag = BINDESC_TAG(BYTES, id), \
214 .len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \
215 .data = __DEBRACKET value, \
227#define BINDESC_GET_STR(name) BINDESC_NAME(name).data
238#define BINDESC_GET_UINT(name) *(uint32_t *)&(BINDESC_NAME(name).data)
252#define BINDESC_GET_BYTES(name) BINDESC_NAME(name).data
263#define BINDESC_GET_SIZE(name) BINDESC_NAME(name).len
288BUILD_ASSERT(offsetof(
struct bindesc_entry, tag) == 0,
"Incorrect memory layout");
289BUILD_ASSERT(offsetof(
struct bindesc_entry, len) == 2,
"Incorrect memory layout");
290BUILD_ASSERT(offsetof(
struct bindesc_entry, data) == 4,
"Incorrect memory layout");
292#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_STRING)
293extern const struct bindesc_entry BINDESC_NAME(kernel_version_string);
296#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_MAJOR)
297extern const struct bindesc_entry BINDESC_NAME(kernel_version_major);
300#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_MINOR)
301extern const struct bindesc_entry BINDESC_NAME(kernel_version_minor);
304#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_PATCHLEVEL)
305extern const struct bindesc_entry BINDESC_NAME(kernel_version_patchlevel);
308#if IS_ENABLED(CONFIG_BINDESC_KERNEL_VERSION_NUMBER)
309extern const struct bindesc_entry BINDESC_NAME(kernel_version_number);
312#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_STRING)
313extern const struct bindesc_entry BINDESC_NAME(app_version_string);
316#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_MAJOR)
317extern const struct bindesc_entry BINDESC_NAME(app_version_major);
320#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_MINOR)
321extern const struct bindesc_entry BINDESC_NAME(app_version_minor);
324#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_PATCHLEVEL)
325extern const struct bindesc_entry BINDESC_NAME(app_version_patchlevel);
328#if IS_ENABLED(CONFIG_BINDESC_APP_VERSION_NUMBER)
329extern const struct bindesc_entry BINDESC_NAME(app_version_number);
332#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_YEAR)
333extern const struct bindesc_entry BINDESC_NAME(build_time_year);
336#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_MONTH)
337extern const struct bindesc_entry BINDESC_NAME(build_time_month);
340#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_DAY)
341extern const struct bindesc_entry BINDESC_NAME(build_time_day);
344#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_HOUR)
345extern const struct bindesc_entry BINDESC_NAME(build_time_hour);
348#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_MINUTE)
349extern const struct bindesc_entry BINDESC_NAME(build_time_minute);
352#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_SECOND)
353extern const struct bindesc_entry BINDESC_NAME(build_time_second);
356#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_UNIX)
357extern const struct bindesc_entry BINDESC_NAME(build_time_unix);
360#if IS_ENABLED(CONFIG_BINDESC_BUILD_DATE_TIME_STRING)
361extern const struct bindesc_entry BINDESC_NAME(build_date_time_string);
364#if IS_ENABLED(CONFIG_BINDESC_BUILD_DATE_STRING)
365extern const struct bindesc_entry BINDESC_NAME(build_date_string);
368#if IS_ENABLED(CONFIG_BINDESC_BUILD_TIME_STRING)
369extern const struct bindesc_entry BINDESC_NAME(build_time_string);
372#if IS_ENABLED(CONFIG_BINDESC_HOST_NAME)
376#if IS_ENABLED(CONFIG_BINDESC_C_COMPILER_NAME)
377extern const struct bindesc_entry BINDESC_NAME(c_compiler_name);
380#if IS_ENABLED(CONFIG_BINDESC_C_COMPILER_VERSION)
381extern const struct bindesc_entry BINDESC_NAME(c_compiler_version);
384#if IS_ENABLED(CONFIG_BINDESC_CXX_COMPILER_NAME)
385extern const struct bindesc_entry BINDESC_NAME(cxx_compiler_name);
388#if IS_ENABLED(CONFIG_BINDESC_CXX_COMPILER_VERSION)
389extern 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:273
uint8_t data[]
Value of the entry.
Definition: bindesc.h:279
uint16_t tag
Tag of the entry.
Definition: bindesc.h:275
uint16_t len
Length of the descriptor data.
Definition: bindesc.h:277