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_APP_BUILD_VERSION 0x805
58#define BINDESC_ID_KERNEL_VERSION_STRING 0x900
61#define BINDESC_ID_KERNEL_VERSION_MAJOR 0x901
64#define BINDESC_ID_KERNEL_VERSION_MINOR 0x902
67#define BINDESC_ID_KERNEL_VERSION_PATCHLEVEL 0x903
70#define BINDESC_ID_KERNEL_VERSION_NUMBER 0x904
73#define BINDESC_ID_KERNEL_BUILD_VERSION 0x905
76#define BINDESC_ID_BUILD_TIME_YEAR 0xa00
79#define BINDESC_ID_BUILD_TIME_MONTH 0xa01
82#define BINDESC_ID_BUILD_TIME_DAY 0xa02
85#define BINDESC_ID_BUILD_TIME_HOUR 0xa03
88#define BINDESC_ID_BUILD_TIME_MINUTE 0xa04
91#define BINDESC_ID_BUILD_TIME_SECOND 0xa05
94#define BINDESC_ID_BUILD_TIME_UNIX 0xa06
97#define BINDESC_ID_BUILD_DATE_TIME_STRING 0xa07
100#define BINDESC_ID_BUILD_DATE_STRING 0xa08
103#define BINDESC_ID_BUILD_TIME_STRING 0xa09
106#define BINDESC_ID_HOST_NAME 0xb00
109#define BINDESC_ID_C_COMPILER_NAME 0xb01
112#define BINDESC_ID_C_COMPILER_VERSION 0xb02
115#define BINDESC_ID_CXX_COMPILER_NAME 0xb03
118#define BINDESC_ID_CXX_COMPILER_VERSION 0xb04
120#define BINDESC_TAG_DESCRIPTORS_END BINDESC_TAG(DESCRIPTORS_END, 0x0fff)
132#define BINDESC_TAG(type, id) ((BINDESC_TYPE_##type & 0xf) << 12 | (id & 0x0fff))
149#define BINDESC_NAME(name) bindesc_entry_##name
152#define __BINDESC_ENTRY_DEFINE(name) \
153 __aligned(BINDESC_ALIGNMENT) const struct bindesc_entry BINDESC_NAME(name) \
154 __in_section(_bindesc_entry, static, name) __used __noasan
174#define BINDESC_STR_DEFINE(name, id, value) \
175 __BINDESC_ENTRY_DEFINE(name) = { \
176 .tag = BINDESC_TAG(STR, id), \
177 .len = (uint16_t)sizeof(value), \
195#define BINDESC_UINT_DEFINE(name, id, value) \
196 __BINDESC_ENTRY_DEFINE(name) = { \
197 .tag = BINDESC_TAG(UINT, id), \
198 .len = (uint16_t)sizeof(uint32_t), \
199 .data = sys_uint32_to_array(value), \
220#define BINDESC_BYTES_DEFINE(name, id, value) \
221 __BINDESC_ENTRY_DEFINE(name) = { \
222 .tag = BINDESC_TAG(BYTES, id), \
223 .len = (uint16_t)sizeof((uint8_t [])__DEBRACKET value), \
224 .data = __DEBRACKET value, \
236#define BINDESC_GET_STR(name) BINDESC_NAME(name).data
247#define BINDESC_GET_UINT(name) *(uint32_t *)&(BINDESC_NAME(name).data)
261#define BINDESC_GET_BYTES(name) BINDESC_NAME(name).data
272#define BINDESC_GET_SIZE(name) BINDESC_NAME(name).len
278struct bindesc_entry {
293BUILD_ASSERT(offsetof(
struct bindesc_entry, tag) == 0,
"Incorrect memory layout");
294BUILD_ASSERT(offsetof(
struct bindesc_entry, len) == 2,
"Incorrect memory layout");
295BUILD_ASSERT(offsetof(
struct bindesc_entry, data) == 4,
"Incorrect memory layout");
297#if defined(CONFIG_BINDESC_KERNEL_VERSION_STRING)
298extern const struct bindesc_entry BINDESC_NAME(kernel_version_string);
301#if defined(CONFIG_BINDESC_KERNEL_VERSION_MAJOR)
302extern const struct bindesc_entry BINDESC_NAME(kernel_version_major);
305#if defined(CONFIG_BINDESC_KERNEL_VERSION_MINOR)
306extern const struct bindesc_entry BINDESC_NAME(kernel_version_minor);
309#if defined(CONFIG_BINDESC_KERNEL_VERSION_PATCHLEVEL)
310extern const struct bindesc_entry BINDESC_NAME(kernel_version_patchlevel);
313#if defined(CONFIG_BINDESC_KERNEL_VERSION_NUMBER)
314extern const struct bindesc_entry BINDESC_NAME(kernel_version_number);
317#if defined(CONFIG_BINDESC_KERNEL_BUILD_VERSION)
318extern const struct bindesc_entry BINDESC_NAME(kernel_build_version);
321#if defined(CONFIG_BINDESC_APP_VERSION_STRING)
322extern const struct bindesc_entry BINDESC_NAME(app_version_string);
325#if defined(CONFIG_BINDESC_APP_VERSION_MAJOR)
326extern const struct bindesc_entry BINDESC_NAME(app_version_major);
329#if defined(CONFIG_BINDESC_APP_VERSION_MINOR)
330extern const struct bindesc_entry BINDESC_NAME(app_version_minor);
333#if defined(CONFIG_BINDESC_APP_VERSION_PATCHLEVEL)
334extern const struct bindesc_entry BINDESC_NAME(app_version_patchlevel);
337#if defined(CONFIG_BINDESC_APP_VERSION_NUMBER)
338extern const struct bindesc_entry BINDESC_NAME(app_version_number);
341#if defined(CONFIG_BINDESC_APP_BUILD_VERSION)
342extern const struct bindesc_entry BINDESC_NAME(app_build_version);
345#if defined(CONFIG_BINDESC_BUILD_TIME_YEAR)
346extern const struct bindesc_entry BINDESC_NAME(build_time_year);
349#if defined(CONFIG_BINDESC_BUILD_TIME_MONTH)
350extern const struct bindesc_entry BINDESC_NAME(build_time_month);
353#if defined(CONFIG_BINDESC_BUILD_TIME_DAY)
354extern const struct bindesc_entry BINDESC_NAME(build_time_day);
357#if defined(CONFIG_BINDESC_BUILD_TIME_HOUR)
358extern const struct bindesc_entry BINDESC_NAME(build_time_hour);
361#if defined(CONFIG_BINDESC_BUILD_TIME_MINUTE)
362extern const struct bindesc_entry BINDESC_NAME(build_time_minute);
365#if defined(CONFIG_BINDESC_BUILD_TIME_SECOND)
366extern const struct bindesc_entry BINDESC_NAME(build_time_second);
369#if defined(CONFIG_BINDESC_BUILD_TIME_UNIX)
370extern const struct bindesc_entry BINDESC_NAME(build_time_unix);
373#if defined(CONFIG_BINDESC_BUILD_DATE_TIME_STRING)
374extern const struct bindesc_entry BINDESC_NAME(build_date_time_string);
377#if defined(CONFIG_BINDESC_BUILD_DATE_STRING)
378extern const struct bindesc_entry BINDESC_NAME(build_date_string);
381#if defined(CONFIG_BINDESC_BUILD_TIME_STRING)
382extern const struct bindesc_entry BINDESC_NAME(build_time_string);
385#if defined(CONFIG_BINDESC_HOST_NAME)
386extern const struct bindesc_entry BINDESC_NAME(host_name);
389#if defined(CONFIG_BINDESC_C_COMPILER_NAME)
390extern const struct bindesc_entry BINDESC_NAME(c_compiler_name);
393#if defined(CONFIG_BINDESC_C_COMPILER_VERSION)
394extern const struct bindesc_entry BINDESC_NAME(c_compiler_version);
397#if defined(CONFIG_BINDESC_CXX_COMPILER_NAME)
398extern const struct bindesc_entry BINDESC_NAME(cxx_compiler_name);
401#if defined(CONFIG_BINDESC_CXX_COMPILER_VERSION)
402extern 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